söndag 14 mars 2021

Get full path for a file.

Time for another oneliner. I often need to get the full path of a file.
This can be done using the following command:

readlink -f myfile

Via stackoverflow.com

onsdag 3 mars 2021

Text disappearing from context menus in Gnome

I'm having an issue where most text in Gnome disappears or gets corrupted. I'm yet to find the root cause.
In the meantime the best quickfix is to restart Gnome.

To do so, press alt + F2, type r and press enter.

Via linuxconfig.org

lördag 27 februari 2021

måndag 15 februari 2021

Can't init device hci0: Connection timed out (110)

Bluetooth stopped working on my raspberry pi running raspbian. The first I tried was to reset the interface by running hciconfig hci0 down/up, but that gave me "Can't init device hci0: Connection timed out (110)".

I found that by removing the btusb module and then adding it back, I was able to get bluetooth working again. Next time bluetooth gives up, I will run this:
sudo hciconfig hci0 down
sudo rmmod btusb
sudo modprobe btusb
sudo hciconfig hci0 up
Via unix.stackexchange.com

lördag 11 april 2020

Overclock works in Windows but hangs in Linux.

So I have this old Intel Lynnfield system from 2010. It's overclocked and has been so for many years. Works perfectly in Windows even during high load for several days. Ubuntu and other distributions I tried would randomly freeze. Even more strangely, it never happened during heavy load.

Maybe Linux uses some CPU instruction Windows doesn't and that particular instruction doesn't work with the overclock? I clocked the CPU down, but Linux would still hang randomly.
I upgraded the motherboard bios, I upgraded the GPU bios. I replaced the soundcard. I checked SMART data for the drives. I ran memtest. I tested with a different GPU vendor.
But I couldn't find what was going on. Why was it freezing, so randomly, when there was almost no load in the system?

But then, for some reason I checked the cpu frequency using /proc/cpuinfo. The CPU wasn't running at the speed I had specified in bios, it was clocking down. That could certainly explain why the system froze during low load scenarios. CPU scaling and overclocking seldom works well, but I had disabled the C-states in bios. I had disabled turbo in bios. I knew for a fact that this was the case, since I've checked it numerous times in Windows.

So I started searching about C-states and the Linux kernel. For some reason the kernel ignores whether the bios has turned off the c-states or not. Thus, my disabled C-states was enabled. Confusing and frustrating.

I tried to fix this by disabling cpu scaling within Ubuntu, but for some reason it never worked as it was supposed to. Then I found that there is a kernel parameter for specifying what level of C-state that is allowed.
intel_idle.max_cstate=1

So I opened up /etc/default/grub and modified the GRUB_CMDLINE_LINUX_DEFAULT:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_idle.max_cstate=1"

Then I ran
sudo update-grub2
sudo reboot

Finally I confirmed that the cpu was no longer scaling using
cat /proc/cpuinfo

If I understand it correctly (haven't verified), you can set the max_cstate to 0 to disable the intel_idle driver, which should make the kernel use the bios/uefi settings instead.

Sources:
Info from Dell
Info from IBM

onsdag 11 mars 2020

Where does files mount in Ubuntu?

So I was mounting network directories using the graphical interface in the files application, when I needed to use the mount points with the terminal. Where are those mount points located?

That location is here:
/run/user/[uid]/gvfs/[mount]/

Source: askubuntu.com

torsdag 12 december 2019

openssl: Can't load /home/[username]/.rnd into RNG

On Ubuntu 18.04 LTS I got the following error message:
Can't load /home/sniglom/.rnd into RNG

The solution was to comment out the following line in /etc/ssl/openssl.cnf:
RANDFILE = $ENV::HOME/.rnd

I found this solution via the openssl project at github.