Taking a look at Java 10 with Eclipse Oxygen.3 (with not much success)

Java 10 was released on 3/20/18 and can be downloaded from the Oracle JDK download site here. After installing on my Mac it shows both the yy.mm (18.3) version names and the “version 10”:

With each new JDK release it always seems there’s a slight lag before the IDEs catch up, but Eclipse has Java 10 support in the latest 4.7.3a release. I currently have the Oxygen.2 release (4.7.2):

… so I started an update to pick up the latest.

From Eclipse Marketplace the previous Java 10 support plugin is no longer needed if you have the latest Eclipse 4.7.3a release:

Updating my Eclipse to 4.7.3 however didn’t get me the ‘a’ release, so following the link in the Marketplace item above gives you a number of download options, or update sites to pick up the development build features (the page says this is version ‘Eclipse 4.7.3a Maintenance Build: M20180322-1835’)

I added the update site and selected all available updates and tried another update. After a restart when prompted I’ve now got version 4.7.3, but it’s not clear id this is the ‘a’ update or not:

Here’s a good summary of the major changes in Java 10. The feature I find most interesting is the addition of the var keyword for inferred local variable types.

Adding the Java 10 JDK location as a new JRE in Eclipse:

It gets recognized ok, but with a Maven pom.xml based project, the Maven Compiler plugin doesn’t seem to recognize either a compiler version of 1.10, 10, or 18.3, the project is still kept at the default of 1.5:

From the project preferences though, it is possible to add a JRE System Library for the JDK 10:

Trying out a snippet of code using the ‘var’ keyword, it’s not looking good so far:

Let’s go back to the Marketplace and see if we can install the Java 10 plugin anyway – even though it says it’s disabled, it looks like you can install it:

Well this is not good, but looks like we have an invalid update site, which we can probably remove:

Here it is, we can uncheck this one:

Unchecking it or removing it though doesn’t make the error go away, so no luck installing the plugin.

At this point it might be best to download one of the prebuild milestone builds from the 4.7.3a download page. Let’s try that next.

Ok, milestone build downloaded, and now we’ve definitely got the 4.7.3a build:

Interesting, this build doesn’t have any of the regular Eclipse JDT tools, so you have to install though from ‘Install Software’.

After installing the JDT plugin though, looks like I’ve still got the same issue with the var keyword not being recognized, despite selecting the Java 10 JRE as the platform default.

At this point doing some more searching around, I don’t think the var keyword support is included until Eclipse 4.8, see here: https://wiki.eclipse.org/JDT_Core/Plan/4.8/JEP286

Looks like we’ll have to wait for that Eclipse Photon 4.8 release to get into these new Java 10 features, which is not coming until June. At that point given that the new Java releases are coming every 6 month, we’ll already be over halfway to the Java 11 release.

 

 

Oracle Linux 7: “one of the configured repositories failed”

After a fresh install of Oracle Linux 7.4 and trying to run a ‘sudo yum update’ I get:

One of the configured repositories failed (Latest Unbreakable Enterprise Linux Server 7 Server (x86_64)

Following the recommendations following the error didn’t help, and this post suggested trying a ‘sudo yum clean’, but this didn’t fix it either.

Checking if I have network connectivity, it’s seems I can’t ping www.google.com or ping 8.8.8.8. I’ve come across this before with RHEL/CentOS installs and forgetting to enable the network interface options during install. Checking /etc/sysconfig/network-scripts/ifcfg-* the ONBOOT property was set to no. Changing it to yes and rebooting did the trick.

 

Expanding the disk size for an Ubuntu guest on VMware ESXi

Stop the guest VM.

Change the attached disk size in VM settings:

Attach a gparted iso or alternatively you can attach the original Ubuntu desktop ISO that you originally installed from.

Change the Boot Option for your VM to boot into the guest VM’s BIOS (‘Force BIOS setup’) to change the boot order with the cdrom first (by default it won’t boot from the attached cdrom as it’s set to only boot from cdrom if the attached disk does not boot first):

With the gparted iso or Ubuntu desktop install iso attached, restart the VM, and then run gparted.

Use gparted to expand the partition into the free space.

Once resized, reboot the Unbuntu guest (reset the boot order or unattach the cdrom iso image).

Use pvdisplay to get the Volume Group name

$ sudo pvdisplay

  --- Physical volume ---

  PV Name               /dev/sda5

  VG Name               ubuntu-vg

  PV Size               39.76 GiB / not usable 2.00 MiB

  Allocatable           yes (but full)

  PE Size               4.00 MiB

  Total PE              10178

  Free PE               0

  Allocated PE          10178

Use vgextend with the volume group name and physical disk name to extend:

sudo vgextend ubuntu-vg /dev/sda5

Use lvextend with param “-l+100%FREE” to expand the logical volume:

sudo lvextend -l+100%FREE /dev/ubuntu-vg/root

Now use resize2fs:

sudo resize2fs /dev/mapper/ubuntu--vg-root

Done!

More info on using gparted here. Info on resizing LVM disks in this article here.

GitLab not restarting, postresql service not running

After restarting my GitLab server I kept getting the 502 “GitLab is taking too much time to respond” error.

Taking a look at the running services, I get this:

$ sudo gitlab-ctl status

run: gitaly: (pid 1048) 382s; run: log: (pid 1046) 382s

run: gitlab-monitor: (pid 1035) 382s; run: log: (pid 1033) 382s

run: gitlab-workhorse: (pid 1047) 382s; run: log: (pid 1045) 382s

run: logrotate: (pid 1029) 382s; run: log: (pid 1028) 382s

run: nginx: (pid 3900) 15s; run: log: (pid 1026) 382s

run: node-exporter: (pid 1031) 382s; run: log: (pid 1030) 382s

run: postgres-exporter: (pid 1039) 382s; run: log: (pid 1038) 382s

down: postgresql: 0s, normally up, want up; run: log: (pid 1041) 382s

run: prometheus: (pid 3919) 15s; run: log: (pid 1032) 382s

run: redis: (pid 1053) 382s; run: log: (pid 1050) 382s

run: redis-exporter: (pid 1037) 382s; run: log: (pid 1036) 382s

run: sidekiq: (pid 3931) 14s; run: log: (pid 1049) 382s

run: unicorn: (pid 3937) 14s; run: log: (pid 1044) 382s

Everything is up apart from Postgresql. Trying to stop all services and restart, or rebooting the sever still gets the same error. Checking GitLab’s postgresql logs, they show:

2018-03-13_04:04:45.73226 FATAL:  pre-existing shared memory block (key 5432001, ID 0) is still in use

2018-03-13_04:04:45.73232 HINT:  If you're sure there are no old server processes still running, remove the shared memory block or just delete the file "postmaster.pid".

Doing a quick search found this identical question. Following the steps in the first answer:

sudo gitlab-ctl stop
sudo systemctl stop gitlab-runsvdir.service
ps aux | grep postgre (check if there are any postgres processes; shouldn't be)
sudo rm /var/opt/gitlab/postgresql/data/postmaster.pid
sudo systemctl start gitlab-runsvdir.service
sudo gitlab-ctl reconfigure

And then ‘sudo gitlab-ctl start’ and now everything is back up and clean.