nixos/generations-dir: Improve symlinking in /boot#198728
nixos/generations-dir: Improve symlinking in /boot#198728Majiir wants to merge 3 commits intoNixOS:masterfrom
/boot#198728Conversation
679e0de to
7a97352
Compare
nixos/modules/system/boot/loader/generations-dir/generations-dir-builder.sh
Outdated
Show resolved
Hide resolved
7a97352 to
0015892
Compare
ncfavier
left a comment
There was a problem hiding this comment.
Code LGTM, not sure how to test so I'll wait for others.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/1398 |
nixos/modules/system/boot/loader/generations-dir/generations-dir-builder.sh
Outdated
Show resolved
Hide resolved
nixos/modules/system/boot/loader/generations-dir/generations-dir.nix
Outdated
Show resolved
Hide resolved
444ed6a to
69cdd9f
Compare
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/1635 |
69cdd9f to
a25c3f6
Compare
|
Rebased and updated the |
|
Please wait some days so that I have time to review this properly. |
|
@RaitoBezarius Have you had a chance to look this over? Anything that can be improved? Thanks. |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
philiptaron
left a comment
There was a problem hiding this comment.
This PR makes sense to me, given the use case that @Majiir lays out in the description, and certainly seems no worse than the current implementation.
nixos/modules/system/boot/loader/generations-dir/generations-dir-builder.sh
Outdated
Show resolved
Hide resolved
|
It slipped my mind… I will review it ASAP. |
There was a problem hiding this comment.
| default = versionOlder config.system.stateVersion "23.11"; | |
| default = versionOlder config.system.stateVersion "24.05"; |
no?
There was a problem hiding this comment.
Fixed the stateVersion
RaitoBezarius
left a comment
There was a problem hiding this comment.
LGTM, sorry for the delay, we can proceed once you fix the state version.
a25c3f6 to
d8a7435
Compare
d8a7435 to
a8ae946
Compare
|
|
I'm planning on merging this after retesting it later today. Any objections, please speak now. |
There was a problem hiding this comment.
This should be 25.05. Looks good otherwise
K900
left a comment
There was a problem hiding this comment.
This is not how stateVersion is meant to be used.
I get that "state" was meant for handling things like Postgres upgrades, but there are plenty of Since this change could break boot, we shouldn't quietly change behavior on users. But the existing behavior is not a good default. If not |
Wow, my timer did not go off. |
🥲 If you look upthread, you'll find you weren't even the first! This is my personal best example of PRs that get nitpicked and delayed. I would remove the |
|
Keep the old behavior, add a warning that it's deprecated, drop it entirely next release? |
a8ae946 to
dc60840
Compare
|
There was a problem hiding this comment.
This feels very dangerous. Maybe at least log a warning?
There was a problem hiding this comment.
The delete is required. If $defaultdir is not deleted, then the following ln would error out with ln: default: cannot overwrite directory.
Further up, there is an unconditional rm -Rf /boot/system*. The updates are already destructive and not atomic. Improvements in those areas would be nice, but is it a blocker?
Is the concern that users are storing files in /boot/default other than those created by generationsDir? If so, then what kind of warning would help? At this point in the script, we either finish setting up /boot or the user is left with an unbootable system.
There was a problem hiding this comment.
It's always hard to tell what is in scope of the bootloader script. IMO if there's an existing directory that contains anything but the files we're about to put there, we should just abort.
When /boot is on a separate partition, absolute symlinks can break boot loaders that assume the partition is mounted at /. For example, U-Boot's ext2load command follows the relative symlinks correctly but fails to follow the absolute symlink.
This makes it easier to quickly change the default boot profile. The contents of the 'default' directory are already symlinks, so anything that can follow symlinks currently should continue to do so.
Adds an option to suppress the second full copy of the default profile files (kernel, initrd, init) made in /boot.
dc60840 to
0fd9962
Compare
Looking to @K900 to either say yay or nay or recuse.
Description of changes
boot.loader.generationsDiris a simple "boot loader" that creates a directory structure in/bootwith symlinks to kernel, initrd, init, and system. This is ideal for some boot loaders (e.g. old or anemic builds of U-Boot) that don't otherwise support a menu of system profiles at boot./boothas its own partition.defaultsymlink.kernel,initrdandinitfiles.false.I tested this on an
armv7l-linuxsystem which has a U-Boot build from 2011 that lacks support forextlinux.conf. In particular, I tested that:defaultprofile./bootwhen upgrading to this branch.Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes