NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.87k stars 13.93k forks source link

Documentation for lustrating does not actually work as it is #49520

Open michas2 opened 5 years ago

michas2 commented 5 years ago

Issue description

After I was not able to install NixOS directly (#49511), I tried to install ubuntu and lustrate to NixOS from there following the Documentation.

The Documentation gives a good idea on the process but does not really work as given.

I needed to use the following commands:

# this part is pretty direct from the documentation:

curl https://nixos.org/nix/install | sh
. $HOME/.nix-profile/etc/profile.d/nix.sh
nix-channel --add https://nixos.org/channels/nixos-18.09 nixpkgs
nix-channel --update
nix-env -iE "_: with import <nixpkgs/nixos> { configuration = {}; }; with config.system.build; [ nixos-generate-config nixos-install nixos-enter manual.manpages ]"
sudo `which nixos-generate-config` --root /
sudo sed -i '16i\ \ users.users.root.initialHashedPassword = "";' /etc/nixos/configuration.nix
nix-env -p /nix/var/nix/profiles/system -f '<nixpkgs/nixos>' -I nixos-config=/etc/nixos/configuration.nix -iA system
sudo chown -R 0.0 /nix
sudo touch /etc/NIXOS /etc/NIXOS_LUSTRATE
echo etc/nixos | sudo tee -a /etc/NIXOS_LUSTRATE

# This part is pretty much missing

sudo mv -v /boot /boot.bak
sudo mkdir /boot/
sudo umount /boot.bak/efi
sudo mount /dev/nvme0n1p1 /boot
sudo mv /boot/EFI /boot.bak/efi/
sudo NIXOS_INSTALL_BOOTLOADER=1 /nix/var/nix/profiles/system/bin/switch-to-configuration boot

The steps in the documentation configure systemd-boot, but do not install it. Also moving /boot also moves the mount point, which is probably not intended. Both issues are fixed in the commands above.

Unfortunately this still seems not to work properly as the boot scripts currently will not find the existing init. (See #49519)

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
jacg commented 4 years ago

The top comment points out crucial information which is missing from the documentation about NixOS Lustrate. As it stands, anyone following the documentation seems almost guaranteed to end up with a non-bootable system in a particularly awkward state: grub rescue is not a pleasant place to be!

The top comment suggests a sequence of steps which are needed to complement what is already present in the documentation. These steps allowed me to complete the lustration process pretty easily; without them, I may well have given up before finding a solution.

The original comment refers to an issue which, apparently, prevented the proposed steps from working correctly. That issue has now been closed, and my success with following the steps suggest that that particular problem has been resolved.

I feel that the missing steps should be added to the manual without delay.

I would be willing to edit the documentation to add these steps myself, but as I have only very superficial knowledge in this area

So perhaps it would be better if someone more qualified did it.

obadz commented 3 years ago

Thank you for improving the documentation. I would point out that the issue you're running into is probably UEFI vs legacy booting and I suspect the sequence of commands to get both to work will probably be different.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

luka-n commented 2 years ago

This seems to still be an issue

obadz commented 1 year ago

If someone wants to refresh #91164 then we can close this for good. I think it needs to separate both cases:

AkechiShiro commented 3 months ago

Bump, is there any way forward for refreshing the instructions ? I think it is safe to refresh them for UEFI first and maybe investigate on a VM for the BIOS instructions.

I've seen #91164 however it isn't precised if it is for the UEFI or BIOS case.

Latest instructions are still using nix-env which I believe is no longer recommended.

tejing1 commented 2 days ago

Took a crack at improving this in #349049 after helping a user having trouble with it.