Basti’s Buggy Blog

Poking at software.

My Experience with systemd-homed

I read about systemd-homed and I found the concept behind it interesting. There was no personal need for it, but I wanted to try it out.

The points that peaked my interest:

  • Portable home directory? Meh
  • Encrypted home directory locked during sleep? Sounds good!

Setup

  • systemctl enable systemd-homed.service
  • systemctl start systemd-homed.service
  • sudo homectl create <username>
  • sudo homectl update <username> --shell=/usr/bin/zsh
  • homectl update username --member-of=sudo

So far so good. PAM authentication isn’t working by default tho. We have to change that.

After changing my PAM configs and rebooting for at least 4 times, I was able to login via GDM.

Issue #1: Adding User to Group

How do I add a user to a group without manually copying the user’s current groups? The command homectl update --member-of=<...> overrides all current groups.

So if the user currently is in the sudo group and I want to add it to the docker group, I need to write:

sudo homectl update <user> --member-of="sudo,docker"

Either I am too dumb to read a manual or a “append” command does not exist.

With some scripting and after installing jq to parse homed’s output — which is in json — I came up with a terrifying oneliner to append a user to a group:

sudo homectl update <user> $(homectl inspect <user> --json=short | jq '.memberOf | join(",")'),<group to add>

Issue #2: Lockscreen not Working

Coming back to my desktop after locking it, I am trying to login. It fails. I must have messed up the pam config again.

*Kill xsecurelock via another terminal*

After some testing I found out that only xsecurelock is not able to login. GDM and virtual terminals work.

Seems like I hit on another bug.

Issue #3: Where Did My Storage Space Go?

  • *Trying to copy huge libvirt image to /var/lib/…*
  • cp: error writing '/var/lib/…': No space left on device
  • df -h
Filesystem               Size  Used Avail Use% Mounted on
...
/dev/sdb5                118G  118G     0 100% /
/dev/mapper/home-<user>   90G   20G   70G  22% /home/<user>

🤦‍♂️🤦‍♂️

Ok, maybe quickly resizing it?

# homectl update <user> --disk-size=50G`
Operation on home sh failed: File systems of this type can only be shrinked offline

Issue…, No I’m done