Skip to content

util-linux: split mount, login and swap utils into their own outputs#236463

Merged
ElvishJerricco merged 1 commit intoNixOS:stagingfrom
DeterminateSystems:util-linux-split
Jun 28, 2023
Merged

util-linux: split mount, login and swap utils into their own outputs#236463
ElvishJerricco merged 1 commit intoNixOS:stagingfrom
DeterminateSystems:util-linux-split

Conversation

@lheckemann
Copy link
Copy Markdown
Member

@lheckemann lheckemann commented Jun 7, 2023

Description of changes

This reduces closure size of systemd by a couple of MB by omitting some unnecessary pieces of util-linux from its dependencies.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested nixos/tests/login.nix
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@lheckemann lheckemann requested a review from a team as a code owner June 7, 2023 14:41
@github-actions github-actions bot added the 6.topic: systemd Software suite that provides an array of system components for Linux operating systems. label Jun 7, 2023
Copy link
Copy Markdown
Contributor

@ElvishJerricco ElvishJerricco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

I guess systemd stage 1 does have this bit:

mount = "${cfg.package.util-linux}/bin/mount";
umount = "${cfg.package.util-linux}/bin/umount";
fsck = "${cfg.package.util-linux}/bin/fsck";

But that shouldn't need updating, since that only copies the specific programs in already, and it does chase symlinks.

@ofborg ofborg bot requested review from Mic92, flokli and kloenk June 7, 2023 17:12
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Jun 7, 2023
postInstall = ''
moveToOutput bin/mount "$mount"
moveToOutput bin/umount "$mount"
ln -svf "$mount/bin/"* $bin/bin/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally fearful of bash globs. I know this works as expected, but nonetheless is this fear too paranoid in this case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so; the one weird case here would be if nothing exists in $mount/bin (so it expands to nothing rather than the literal glob due to stdenv's nullglob) and we end up with no argument, and ln creates a symlink to $bin/bin in the working directory.

@ElvishJerricco ElvishJerricco merged commit 9e3415e into NixOS:staging Jun 28, 2023
@lheckemann lheckemann deleted the util-linux-split branch June 28, 2023 23:50
@vcunat
Copy link
Copy Markdown
Member

vcunat commented Jul 10, 2023

We have some initrd issues, surely because of this:
https://hydra.nixos.org/build/227078771/nixlog/3/tail

@vcunat
Copy link
Copy Markdown
Member

vcunat commented Jul 10, 2023

Also installer tests complain:
https://hydra.nixos.org/build/227078816/nixlog/1/tail

@vcunat vcunat mentioned this pull request Jul 10, 2023
1 task
@lheckemann
Copy link
Copy Markdown
Member Author

Thanks for tracking them down to this! I'll have a look.

lheckemann added a commit that referenced this pull request Jul 19, 2023
The split of util-linux into further outputs (#236463) resulted in
${util-linux.bin}/bin/mount becoming a symlink. This broke zfs in some
cases.
@Artturin
Copy link
Copy Markdown
Member

Artturin commented Jul 20, 2023

#244000

#244371

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: systemd Software suite that provides an array of system components for Linux operating systems. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants