nix-community / impermanence

Modules to help you handle persistent state on systems with ephemeral root storage [maintainer=@talyz]
MIT License
1.16k stars 86 forks source link

chroot: failed to run command 'systemd-tmpfiles': No such file or directory #79

Closed shadowrylander closed 2 years ago

shadowrylander commented 2 years ago

Hello!

When installing with the module I get chroot: failed to run command 'systemd-tmpfiles': No such file or directory and chroot: failed to run command '/run/current-system/bin/switch-to-configuration': No such file or directory. In relation to this issue, this is when I use a smaller number of files and directories.

Thank you kindly for the help!

shadowrylander commented 2 years ago

Actually, this happens right after the statement A file already exists at 'path', which means if a file exists at the path from before, and is not a link, the build fails.

shadowrylander commented 2 years ago

The issue can be resolved by simply moving the targetFile to the mountPoint, and then linking:

mv ${mountPoint} ${targetFile}
mount -o bind ${targetFile} ${mountPoint}

I feel that, since you're already checking for a link and a mount, we can assume that the anything else would be a file or a directory, and simply treat the mountPoint as the targetFile, move it to the persistent directory, and then bind-mount them together. However, I still feel as though I'm missing something...

talyz commented 2 years ago

Hi!

The error when activating the new configuration should be resolved by #84, I hope.

We never move any files from ephemeral storage to persistent storage, since that could be potentially dangerous on a running system - we don't know if the files are in use or about to be.

shadowrylander commented 2 years ago

... Oops... Forgot about that situation... 😅 I'll retry the installation and report back! Thanks for all the help!

shadowrylander commented 2 years ago

Well, I can close this one, too! Sorry; forgot to do so, and thanks again for all the help!

talyz commented 2 years ago

No problem! :)