Linux setup notes – hostname to communicate with Windows computer

In Debian, the hostname is located in /etc/hostname. The name won’t show up on my router (linux firmware) until I’ve got the right hosts order:

# /etc/nsswitch.conf
hosts:          files dns wins

However, Windows doesn’t recognize the hostname since it uses NetBIOS, which means I need nmbd in sambapackage:

apt-get install samba

Install it and I can ping right away and use the SMB shares!

Loading

Use SSD for bootable USB stick Linux liveboot

If you flash a Debian-style Linux live-boot image that’s intended for USB stick on a USB-SSD itself (for speed), it will get stuck at initramfs on boot because unlike USB sticks, USB SSD drives are not considered removable drives, yet the live-boot parameters (scripts) set to search only removable media, hence it cannot find the right device.

The solution is to remove live-media=removable as boot parameter (typically under append initrd). You can do that quickly on each boot by TAB key to modify this key-value pair out of the boot parameters and hit enter.

To make it persistent, you have to edit the scripts where these boot parameter lives. The live USB stick/CD was supposed to be mounted as a read-only volume, so we need to first remount it as writable in order to modify the scripts:

mount -o remount -w /lib/live/mount/medium

Note the -w parameter which means writable. -o means options. -o remount,rw means exercising the remount option as a writable drive (-w is alternate syntax for writable).

Make sure you have root access (to modify these files), and edit these live*.cfg files if it shows up in the following folders:

/lib/live/mount/medium/syslinux/live*.cfg
/lib/live/mount/medium/EFI/boot/live*.cfg

Then take out live-media=removable in for the boot menu item you normally use for each of these script .cfg files. Reboot after you are done.

Loading

Foobar2000 alternatives for Linux

I am a big fan of foobar2000 because it’s one of the most terse yet flexible package for playing music. I tried using RhythmBox that came with Linux Mint, but it’s annoying as hell. When you double click an audio file, it’ll adds to a default playlist and after it finished playing, it’ll go and play other songs you’ve previously clicked (because they were accumulated on the playlist).

Out of frustration, I tried to stick with my favorite, I found foobar2000 has a wine port available on Snap package manager. Downloaded it and realized it has a lot of work to do to make it work on linux:

  • Fonts do not scale. It’s always that tiny and not all the UI controls looks odd
  • The paths assumed windows drive letters. Sometimes if I drag and drop files from a bitlocker drive (mounted with dislocker), it’ll assume the file came from some complicated path under Z:\. WTF

Ended up downloading Clementine. It at least let me remove songs from the playlist by pressing “Del” button. But I’m not happy that it doesn’t have CDDB.

Turns out there are better options the Clementine. I found this StackExchange while searching for FreeDB options:

https://askubuntu.com/questions/541977/a-music-player-with-cd-ripping-and-cddb-lookup

Turns out DeaDBeeF (a hex pun) looks like a watered down version of foobar2000. So, Clementine, Foobar2000-Wine and RhythmBox is out.

EDIT: DeadBeef v1.82 offered on Ubuntu (Cinnamon Remix) 20.04’s repository mishandled files on an encrypted volume that’s unlocked. I went to Deadbeef’s website and downloaded DeaDBeeF 1.8.7 universal deb package amd64, installed it with dpkg -i and it worked!.

Loading

Dual-booting: Linux and Windows fight for the system clock

Turns out it’s a common problem when dual-booting Windows and Linux, they keep changing the hardware system clock on each other (unless you live in GMT+0 zone) because Windows assume the system time is the one at the set timezone while Linux think the system time is the UTC+0 time (and offset it afterwards).

Linux updates the time through NTP server blindly while Windows 7 check if the current time is within 1hr from the NTP server to avoid unintended time changes (I have to give Microsoft credit for that). EDIT: Windows 10 blindly updates the time like Linux too.

The easy solution is to have Linux follow Windows’ suit:

timedatectl set-local-rtc 1 --adjust-system-clock

Loading

X11VNC for Linux setup notes

x11vnc is a relatively smooth experience, but there are quite a few common use cases that would have been automated away if it’s a Windows program, namely have it start as a service on boot (before logging in)

It’s from babelmonk’s solution on StackExchange. Paraphrased here to make it easier to understand:

After installation, create the password file with -storepasswd switch AND specify the where you want the password saved as an optional argument, and I prefer /etc/x11vnc.pass:

sudo x11vnc -storepasswd {your password goes here} /etc/x11vnc.pass

which will be read by -rfbauth switch for the x11vnc program.


Build your own (systemctl) service by creating /etc/systemd/system/x11vnc.service:

[Unit]
Description="x11vnc"
Requires=display-manager.service
After=display-manager.service

[Service]
ExecStart=/usr/bin/x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth guess -rfbauth /etc/x11vnc.pass
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
Restart-sec=2

[Install]
WantedBy=multi-user.target

Then, start with:

sudo systemctl daemon-reload
sudo systemctl start x11vnc

Enable the service (if not already done by previous commands) so it will start on boot

sudo systemctl enable x11vnc

Loading