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

installer/tools: Avoid duplicate LUKS device entries in hw config #54339

Merged
merged 1 commit into from Jan 22, 2019

Conversation

avdv
Copy link
Member

@avdv avdv commented Jan 19, 2019

There are situations where several filesystems reside on a single encrypted LUKS
device (e.g. when using BTRFS subvolumes).

Simply generating a boot.init.luks.devices.NAME.device entry for each mounted
filesystem will result in an error later when evaluating the nix expression in
hardware-configuration.nix.

Motivation for this change

I am using BTRFS subvolumes on an encrypted LUKS device. The nixos-generate-config script simply generates one entry per filesystem mount point which causes the nixos-rebuild to fail with a duplicate key for the nix expression.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

There are situations where several filesystems reside on a single encrypted LUKS
device (e.g. when using BTRFS subvolumes).

Simply generating a `boot.init.luks.devices.NAME.device` entry for each mounted
filesystem will result in an error later when evaluating the nix expression in
`hardware-configuration.nix`.
@ghost
Copy link

ghost commented Jan 22, 2019

I'm not very familiar, correct me if I'm wrong.

A LUKS device can have multiple FS inside. Are those different mount points? Currently I see you're checking if there's a duplicate entry, for the whole LUKS device. If there are multiple mount points inside the LUKS device, they should be iterated over and added to the config. Is that happening?

@avdv
Copy link
Member Author

avdv commented Jan 22, 2019

A LUKS device can have multiple FS inside.

Yes.

Are those different mount points?

Yes.

Currently I see you're checking if there's a duplicate entry, for the whole LUKS device. If there are multiple mount points inside the LUKS device, they should be iterated over and added to the config. Is that happening?

Yes, that is happening. We just need to avoid multiple entries for a LUKS device (device mapper name).

@ghost
Copy link

ghost commented Jan 22, 2019

LGTM

@infinisil infinisil merged commit 115cf2e into NixOS:master Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants