Which Filesystem to Use on USB Sticks for Mac+Linux Interoperability

I had an hfsplus-formatted USB stick that I wanted to use for backups on my Linux machine. All worked fine until I restarted the Linux box. I tried to mount the USB drive and got the error “Mount Point Not Mounted or Bad Option“:

This command had worked before to mount the drive, but after the reboot it wasn’t working. Checking dmesg and running mount in verbose mode (-v) didn’t provide any helpful info.

After digging around on the arch wiki and stackexchange, I came to find that Linux support for HFS is iffy at best. So I decided I’m not going to waste any more time digging into this error and instead will just reformat the drive with something more compatible and reliable.

The most recommended filesystem type if using the drive on both Macs and Linux is … Microsoft’s NTFS. Weird, but true. So, time to repartition and format the drive as NTFS! Here’s how this was accomplished:

  1. Install the ntfs-3g package using your favorite package manager
  2. sudo fdisk /dev/sdb , then type d, p, n, t, L, 11 (GPT), w
  3. sudo mkfs.ntfs -Q -L label /dev/sdb1

I then was able to mount the drive successfully via the following command. (and complete my backups)

sudo mount --mkdir /dev/sdb1 /mnt/usb256MB -o rw,force,user,auto -t ntfs-3g

Thanks to Stefan van den Akker for writing an excellent article that helped me re-familiarize myself with fdisk syntax.

How to Setup Metabase in Docker and Tunnel to it From an M1 Mac

Since Metabase doesn’t have an official M1 build, and doesn’t work well at all in Rosetta (extremely slow performance/never loads), I decided to run it from my Linux amd64/intel machine and then tunnel to it from my Mac:

# On Linux:
docker pull metabase/metabase:latest
docker run -d -p 3000:3000 --name metabase metabase/metabase
sudo docker logs -f metabase

# From Mac, sets up a temporary tunnel for as long as ssh runs:
ssh host -L 3000:localhost:3000

Now I could login to Metabase on my Mac by visiting http://localhost:3000

This worked great, except for one error.

When I tried docker run for a second time, I kept getting the error “iptables failed – No chain/target/match by that name” even when the chain existed. Restarting docker and clearing/restarting iptables didn’t help.

I never figured out the reason for this error because I worked around it by restarting the machine.

Difference Between Ansible Playbooks, Tasks, Modules, and Roles

I was recently refreshing myself on Ansible and found a really good explanation from Brian Coca on the differences between playbooks, tasks, modules, and roles. I added some examples to his explanation below:

Playbooks contain Plays, we sometimes refer to the files that contain plays as playbook, it is also the ‘list of plays that i’m currently running’.

Plays map hosts to tasks.

ansible example play (more examples in the official docs) :

- name: Execute a script on all web server nodes
  hosts: web_nodes
  - name: Execute a script on all web server nodes
    script: /tmp/install_script.sh

Tasks perform an action (this action is normally a module).

(example task shown above within play)

A module is a plugin/script that follows certain Ansible input/output specs
Modules can be written in any language, Ansible only ships with python and powershell modules.

example module: script

You can run ansible-doc -l to get a list of modules available.

Roles are ‘reusable subsets of a play’, mainly they group tasks and resources to accomplish a certain goal, they have no host mapping and require being in a play.

You don’t really need to use [roles] to start, they are just a way of organizing, reusing and sharing.

Brian Coca

I would simplify roles to say they are organized groups of tasks needed to accomplish a goal.

example commands used when working with roles:

ansible galaxy init ROLENAME
ansible-galaxy search mysql
ansible-galaxy install geerlingguy.mysql

This short explainer really helped me when I had to relearn the basics of Ansible fast.

How to Quickly Switch Command and Control keys when using Linux and Barrier/Synergy with a Mac Keyboard

I have a Mac (the $599 Mac mini M1), a Magic Keyboard (which is somehow almost 25% of the price of a Mac mini), and a Linux machine. I wanted to use some of the same keyboard shortcuts on Linux as I was used to on the Mac. First I tried kinto.sh. The developer is fantastic to work with, but I got tired of messing with it. Kinto doesn’t work quite right with Barrier, even with a workaround for 1.2, or the original 1.1.

Then I tried using KDE’s native utilities to remap the keys. I spent hours on this and it turned out to be so buggy and unreliable.

So I had to go deeper. Here’s what I did to swap my Command and Control keys:

  1. xev # (to find out which key your Command key is)
  2. xmodmap -pm > xmodmap-pm-original-output
  3. vi ~/.Xmodmap
    • remove control = Control_L
    • remove mod4 = Super_L
    • add mod4 = Control_L
    • add control = Super_L
  4. xmodmap ~/.Xmodmap

Make really sure you do step 2! Should you make a mistake; this is your only backup.

This persists after a reboot. What xmodmap does (in this case) is swap your Command and Control keys at a much lower level than Kinto or KDE. And it just works!

xmodmap -pm (print current modifier map) output, plus tldr docs on top

Making TigerVNC work in Manjaro with Plasma KDE headlessly

The official Arch documentation for TigerVNC will not work with Plasma KDE out of the box.  You will get either an unable to connect error, or a blank screen on startup.

To get this to work with Manjaro/Plasma, you need to do the following:

Edit ~/.vnc/config with 

#localhost # commented out on purpose

Second, you need to ensure the user you’re logging in with is not the user that is logged in locally.  Or if it is, disable autologin (from the actual server), as per the following screenshot:

The above is all explained in Kyle GP’s video on YouTube, but since many people prefer short textual instructions to watching a video, I’m putting the howto / TLDW here.

What Kyle’s video doesn’t say is how to get TigerVNC working as a systemd unit.  What a lot of people don’t realize is the TigerVNC package in Manjaro comes with a systemd unit file already installed:

/usr/lib/systemd/system/vncserver@.service exists!

Just run:

systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service

Here’s what the TigerVNC packaged systemd unit looks like:

And you’re up and running with TigerVNC!

By the way, if you’re a big fan of Manjaro Linux – get the t-shirt. (it helps support the blog a tiny bit)

Error: sddm Failed to read display number from pipe

So that’s a weird error, right?

The error came up when when configuring tigervnc on Manjaro Linux, along with “(Xorg) crashed and dumped core”. (Found via sudo journalctl -p 3 -xb)

The problem turned out to be my fault. I had blindly put a new config file in /etc/X11/xorg.conf.d/10-vnc.conf when following these instructions on the Arch Linux wiki. This new config was causing the crash. The solution was just removing the errant config file. TigerVNC server then started just fine.

Big thanks to Feral Hedgehog on Reddit who got me looking in the right direction.

Switching from Linux back to the Mac

I used a Linux Thinkpad laptop for a little over 1 year at work. The latest long-term-support Ubuntu version of Linux was installed. As the months passed, it got more and more unreliable. The most serious problems were:

  • When powering on, it would often require 3 full power cycles to get to the desktop after login. I would be staring at a blinking cursor, and it would hang, with no progress, and I’d have to power off and on again.
  • Waking from sleep reliably would almost never happen, especially with a USB-C external monitor connected. I’d have to reboot when it couldn’t wake from sleep, sometimes multiple times.
  • Randomly forgets 200% scaled resolution at 4K and brings me back to 100%, requiring a trip to settings to set it back.
  • Fans spin louder when connected to any external monitor at any resolution.
  • Requires numerous tweaks to get many things working. For example, AirPods used to be normal volume but are now very low volume and can’t be reset, monitor brightness can’t be controlled via function keys and requires command line tool to adjust, fingerprint login only works 20% of the time, etc.
Image credit: itsfoss.com

All this time I had an older Mac laptop for another work project right next to it, and it by contrast was utterly reliable, even with gobs of enterprise security software installed on it. Wakes from sleep instantly 100% of the time, never forgets resolution, works perfectly in clamshell mode, and is mostly silent unless it’s doing an update.

My workplace has since replaced the Ubuntu Linux Thinkpad laptop with a M1 MacBook. It’s silent at all times. Really the only problems I have are occasionally it will set the external monitor to 100% brightness when waking from sleep, and once every couple of weeks I will have to unplug and replug the external monitor to get anything shown on the screen again. Other than that, it’s fantastic. No reboots needed.

Moving from Mac to Linux

My primary work laptop is now a Thinkpad with Ubuntu Linux 20.04 on it. To make life easier when switching from the Mac, I needed quite a few utilities and configuration tips:

Things I haven’t figured out how to do yet:

Please let me know if you’ve figured out how to do either of these last two things on the Thinkpad with Ubuntu.

My Experience with Linux on the Desktop

The company I work for encouraged me to use a top of the line Linux laptop — one of the latest ThinkPads — as my daily driver. Here’s what I’ve found in the first few days of using it, with Ubuntu 20.04.1:

  • Coming from a MacBook with its butter-smooth trackpad, the touchpad is painful. It’s not smooth at all, even with the default Synaptics drivers. It’s almost impossible to precisely focus your cursor in a small area. It’s really astonishing how bad it is.
  • Don’t expect to have external monitors work right away. I plugged my LG 4K monitor with a USB-C cable that works fine with several MacBooks into the ThinkPad. All I got was a cursor on the external monitor screen. That’s it, a cursor. Changing resolutions and refresh rates hasn’t helped. A colleague spent half a week futzing with settings until he finally got it to work. Another colleague recommended an unstable open source Nvidia driver instead of their proprietary driver, but I haven’t gotten that installed yet.
  • After I haven’t been able to get a single Bluetooth peripheral connected. Not a wireless keyboard, wireless trackpad, or wireless headphones. The Ubuntu Bluetooth settings app either hangs, crashes, or just displays a spinning cursor on the device you try to connect. After updating the ControllerMode to bredr in /etc/bluetooth/main.conf , I was able to get my AirPods to connect. To get the wireless keyboard or trackpad to connect, I had to unpair them from another laptop.
  • You’ll need a couple utilities to get most keyboard shortcuts to behave like a Mac, including spacebar for QuickLook, and Cmd-H to quickly move an app out of the way. I still haven’t figured out how to change the keyboard shortcut for going back in my browser. Alt-Left-Arrow just scrolls to the top of the page. Update: The author of Kinto, the keyboard shortcuts utility, is going to make Alt-Left-Arrow/Alt-Right-Arrow work in browsers in an upcoming release.
  • Scrolling web pages (in any browser) is slow and choppy. Supposedly you can fix this in a config file somewhere, but I haven’t found where yet.
  • 10% of the time, the laptop refuses to wake from sleep, requiring a long press on the power button to power off and reboot.
  • The fans spin up for no good reason when I plug the power cord in. Thankfully, they aren’t too loud.
  • I kept having my wireless bluetooth trackpad disconnect and reconnect, every 2-4 minutes. Eventually I figured out this was due to the UPower daemon polling the trackpad for battery status. Adding NoPollBatteries=true to /etc/UPower/UPower.conf and then running systemctl restart upower.service and the problem seems to have gone away.
  • I also had the problem where every time the bluetooth trackpad disconnected/reconnected, it would lose its trackpad speed and natural scrolling settings. To fix this, I updated the mutter package.
  • Finally, the brightness on my external monitor kept resetting itself. I would have to run xrandr –output DP-1 –brightness 0.7 to reset it to something non-blinding, multiple times per hour. I fixed this by disabling night light and stopping the GNOME Setting Daemon’s color plugin from starting at login.

So what’s good about it?

  • The fingerprint scanner is actually pretty good. It’s not quite as reliable as the MacBook’s, but it’s 80% of the way there. It’s nice to unlock the machine and use sudo with a fingerprint.
  • In full screen mode, you can put another app window in front of the full screen app. This is convenient, and unlike macOS. On the Mac, you’re forced into the full screen app and have to switch completely out of it to get to another app.
  • Gnome’s Activity view (Alt-Space), a hybrid of the Mac’s Spotlight and Expose, is very nice. It’s fast and accurate.
  • The ThinkPad itself is fast and battery life excellent. The plastic body isn’t as solid feeling as an aluminum MacBook, but it’s better than your average creaky PC laptop.
  • WiFi works without a problem.

The janky touchpad and choppy scrolling are the hardest to deal with. If I figure out how to fix these, I’ll update this post.

The Linux Boot Process, in Short

I need to be able to explain the Linux boot process at work, so I’m going to outline it here.  After the BIOS checks your hardware and lists bootable devices in the system, here’s what’s loaded:

  1. Boot Loader: Presents you with a list of operating systems or kernel configurations to load.  (Example: Master Boot Record + GRUB)
  2. Kernel: The selected kernel, if compressed, decompresses itself.  start_kernel() is called, which sets up interrupts, memory management, and device drivers.  Then the idle process and scheduler are started.
  3. Init: Establishes and operates the user environment.  A series of scripts or config files are executed by systemd or upstart.  User space services are started.  For example, networking, a web server, and database services are started in this phase.

Linux Boot Process (Image Credit: developer.ibm.com)

That’s the core of it.  A few notes:

  • You may not actually need a boot loader if you have a UEFI system where the Linux kernel payload can be executed directly.
  • After init is complete, if you prefer to run in graphical mode, a display and login manager are started, and the session manager starts a session after you login.
  • On shutdown, init is called to terminate user space services.  It then makes a system call to the kernel to shut the system down.

If you want to learn more about how Linux boots, I recommend Yogesh Babar’s book Hands-on Booting, which goes into the process in depth, along with troubleshooting  steps for when it fails to boot.  You can also check out the Wikipedia entries linked above.