impermanence icon indicating copy to clipboard operation
impermanence copied to clipboard

Cannot make home mount if a seperate mount exists for the persistent path

Open zackattackz opened this issue 11 months ago • 1 comments

There is an issue I believe with the code for the home fuse mount service, specifically here:

https://github.com/nix-community/impermanence/blob/0d09341beeaa2367bac5d718df1404bf2ce45e6f/home-manager.nix#L253

The issue is that if a user has an already existing mount that contains mountPoint as a substring, this service will fail with There is already an active mount at or below ${mountPoint}!

I believe this check was intended to ensure that the existing mount won't be overridden, but it fails in the case I describe above. I'm not sure what a fix would look like, but I think it might be to add a space to the beginning of the grep like so:

if ! mount | grep -F ' '${mountPoint}' ' && ! mount | grep -F ${mountPoint}/; then

The specific mount that the grep is finding in my case is a bind mount I've configured from /persistent/home/z/.local/share/lutris to/mnt/data/home/z/LutrisShare:

/dev/sda1 on /persistent/home/z/.local/share/lutris type ext4 (rw,relatime,x-systemd.requires-mounts-for=/persistent,x-systemd.requires-mounts-for=/mnt/data)

The nix config for the bind is:

  fileSystems."/persistent/home/z/.local/share/lutris" = {
    depends = [
      "/persistent"
      "/mnt/data"
    ];
    device = "/mnt/data/home/z/LutrisShare";
    fsType = "none";
    options = [ "bind" ];
  };

The reason I even need this bind in the first place is because /mnt/data is an entirely separate disk than what my /persistent is normally on. I wanted the data for lutris to be stored on this separate disk rather than the disk that /persistent is on, and this is the only way I could think to do that.

zackattackz avatar Nov 08 '24 20:11 zackattackz