-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
stage2 - replace tmp.mount with tmpfs handling on bootup/activation #14778
Conversation
629beaa
to
631c36d
Compare
I wonder why |
@lethalman We do not want /tmp to be subject to changes to configuration unless it is during stage-2. There is an open issue for this, #10670, but it doesn't explain why. Changing how /tmp is mounted without a reboot will hose programs which have written to /tmp. You can do it yourself, via tmpOnTmpfs = false and a custom fileSystem entry, but doing it by default would violate the principal of least surprise. Especially since current documentation on /tmp suggests changes to how /tmp is mounted only happens at boot. |
It seems I was the one who originally created the tmpOnTmpfs option. I just wanted a convient boolean rather than having to consult the mount man page for tmpfs options and define a mount outside of hardware-configuration.nix. I am totally ok with taking this out of systemd's hands. |
@@ -158,8 +158,11 @@ in | |||
${pkgs.utillinux}/bin/mount -o "remount,size=${config.boot.devSize}" none /dev | |||
${pkgs.utillinux}/bin/mount -o "remount,size=${config.boot.devShmSize}" none /dev/shm | |||
${pkgs.utillinux}/bin/mount -o "remount,size=${config.boot.runSize}" none /run | |||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A + optionalString config.boot.tmpOnTmpfs "blah blah";
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken care of, thanks.
631c36d
to
5bad72d
Compare
@@ -158,8 +158,11 @@ in | |||
${pkgs.utillinux}/bin/mount -o "remount,size=${config.boot.devSize}" none /dev | |||
${pkgs.utillinux}/bin/mount -o "remount,size=${config.boot.devShmSize}" none /dev/shm | |||
${pkgs.utillinux}/bin/mount -o "remount,size=${config.boot.runSize}" none /run | |||
'' + optionalString config.boot.tmpOnTmpfs '' | |||
if [ mountpoint -q /tmp ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what happens if a user says boot.tmpOnTmpfs = true
but /tmp
is not a valid mount point? The current solution is to fail silently, but that doesn't seem ideal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boot.tmpOnTmpfs is only going to apply /on boot/. The activation-script shouldn't attempt to remount if you set boot.tmpOnTmpfs to true without rebooting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said... the stage-2-init.sh script doesn't seem to do much error handling of mount points fail during boot?
I agree with @lethalman that it would be nicer to handle this via |
Still on the fence as fileSystem changes are applied during switch-to-configuration (correct me if I'm wrong, please) where /tmp is a place we don't want that to happen.
Good point, though i'm wary about messing with basic.target (since it's core systemd and not a nixos provided unit). basic.target has a whole special case for tmp.mount |
FYI, this is what happens if using systemd to mount /tmp as tmpfs in this way |
Any new thoughts on this? Possible candidate for inclusion in 16.09? |
I've added this to the 16.09 milestone in the hopes that the issue gets resolved one way or another. |
Applying the configuration directly is what Removing tmp.mount from basic.target isn't an elegant solution, but it's still more elegant than duplicating the options specifically for tmp, and without removing tmp.mount from basic.target I would still prefer the fileSystems approach, which will work just fine as long as |
Note that this PR needs to be addressed in next days if it wants to reach 16.09 |
@sheenobu why was it closed? |
@domenkozar it was an accident due to branch cleanup. |
What is the status of this pull request? |
Closing due to lack of activity, feel free to reopen this if needed. |
Things done
nix-build --option build-use-chroot true
or nix.useChroot on NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)Fixes #14777 and #10670
Haven't tested yet. would love some help on how to do that =)Built an ova. testing now~