Tag: linux

Better Use visudo

I had the unfortunate experience to lock myself out from using sudo on my NAS server.

All I wanted to do was give my user permission to run smartctl, which usually requires root privileges. This can be achieved by editing the /etc/sudoers file.

However I did not use visudo for this task. After removing the pound sign from the #include statement – which, let’s be honest, looks like a comment that needs to be uncommented – I saved the file and closed it.
At this moment visudo would have raised an error, if I had used it, and prevented me from saving the invalid sudoers file.

Long story short I was locked out from using the sudo command. After booting into a Linux live/rescue image from USB I could fix the syntax error in /etc/sudoers.

The moral of the whole story, better use visudo when editing /etc/sudoers.

That’s it.


References:

  1. https://www.sudo.ws/docs/man/1.8.13/sudoers.man/#SUDOERS_FILE_FORMAT
  2. https://stackoverflow.com/questions/30895493/using-smartctl-without-sudo
  3. https://toroid.org/sudoers-syntax

How to Move Docker Volumes

At some point we all want to store Docker images and volumes on a different drive, to avoid the system drive being filled up as the volumes grow. Here’s how.

Wireguard on Lightsail gone Ship-Wrecked

For a long time now I run an AWS Lightsail VPS serving as a wireguard gateway to my home server. Since recently connecting to the Lightsail instance via wireguard is no longer possible.
When I took a look with SSH I got

$> sudo wg-quick up wg0
[#] ip link add wg0 type wireguard
RTNETLINK answers: Operation not supported
Unable to access interface: Protocol not supported
[#] ip link delete dev wg0
Cannot find device "wg0"

To be sure I updated all packages, but the problem still persisted.
The port used by wireguard had not changed and still was accessible according to the network settings of Lightsail.
What change in the Lightsail VPS or network settings could cause an issue like this? It literally just stopped working over night.

Setting up Wireguard on Ubuntu

Wireguard is a modern VPN protocol allowing secure and confidential communication between a network of peers. Wireguard is based on the concept of private-public key cryptography and a number of other modern cryptographic algorithms. Have a look at the wireguard white paper for more details.

Wireguard Requirements

Since Linux kernel version 5.6 (late March 2020) wireguard is an integral part of the Linux kernel. That means Linux distributions using a kernel >= 5.6 do not need to install any additional packages in order to support wireguard.

OpenMediaVault Issues

So my OpenMediaVault (OMV) NAS did reboot today for some reason. It didn’t manage to boot up successfully again, however, but entered “emergency mode” instead.
After some digging around it seems this is related to the combination of LUKS drive encryption and MergerFS (same with UnionFS).
For normal operation, first the LUKS drives need to be decrypted. Then the decrypted drives can be pooled together with MergerFS.
Some changes in OMV 5 (as compared to OMV 4) cause the boot sequence to enter emergency mode if not all drives in /etc/fstab can be mounted while booting. Since the LUKS drives are still encrypted when booting, mounting those drives obviously fails. And consequently mounting the MergerFS filesystem also cannot succeed.

The issue can be patched by adding the nofail option to all LUKS drives in /etc/fstab and also adding the noauto option to the MergerFS entry in /etc/fstab. It may only be a matter of time until OMV decides to rewrite /etc/fstab, thus nullifying the changes described above.

But since I do not reboot my NAS that often, the above patch works fine for now.


References:

  1. https://forum.openmediavault.org/index.php?thread/30129-problem-booting-up-with-luks-and-unionfilesystem/&pageNo=2
  2. https://forum.openmediavault.org/index.php?thread/33186-omv-5-0-keeps-booting-into-emergency-mode-can-t-ssh-in/
  3. https://forum.openmediavault.org/index.php?thread/33213-omv-booting-to-emergency-mode/

Undelete Files with SnapRAID

Today I accidentally deleted a whole folder of important documents on my OpenMediaVault(OMV) NAS, while doing some cleaning up.
Of course I would have a backup of the folder on an external hard-drive, but this was the perfect opportunity to test SnapRAID.

WSL on Windows 10

There is a new kid in town when it comes to “doing Linux under Windows”. Up to now there was primarily Cygwin and MinGW. But for a while now Microsoft offers the Windows Subsystem for Linux (WSL). I personally think the name should be the other way around (LSW) but what do I know.

How to set up NordVPN on Ubuntu

There are two ways to set up a VPN connection with NordVPN on Ubuntu. The first one is to add NordVPN’s package repository to the apt sources and then install the nordvpn client via a simple sudo apt install nordvpn. The second one is to install OpenVPN and configure it to use the servers of NordVPN.
This how-to was written for Ubuntu 18.04 LTS (Bionic Beaver).

Process Control in a Linux Shell

Working on the command line in a Linux shell can be tricky at times. A frequent source of frustration is that tasks which are trivial with a graphical desktop environment can be seemingly much more difficult to achieve on the command line. For example switching between multiple running applications only requires one or two mouse clicks on a graphical desktop, but demands more arcane knowledge to do it on the command line.

Only Fools Do Not Reboot

So I wanted to install the GuestAdditions on my virtual machine running Fedora 21 workstation just now.

The VM was already running, so I estimated about 5 minutes tops to get the job done. I mounted the VBoxGuestAdditions.iso into the VM and started the setup procedure.

Powered by WordPress & Theme by Anders Norén

Close Bitnami banner
Bitnami