Skip to content

Instantly share code, notes, and snippets.

@sgf-dma
Created September 13, 2024 22:52
Show Gist options
  • Save sgf-dma/8b8453f6cbde198a184463cca18fd463 to your computer and use it in GitHub Desktop.
Save sgf-dma/8b8453f6cbde198a184463cca18fd463 to your computer and use it in GitHub Desktop.
Systemd unit for steamdeck for mounting directory from sdcard on ~/.var . So, all flatpacks data will be on sdcard.
[Unit]
Description=Offload /home/deck/.var/app/
[email protected]
[email protected]
[Mount]
What=/run/media/mmcblk0p1/deck/.var/
Where=/home/deck/.var/
Type=none
Options=bind,nofail
[Install]
WantedBy=steamos-offload.target
@sgf-dma
Copy link
Author

sgf-dma commented Sep 13, 2024

Udev rule '/usr/lib/udev/rules.d/99-steamos-automount.rules' starts (or stops) '[email protected]' service. The service is oneshot, executing '/usr/lib/hwsupport/steamos-automount.sh'. This is essentially the same as was before (just names had been changed).

But further are the differences: now script does not mount sdcard by itself, it asks udsisks to do this instead. And udisks creates mountpoint. Then script creates old mountpoint /run/media/mmcblk0p1 as symlink.

Particularly, this means, that i can't create 'home-deck-.var.mount' systemd mount for ~/.var/app with dependency on 'run-media-mmcblk0p1.mount' (or corresponding mount unit created by udisks), because there's no such unit (it's created automatically after mount call). Well, the actual error will be "Bound to unit run-media-mmcblk0p1.mount, but unit isn't active.".

Thus, i should add BindsTo= and After= dependencies on '[email protected]' instead. But all mount units are by default ordered before 'local-fs.target', though '[email protected]' is ordered after. I.e. there's a loop. To avoid it i should add option 'nofail' ('Options=bind,nofail') to my mount unit, so it will not have implicit ordering dependency before 'local-fs.target'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment