Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage 2 System Failure with Syncthing and update-users-groups.pl with user home symlink #246235

Open
Sepero opened this issue Jul 30, 2023 · 5 comments
Labels
0.kind: bug Something is broken

Comments

@Sepero
Copy link

Sepero commented Jul 30, 2023

I recently experienced a critical failure of my system to properly boot due to 1 improper setting in Syncthing. Boot to no network access, and unable to connect with ssh. Mass OOM errors and unusable system. This was due to the setting service.syncthing.dataDir being a dangling symlink AND the handling of that link by the Stage 2 Perl script (update-users-groups.pl) responsible for creating home directories. I guess my hope is to see the Perl script be more resilient. ❤️

[WARNING: Failure on home directory: mkdir /mnt/syncs: file exists](stage-2-init: mkdir /mnt/syncs: File exists at /nix/store/gx91fdp4a099jpfwdkbdw2imvl3lalsk-update-users-groups.pl line 229.
stage-2-init: Activation script snippet 'users' failed (17))

After the log entry above, an entire cascade of failures begins which prevents the system from properly booting. Link to full journald log at bottom.

Describe the bug

Setting a user home directory to a dangling symlink causes massive system failure. The setting services.syncthing.dataDir is used to set the home directory of user syncthing. On my system, the dataDir (my syncthing config & sync dirs) is a symlink to an external drive which may not be connected at boot time.

Link to where service.syncthing sets home directory.

Steps To Reproduce

services.syncthing = {
enable = true;
dataDir = "/path/to/dangling-symlink";
};

  • Additional Context
    My rootfs / is using an overlayfs with tmpfs, so this may compound the problems I'm having with OOM errors. I have not tested this issue on a traditional disk-only install.

Expected behavior

Even if a user home dir is a dangling symlink, I would like to see stage 2 complete without bringing the system to an inoperable state.

Journald Log

Full Journald Log
https://gist.github.com/Sepero/c793f8cfa4b4924c453486fb65c82407

Work Around for Syncthing

users.users.syncthing.home = lib.mkForce "/home/syncthing";
@Sepero
Copy link
Author

Sepero commented Aug 19, 2023

Here we find the potential for system failure again in rtorrent.nix attempting to default use datadir as the homedir

If the datadir (aka homedir) is on a disconnected external drive, or drive that has yet to be decrypted, then the entire system fails to properly load.

@Aleksanaa
Copy link
Member

may be relevant: #267982

@tomodachi94 tomodachi94 added the 0.kind: bug Something is broken label May 13, 2024
@tomodachi94
Copy link
Member

Is this still an issue with #270727 merged?

@Sepero
Copy link
Author

Sepero commented May 19, 2024

Is this available in unstable yet? I'll give it a test in VM when I get the free time.

@tomodachi94
Copy link
Member

Is this available in unstable yet?

Yes, I believe so.

Thank you for taking the time to respond to this old issue! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

3 participants