2020. március 9.

Update Java version with AdoptOpenJDK

1. Install the JDK version you want with apt-get
(Steps copied from the linked source)

Import the official AdoptOpenJDK GPG key by running the following command:
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -

Import the AdoptOpenJDK DEB repository by running the following command:
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/

Refresh your package list:
sudo apt-get update

Install your chosen AdoptOpenJDK package. For example, to install OpenJDK 8 with the HotSpot VM, run:
sudo apt-get install <adoptopenjdk-8-hotspot>

2. update alternatives:

List alternatives for java:
~$ update-alternatives --list java

Check the java version of the alternative you would like to set:
~$ /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64/bin/java --version
openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)

Set the chosen version as the default:
~$ sudo update-alternatives --set java /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64/bin/java

update environmetal variables
For me, there is a maven.sh in /etc/profile.d that sets the env vars required for maven.
~$ sudo gedit /etc/profile.d/maven.sh
Update the JAVA_HOME path here. (in my case to /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64/)

2019. augusztus 3.

Display settings lost on reboot

As described here, this problem is affecting others as well:
Here are the steps I tool to assemble the little script below:

How many displays do you have right now?
xrandr | grep -w connected | wc -l
How to position your displays?
How to rotate a display?
xrandr --output SCREEN-ID --rotate [normal|left|right|inverted]
How to get your display IDs?
primary display:
xrandr | grep -w connected | grep primary | cut -d' ' -f1
secondary display:
xrandr | grep -w connected | grep -v primary | cut -d' ' -f1
How to position your gnome-panels?
Apparently there is no easy way, but for the note, here's where to find these setting:
org.gnome.gnome-panel.layout.toplevels.bottom-panel monitor 0
org.gnome.gnome-panel.layout.toplevels.top-panel monitor 1

Here's the script I put into my .bashrc (.profile would be also a good place for it) to restore the positions of my displays (I have the laptop below the monitor).

# set dual display positions
# because they are forgotten after logout
function reset_displays {
 display_count=`xrandr | grep -w connected | wc -l`
 if [ "$display_count" -eq "2" ]; then
  id1=`xrandr | grep -w connected | grep primary | cut -d' ' -f1`
  id2=`xrandr | grep -w connected | grep -v primary | cut -d' ' -f1`
  xrandr --output $id2 --rotate normal
  xrandr --output $id1 --below $id2

2019. január 3.

ImageMagick not authorized format conversion

For the following command
convert example.pbm example.ps
I got the following error:
convert: not authorized `example.ps' @ error/constitute.c/WriteImage/1028.
I fixed it by following the instructions in this post:
  1. sudo gedit /etc/ImageMagick-6/policy.xml
  2. change 'rights' from "none" to "read|write" in the line where the 'pattern' is 'PS'.
    I changed it for 'PDF' too and moved these lines to a separate section, so now it looks like this:
  <!-- manually re-enabled ghostscript format types -->
  <policy domain="coder" rights="read|write" pattern="PS" />
  <policy domain="coder" rights="read|write" pattern="PDF" />

2018. május 2.

NVIDIA GeForce 930MX driver update

I ran into this "little" problem with SweetHome3D that it says "Sweet Home 3D will exit now because of a fatal error in 3D rendering system". The SH3D FAQ suggests to upgrade to the lastet graphic card driver.

I did not have a dedicated graphic card in my laptop before so having to care for the driver is a new experience.

The card in my Dell Latitude 5480 is an NVIDIA GeForce 930MX.
I found that the driver can be downloaded from the official site.
Here's how to pick it out from the list.
Current version is 390.48; released on 2018.03.28. It needs to be run from terminal with root.

Then I tried to install it from the terminal by running the .ran file and got stuck on errors

First I got the error: "You do not appear to have an NVIDIA GPU supported..."
This is fixed by changing the PRIME Profile from Intel (Power Saving Mode) to NVIDIA (Performance Mode) in NVIDIA X Server Settings (screenshot) (in flashback: Applications --> System Tools --> Administration)
Then log out and log in again, and this error will be gone.
However this alone did not solve the SweetHome3D problem, in the contrary it got it worse, now the program crashes at startup with the mentioned error.
The next error was "You appear to be running an X server..."
To get rid of this, here's a handy step-by-step:
  1. Switch to terminal with Ctrl+Alt+F1
    (switch back with Ctrl+Alt+F7 if you need to)
  2. Stop X with sudo service lightdm stop
    (start it back up with sudo service lightdm start if you need to)
Now, the following error was "The distribution-provided pre-install script failed..."
When I searched for this I ran into a some promising askubuntu answers:

Then I acquired some more info on my hardware

First of all, I ran lspci -k | grep -EA2 'VGA|3D' to find out what I have on the machine:
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
 DeviceName:  Onboard IGD
 Subsystem: Dell Device 07d0
02:00.0 3D controller: NVIDIA Corporation Device 134e (rev a2)
 Subsystem: Dell Device 07d0
 Kernel driver in use: nvidia
With sudo lshw -numeric -C display | grep -E "(product|vendor)" we get a different but similar set of information:
product: NVIDIA Corporation [10DE:134E]
vendor: NVIDIA Corporation [10DE]
product: Intel Corporation [8086:591B]
vendor: Intel Corporation [8086]
To get the current nvidia driver version, run nvidia-smi from terminal.
This information is also available from the Software&Updates setting Additional Drivers tab. (screenshot here) and also from the NVIDIA X Server Settings mentioned before.
I'm running 384.111

Then I tried to install it from the ppa repository and succeeded

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt-get install nvidia-390
It said that there are recommended packages: libcuda1-390 nvidia-opencl-icd-390, so I installed those too:
sudo apt-get install libcuda1-390 nvidia-opencl-icd-390
I also did a sudo apt autoremove while I was at it.
Restarted the machine, and now I have the 390.48 version driver successfully installed. The procedure was pretty painless.

As for the SweetHome3D program, this unfortunately did not help.
However I succeeded with the next suggestion in the FAQ: running SH3D compiled with the older Java3D library (SweetHome3D-Java3D-1_5_2)

2018. január 18.

New laptop: Dell Latitude 5480

Finally I am replacing the HP-Compaq TC-4400 (named Alice) I've been using since May 2008. Yes, for almost 10 years now. That is the notebook I started this blog for, so it's the end of an era for me.

I had to make plenty of compromises when choosing the replacement, but hey, it's new, it's fast, it's strong, it's even lighter a bit, and has better screen resolution. On the downside, it's bigger, it is not a tablet pc, and the keyboard is not exactly to my liking. Lucky me, the keys can be remapped.

The blog will be continued under the name Alice@Ubuntu even though I'll stop using the machine that gave the blog it's name. The content slowly shifted from machine specific configuration to more general topics throughout the years anyway.