How to rebuild the configuration of a NixOS installation from Live CD?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I installed NixOS 18.03 from Ubuntu on another partition following the NixOS manual's "2.4. Installing from another Linux distribution" section. Everything went fine, but I did a couple idiotic things [?], namely:
Forgot to add the extra GRUB boot loader entry for the Ubuntu installation before
nixos-install
. Added it as an afterthought after install, and did a reboot (of course, no Ubuntu entry)Did not enable any networking in
configuration.nix
, and ended up with no network configuration commands after reboot to connect to wifi. The catch 22 is thatnixos-rebuild switch
requires a network connection, so I couldn't finalize any changes.
So my thinking was that I can boot from a NixOS Live CD (17.03),connect to our wifi and somehow rebuild the config of the installation.
It is more than possible that I am missing something essential, have incorrect assumptions above etc; fairly new at nix and NixOS.
EDIT: I forgot to include how my partitions are set up and what I tried before successfully installing NixOS.
Partitions (mountpoints from Ubuntu):
sda
âÂÂâÂÂsda1 ntfs Recovery # some Win7 artifact
âÂÂâÂÂsda2 vfat /boot/efi
âÂÂâÂÂsda3 vfat NIXBOOT # boot partition (esp, boot)
âÂÂâÂÂsda4 ext4 onyx # NixOS data
âÂÂâÂÂsda5 swap # Ubuntu swap
â âÂÂâÂÂcryptswap1 swap [SWAP]
âÂÂâÂÂsda6 ext4 # (Arch install)
âÂÂâÂÂsda7 ext4 / # Ubuntu install
âÂÂâÂÂsda8 swap nixswap
âÂÂâÂÂsda9 ext4 home
I didn't want to mess up the Ubuntu boot partition, so I created another one (/dev/sda3
). My plan was to later include a menu entry in Ubuntu's GRUB for NixOS, but for now, install, reboot and test booting NixOS from GRUB console (set root=...
, linux ...
, initrd ...
, boot
)
sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt --no-bootloader
After reboot, I couldn't see anything on the NixOS boot partition. Went back to Ubunut, installed without --no-bootloader
, remembered to add an entry for Ubuntu and reboot. (It was only after this that I realized that systemd-boot
and GRUB are two completely different things...)
UPDATE: I was able to get back to Ubuntu by selecting the Ubuntu boot partition as an alternative boot device in BIOS, and the usual GRUB menu came up. I may just redo the install with the right config.
nixos
add a comment |Â
up vote
1
down vote
favorite
I installed NixOS 18.03 from Ubuntu on another partition following the NixOS manual's "2.4. Installing from another Linux distribution" section. Everything went fine, but I did a couple idiotic things [?], namely:
Forgot to add the extra GRUB boot loader entry for the Ubuntu installation before
nixos-install
. Added it as an afterthought after install, and did a reboot (of course, no Ubuntu entry)Did not enable any networking in
configuration.nix
, and ended up with no network configuration commands after reboot to connect to wifi. The catch 22 is thatnixos-rebuild switch
requires a network connection, so I couldn't finalize any changes.
So my thinking was that I can boot from a NixOS Live CD (17.03),connect to our wifi and somehow rebuild the config of the installation.
It is more than possible that I am missing something essential, have incorrect assumptions above etc; fairly new at nix and NixOS.
EDIT: I forgot to include how my partitions are set up and what I tried before successfully installing NixOS.
Partitions (mountpoints from Ubuntu):
sda
âÂÂâÂÂsda1 ntfs Recovery # some Win7 artifact
âÂÂâÂÂsda2 vfat /boot/efi
âÂÂâÂÂsda3 vfat NIXBOOT # boot partition (esp, boot)
âÂÂâÂÂsda4 ext4 onyx # NixOS data
âÂÂâÂÂsda5 swap # Ubuntu swap
â âÂÂâÂÂcryptswap1 swap [SWAP]
âÂÂâÂÂsda6 ext4 # (Arch install)
âÂÂâÂÂsda7 ext4 / # Ubuntu install
âÂÂâÂÂsda8 swap nixswap
âÂÂâÂÂsda9 ext4 home
I didn't want to mess up the Ubuntu boot partition, so I created another one (/dev/sda3
). My plan was to later include a menu entry in Ubuntu's GRUB for NixOS, but for now, install, reboot and test booting NixOS from GRUB console (set root=...
, linux ...
, initrd ...
, boot
)
sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt --no-bootloader
After reboot, I couldn't see anything on the NixOS boot partition. Went back to Ubunut, installed without --no-bootloader
, remembered to add an entry for Ubuntu and reboot. (It was only after this that I realized that systemd-boot
and GRUB are two completely different things...)
UPDATE: I was able to get back to Ubuntu by selecting the Ubuntu boot partition as an alternative boot device in BIOS, and the usual GRUB menu came up. I may just redo the install with the right config.
nixos
1
Usechroot
to edit the configuration and rebuild. wiki.archlinux.org/index.php/Change_root#Using_chroot
â Mioriin
May 28 at 15:32
In the end it was easier to just re-install NixOS, and the outdated NixOSchroot
articles seemed intimidating, but I just realized thatnixos-enter
does just that. (It is also invoked bynixos-install
when installing the boot loader.)
â toraritte
May 29 at 19:25
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I installed NixOS 18.03 from Ubuntu on another partition following the NixOS manual's "2.4. Installing from another Linux distribution" section. Everything went fine, but I did a couple idiotic things [?], namely:
Forgot to add the extra GRUB boot loader entry for the Ubuntu installation before
nixos-install
. Added it as an afterthought after install, and did a reboot (of course, no Ubuntu entry)Did not enable any networking in
configuration.nix
, and ended up with no network configuration commands after reboot to connect to wifi. The catch 22 is thatnixos-rebuild switch
requires a network connection, so I couldn't finalize any changes.
So my thinking was that I can boot from a NixOS Live CD (17.03),connect to our wifi and somehow rebuild the config of the installation.
It is more than possible that I am missing something essential, have incorrect assumptions above etc; fairly new at nix and NixOS.
EDIT: I forgot to include how my partitions are set up and what I tried before successfully installing NixOS.
Partitions (mountpoints from Ubuntu):
sda
âÂÂâÂÂsda1 ntfs Recovery # some Win7 artifact
âÂÂâÂÂsda2 vfat /boot/efi
âÂÂâÂÂsda3 vfat NIXBOOT # boot partition (esp, boot)
âÂÂâÂÂsda4 ext4 onyx # NixOS data
âÂÂâÂÂsda5 swap # Ubuntu swap
â âÂÂâÂÂcryptswap1 swap [SWAP]
âÂÂâÂÂsda6 ext4 # (Arch install)
âÂÂâÂÂsda7 ext4 / # Ubuntu install
âÂÂâÂÂsda8 swap nixswap
âÂÂâÂÂsda9 ext4 home
I didn't want to mess up the Ubuntu boot partition, so I created another one (/dev/sda3
). My plan was to later include a menu entry in Ubuntu's GRUB for NixOS, but for now, install, reboot and test booting NixOS from GRUB console (set root=...
, linux ...
, initrd ...
, boot
)
sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt --no-bootloader
After reboot, I couldn't see anything on the NixOS boot partition. Went back to Ubunut, installed without --no-bootloader
, remembered to add an entry for Ubuntu and reboot. (It was only after this that I realized that systemd-boot
and GRUB are two completely different things...)
UPDATE: I was able to get back to Ubuntu by selecting the Ubuntu boot partition as an alternative boot device in BIOS, and the usual GRUB menu came up. I may just redo the install with the right config.
nixos
I installed NixOS 18.03 from Ubuntu on another partition following the NixOS manual's "2.4. Installing from another Linux distribution" section. Everything went fine, but I did a couple idiotic things [?], namely:
Forgot to add the extra GRUB boot loader entry for the Ubuntu installation before
nixos-install
. Added it as an afterthought after install, and did a reboot (of course, no Ubuntu entry)Did not enable any networking in
configuration.nix
, and ended up with no network configuration commands after reboot to connect to wifi. The catch 22 is thatnixos-rebuild switch
requires a network connection, so I couldn't finalize any changes.
So my thinking was that I can boot from a NixOS Live CD (17.03),connect to our wifi and somehow rebuild the config of the installation.
It is more than possible that I am missing something essential, have incorrect assumptions above etc; fairly new at nix and NixOS.
EDIT: I forgot to include how my partitions are set up and what I tried before successfully installing NixOS.
Partitions (mountpoints from Ubuntu):
sda
âÂÂâÂÂsda1 ntfs Recovery # some Win7 artifact
âÂÂâÂÂsda2 vfat /boot/efi
âÂÂâÂÂsda3 vfat NIXBOOT # boot partition (esp, boot)
âÂÂâÂÂsda4 ext4 onyx # NixOS data
âÂÂâÂÂsda5 swap # Ubuntu swap
â âÂÂâÂÂcryptswap1 swap [SWAP]
âÂÂâÂÂsda6 ext4 # (Arch install)
âÂÂâÂÂsda7 ext4 / # Ubuntu install
âÂÂâÂÂsda8 swap nixswap
âÂÂâÂÂsda9 ext4 home
I didn't want to mess up the Ubuntu boot partition, so I created another one (/dev/sda3
). My plan was to later include a menu entry in Ubuntu's GRUB for NixOS, but for now, install, reboot and test booting NixOS from GRUB console (set root=...
, linux ...
, initrd ...
, boot
)
sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt --no-bootloader
After reboot, I couldn't see anything on the NixOS boot partition. Went back to Ubunut, installed without --no-bootloader
, remembered to add an entry for Ubuntu and reboot. (It was only after this that I realized that systemd-boot
and GRUB are two completely different things...)
UPDATE: I was able to get back to Ubuntu by selecting the Ubuntu boot partition as an alternative boot device in BIOS, and the usual GRUB menu came up. I may just redo the install with the right config.
nixos
edited May 29 at 4:12
asked May 28 at 15:22
toraritte
1639
1639
1
Usechroot
to edit the configuration and rebuild. wiki.archlinux.org/index.php/Change_root#Using_chroot
â Mioriin
May 28 at 15:32
In the end it was easier to just re-install NixOS, and the outdated NixOSchroot
articles seemed intimidating, but I just realized thatnixos-enter
does just that. (It is also invoked bynixos-install
when installing the boot loader.)
â toraritte
May 29 at 19:25
add a comment |Â
1
Usechroot
to edit the configuration and rebuild. wiki.archlinux.org/index.php/Change_root#Using_chroot
â Mioriin
May 28 at 15:32
In the end it was easier to just re-install NixOS, and the outdated NixOSchroot
articles seemed intimidating, but I just realized thatnixos-enter
does just that. (It is also invoked bynixos-install
when installing the boot loader.)
â toraritte
May 29 at 19:25
1
1
Use
chroot
to edit the configuration and rebuild. wiki.archlinux.org/index.php/Change_root#Using_chrootâ Mioriin
May 28 at 15:32
Use
chroot
to edit the configuration and rebuild. wiki.archlinux.org/index.php/Change_root#Using_chrootâ Mioriin
May 28 at 15:32
In the end it was easier to just re-install NixOS, and the outdated NixOS
chroot
articles seemed intimidating, but I just realized that nixos-enter
does just that. (It is also invoked by nixos-install
when installing the boot loader.)â toraritte
May 29 at 19:25
In the end it was easier to just re-install NixOS, and the outdated NixOS
chroot
articles seemed intimidating, but I just realized that nixos-enter
does just that. (It is also invoked by nixos-install
when installing the boot loader.)â toraritte
May 29 at 19:25
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
The simplest way to go is to install from the LiveCD.
nixos-generate-config
will regenerate the hardware config, but if it finds configuration.nix
already exists it will leave it alone. And nixos-install
is designed such that it can be safely executed as many times as needed.
This means you can follow the main installation guide using the filesystem (and configuration) you already created for NixOS and just continue where you left off.
Some things to be mindful of:
- NixOS will install
systemd-boot
by default on EFI systems. So you'll end up with a new EFI executable along side the ones you already have. nixos-install
will also attempt to setsystemd-boot
as the default boot manager. I believe you can disable this by settingboot.loader.efi.canTouchEfiVariables
to false inconfiguration.nix
- I recommend installing NixOS with a basic config; For example, setup networking, users, and install a text editor but not much else. The reason is that the LiveCD uses a Nix store which is held in RAM. Your system will be first installed to this RAM-backed Nix store and then copied to disk. Once installed and bootable you can safely proceed with the rest of the configuration.
Thanks for the great answer! A quick question (and I can ask this in a separate one if you like): based on your first tip, I could have just mounted to the existing boot partition (i.e.,/dev/sda2
) andnixos-install
would only have added another EFI executable, correct? And ifboot.loader.efi.canTouchEfiVariables
had been set to false, I could've just used Ubuntu's GRUB and have an extra entry set up for NixOS?
â toraritte
May 29 at 2:53
I guess the answer is yes: How to configure dual boot NixOS with Mac OS X on an (U)EFI MacBook? and NixPkgs issue #21534 - Option to add extra entries to systemd-boot
â toraritte
May 29 at 5:41
1
Yep, that's correct. I've dual-booted NixOS with both MacOS and Windows 10 and in both cases I shared the same ESP (EFI partition). Settingboot.loader.efi.canTouchEfiVariables
to false should tells the installer to leave your current boot manager (GRUB2) as the default. Then it's a matter of addingsystemd-boot
to GRUB2 as an item. Another way, especially if you have a lot of systems, is to install rEFInd and let it be the default. rEFInd checks your ESP for EFI executables and lists them, so you don't have to keep adding menu entries.
â Emmanuel Rosa
May 29 at 17:07
add a comment |Â
up vote
0
down vote
Adding this answer for completeness sake: in theory, @Mioriin's suggestion above of chroot
ing would be the correct answer, that could be achieved by the command nixos-enter
.
From Ubuntu, with the NixOS partitions mounted to /mnt
:
$ sudo $(which nixos-enter)
...
[root@nixos:/]# nixos-rebuild switch
In practice, this did not work, because networking wouldn't work (probably because my configuration.nix
was missing the right setup in the first place), and got a bunch of error messages:
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
System has not been booted with systemd as init system (PID 1). Can't operate.
building Nix...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: unable to download 'https://cache.nixos.org/nix-cache-info': Couldn't resolve host name (6); retrying in 293 ms
^Cwarning: download of 'https://cache.nixos.org/nix-cache-info' was interrupted
don't know how to build these paths:
/nix/store/z6avpvg24f6d1br2sr6qlphsq3h4d91v-nix-2.0.2
error: interrupted by the user
warning: don't know how to get latest Nix
In the end, @Emmanuel Rosa's answer is right one, especially because (as he points it out) nixos-install
can be safely executed multiple times.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The simplest way to go is to install from the LiveCD.
nixos-generate-config
will regenerate the hardware config, but if it finds configuration.nix
already exists it will leave it alone. And nixos-install
is designed such that it can be safely executed as many times as needed.
This means you can follow the main installation guide using the filesystem (and configuration) you already created for NixOS and just continue where you left off.
Some things to be mindful of:
- NixOS will install
systemd-boot
by default on EFI systems. So you'll end up with a new EFI executable along side the ones you already have. nixos-install
will also attempt to setsystemd-boot
as the default boot manager. I believe you can disable this by settingboot.loader.efi.canTouchEfiVariables
to false inconfiguration.nix
- I recommend installing NixOS with a basic config; For example, setup networking, users, and install a text editor but not much else. The reason is that the LiveCD uses a Nix store which is held in RAM. Your system will be first installed to this RAM-backed Nix store and then copied to disk. Once installed and bootable you can safely proceed with the rest of the configuration.
Thanks for the great answer! A quick question (and I can ask this in a separate one if you like): based on your first tip, I could have just mounted to the existing boot partition (i.e.,/dev/sda2
) andnixos-install
would only have added another EFI executable, correct? And ifboot.loader.efi.canTouchEfiVariables
had been set to false, I could've just used Ubuntu's GRUB and have an extra entry set up for NixOS?
â toraritte
May 29 at 2:53
I guess the answer is yes: How to configure dual boot NixOS with Mac OS X on an (U)EFI MacBook? and NixPkgs issue #21534 - Option to add extra entries to systemd-boot
â toraritte
May 29 at 5:41
1
Yep, that's correct. I've dual-booted NixOS with both MacOS and Windows 10 and in both cases I shared the same ESP (EFI partition). Settingboot.loader.efi.canTouchEfiVariables
to false should tells the installer to leave your current boot manager (GRUB2) as the default. Then it's a matter of addingsystemd-boot
to GRUB2 as an item. Another way, especially if you have a lot of systems, is to install rEFInd and let it be the default. rEFInd checks your ESP for EFI executables and lists them, so you don't have to keep adding menu entries.
â Emmanuel Rosa
May 29 at 17:07
add a comment |Â
up vote
1
down vote
accepted
The simplest way to go is to install from the LiveCD.
nixos-generate-config
will regenerate the hardware config, but if it finds configuration.nix
already exists it will leave it alone. And nixos-install
is designed such that it can be safely executed as many times as needed.
This means you can follow the main installation guide using the filesystem (and configuration) you already created for NixOS and just continue where you left off.
Some things to be mindful of:
- NixOS will install
systemd-boot
by default on EFI systems. So you'll end up with a new EFI executable along side the ones you already have. nixos-install
will also attempt to setsystemd-boot
as the default boot manager. I believe you can disable this by settingboot.loader.efi.canTouchEfiVariables
to false inconfiguration.nix
- I recommend installing NixOS with a basic config; For example, setup networking, users, and install a text editor but not much else. The reason is that the LiveCD uses a Nix store which is held in RAM. Your system will be first installed to this RAM-backed Nix store and then copied to disk. Once installed and bootable you can safely proceed with the rest of the configuration.
Thanks for the great answer! A quick question (and I can ask this in a separate one if you like): based on your first tip, I could have just mounted to the existing boot partition (i.e.,/dev/sda2
) andnixos-install
would only have added another EFI executable, correct? And ifboot.loader.efi.canTouchEfiVariables
had been set to false, I could've just used Ubuntu's GRUB and have an extra entry set up for NixOS?
â toraritte
May 29 at 2:53
I guess the answer is yes: How to configure dual boot NixOS with Mac OS X on an (U)EFI MacBook? and NixPkgs issue #21534 - Option to add extra entries to systemd-boot
â toraritte
May 29 at 5:41
1
Yep, that's correct. I've dual-booted NixOS with both MacOS and Windows 10 and in both cases I shared the same ESP (EFI partition). Settingboot.loader.efi.canTouchEfiVariables
to false should tells the installer to leave your current boot manager (GRUB2) as the default. Then it's a matter of addingsystemd-boot
to GRUB2 as an item. Another way, especially if you have a lot of systems, is to install rEFInd and let it be the default. rEFInd checks your ESP for EFI executables and lists them, so you don't have to keep adding menu entries.
â Emmanuel Rosa
May 29 at 17:07
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The simplest way to go is to install from the LiveCD.
nixos-generate-config
will regenerate the hardware config, but if it finds configuration.nix
already exists it will leave it alone. And nixos-install
is designed such that it can be safely executed as many times as needed.
This means you can follow the main installation guide using the filesystem (and configuration) you already created for NixOS and just continue where you left off.
Some things to be mindful of:
- NixOS will install
systemd-boot
by default on EFI systems. So you'll end up with a new EFI executable along side the ones you already have. nixos-install
will also attempt to setsystemd-boot
as the default boot manager. I believe you can disable this by settingboot.loader.efi.canTouchEfiVariables
to false inconfiguration.nix
- I recommend installing NixOS with a basic config; For example, setup networking, users, and install a text editor but not much else. The reason is that the LiveCD uses a Nix store which is held in RAM. Your system will be first installed to this RAM-backed Nix store and then copied to disk. Once installed and bootable you can safely proceed with the rest of the configuration.
The simplest way to go is to install from the LiveCD.
nixos-generate-config
will regenerate the hardware config, but if it finds configuration.nix
already exists it will leave it alone. And nixos-install
is designed such that it can be safely executed as many times as needed.
This means you can follow the main installation guide using the filesystem (and configuration) you already created for NixOS and just continue where you left off.
Some things to be mindful of:
- NixOS will install
systemd-boot
by default on EFI systems. So you'll end up with a new EFI executable along side the ones you already have. nixos-install
will also attempt to setsystemd-boot
as the default boot manager. I believe you can disable this by settingboot.loader.efi.canTouchEfiVariables
to false inconfiguration.nix
- I recommend installing NixOS with a basic config; For example, setup networking, users, and install a text editor but not much else. The reason is that the LiveCD uses a Nix store which is held in RAM. Your system will be first installed to this RAM-backed Nix store and then copied to disk. Once installed and bootable you can safely proceed with the rest of the configuration.
answered May 29 at 2:29
Emmanuel Rosa
2,1801410
2,1801410
Thanks for the great answer! A quick question (and I can ask this in a separate one if you like): based on your first tip, I could have just mounted to the existing boot partition (i.e.,/dev/sda2
) andnixos-install
would only have added another EFI executable, correct? And ifboot.loader.efi.canTouchEfiVariables
had been set to false, I could've just used Ubuntu's GRUB and have an extra entry set up for NixOS?
â toraritte
May 29 at 2:53
I guess the answer is yes: How to configure dual boot NixOS with Mac OS X on an (U)EFI MacBook? and NixPkgs issue #21534 - Option to add extra entries to systemd-boot
â toraritte
May 29 at 5:41
1
Yep, that's correct. I've dual-booted NixOS with both MacOS and Windows 10 and in both cases I shared the same ESP (EFI partition). Settingboot.loader.efi.canTouchEfiVariables
to false should tells the installer to leave your current boot manager (GRUB2) as the default. Then it's a matter of addingsystemd-boot
to GRUB2 as an item. Another way, especially if you have a lot of systems, is to install rEFInd and let it be the default. rEFInd checks your ESP for EFI executables and lists them, so you don't have to keep adding menu entries.
â Emmanuel Rosa
May 29 at 17:07
add a comment |Â
Thanks for the great answer! A quick question (and I can ask this in a separate one if you like): based on your first tip, I could have just mounted to the existing boot partition (i.e.,/dev/sda2
) andnixos-install
would only have added another EFI executable, correct? And ifboot.loader.efi.canTouchEfiVariables
had been set to false, I could've just used Ubuntu's GRUB and have an extra entry set up for NixOS?
â toraritte
May 29 at 2:53
I guess the answer is yes: How to configure dual boot NixOS with Mac OS X on an (U)EFI MacBook? and NixPkgs issue #21534 - Option to add extra entries to systemd-boot
â toraritte
May 29 at 5:41
1
Yep, that's correct. I've dual-booted NixOS with both MacOS and Windows 10 and in both cases I shared the same ESP (EFI partition). Settingboot.loader.efi.canTouchEfiVariables
to false should tells the installer to leave your current boot manager (GRUB2) as the default. Then it's a matter of addingsystemd-boot
to GRUB2 as an item. Another way, especially if you have a lot of systems, is to install rEFInd and let it be the default. rEFInd checks your ESP for EFI executables and lists them, so you don't have to keep adding menu entries.
â Emmanuel Rosa
May 29 at 17:07
Thanks for the great answer! A quick question (and I can ask this in a separate one if you like): based on your first tip, I could have just mounted to the existing boot partition (i.e.,
/dev/sda2
) and nixos-install
would only have added another EFI executable, correct? And if boot.loader.efi.canTouchEfiVariables
had been set to false, I could've just used Ubuntu's GRUB and have an extra entry set up for NixOS?â toraritte
May 29 at 2:53
Thanks for the great answer! A quick question (and I can ask this in a separate one if you like): based on your first tip, I could have just mounted to the existing boot partition (i.e.,
/dev/sda2
) and nixos-install
would only have added another EFI executable, correct? And if boot.loader.efi.canTouchEfiVariables
had been set to false, I could've just used Ubuntu's GRUB and have an extra entry set up for NixOS?â toraritte
May 29 at 2:53
I guess the answer is yes: How to configure dual boot NixOS with Mac OS X on an (U)EFI MacBook? and NixPkgs issue #21534 - Option to add extra entries to systemd-boot
â toraritte
May 29 at 5:41
I guess the answer is yes: How to configure dual boot NixOS with Mac OS X on an (U)EFI MacBook? and NixPkgs issue #21534 - Option to add extra entries to systemd-boot
â toraritte
May 29 at 5:41
1
1
Yep, that's correct. I've dual-booted NixOS with both MacOS and Windows 10 and in both cases I shared the same ESP (EFI partition). Setting
boot.loader.efi.canTouchEfiVariables
to false should tells the installer to leave your current boot manager (GRUB2) as the default. Then it's a matter of adding systemd-boot
to GRUB2 as an item. Another way, especially if you have a lot of systems, is to install rEFInd and let it be the default. rEFInd checks your ESP for EFI executables and lists them, so you don't have to keep adding menu entries.â Emmanuel Rosa
May 29 at 17:07
Yep, that's correct. I've dual-booted NixOS with both MacOS and Windows 10 and in both cases I shared the same ESP (EFI partition). Setting
boot.loader.efi.canTouchEfiVariables
to false should tells the installer to leave your current boot manager (GRUB2) as the default. Then it's a matter of adding systemd-boot
to GRUB2 as an item. Another way, especially if you have a lot of systems, is to install rEFInd and let it be the default. rEFInd checks your ESP for EFI executables and lists them, so you don't have to keep adding menu entries.â Emmanuel Rosa
May 29 at 17:07
add a comment |Â
up vote
0
down vote
Adding this answer for completeness sake: in theory, @Mioriin's suggestion above of chroot
ing would be the correct answer, that could be achieved by the command nixos-enter
.
From Ubuntu, with the NixOS partitions mounted to /mnt
:
$ sudo $(which nixos-enter)
...
[root@nixos:/]# nixos-rebuild switch
In practice, this did not work, because networking wouldn't work (probably because my configuration.nix
was missing the right setup in the first place), and got a bunch of error messages:
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
System has not been booted with systemd as init system (PID 1). Can't operate.
building Nix...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: unable to download 'https://cache.nixos.org/nix-cache-info': Couldn't resolve host name (6); retrying in 293 ms
^Cwarning: download of 'https://cache.nixos.org/nix-cache-info' was interrupted
don't know how to build these paths:
/nix/store/z6avpvg24f6d1br2sr6qlphsq3h4d91v-nix-2.0.2
error: interrupted by the user
warning: don't know how to get latest Nix
In the end, @Emmanuel Rosa's answer is right one, especially because (as he points it out) nixos-install
can be safely executed multiple times.
add a comment |Â
up vote
0
down vote
Adding this answer for completeness sake: in theory, @Mioriin's suggestion above of chroot
ing would be the correct answer, that could be achieved by the command nixos-enter
.
From Ubuntu, with the NixOS partitions mounted to /mnt
:
$ sudo $(which nixos-enter)
...
[root@nixos:/]# nixos-rebuild switch
In practice, this did not work, because networking wouldn't work (probably because my configuration.nix
was missing the right setup in the first place), and got a bunch of error messages:
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
System has not been booted with systemd as init system (PID 1). Can't operate.
building Nix...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: unable to download 'https://cache.nixos.org/nix-cache-info': Couldn't resolve host name (6); retrying in 293 ms
^Cwarning: download of 'https://cache.nixos.org/nix-cache-info' was interrupted
don't know how to build these paths:
/nix/store/z6avpvg24f6d1br2sr6qlphsq3h4d91v-nix-2.0.2
error: interrupted by the user
warning: don't know how to get latest Nix
In the end, @Emmanuel Rosa's answer is right one, especially because (as he points it out) nixos-install
can be safely executed multiple times.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Adding this answer for completeness sake: in theory, @Mioriin's suggestion above of chroot
ing would be the correct answer, that could be achieved by the command nixos-enter
.
From Ubuntu, with the NixOS partitions mounted to /mnt
:
$ sudo $(which nixos-enter)
...
[root@nixos:/]# nixos-rebuild switch
In practice, this did not work, because networking wouldn't work (probably because my configuration.nix
was missing the right setup in the first place), and got a bunch of error messages:
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
System has not been booted with systemd as init system (PID 1). Can't operate.
building Nix...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: unable to download 'https://cache.nixos.org/nix-cache-info': Couldn't resolve host name (6); retrying in 293 ms
^Cwarning: download of 'https://cache.nixos.org/nix-cache-info' was interrupted
don't know how to build these paths:
/nix/store/z6avpvg24f6d1br2sr6qlphsq3h4d91v-nix-2.0.2
error: interrupted by the user
warning: don't know how to get latest Nix
In the end, @Emmanuel Rosa's answer is right one, especially because (as he points it out) nixos-install
can be safely executed multiple times.
Adding this answer for completeness sake: in theory, @Mioriin's suggestion above of chroot
ing would be the correct answer, that could be achieved by the command nixos-enter
.
From Ubuntu, with the NixOS partitions mounted to /mnt
:
$ sudo $(which nixos-enter)
...
[root@nixos:/]# nixos-rebuild switch
In practice, this did not work, because networking wouldn't work (probably because my configuration.nix
was missing the right setup in the first place), and got a bunch of error messages:
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13
System has not been booted with systemd as init system (PID 1). Can't operate.
building Nix...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
warning: unable to download 'https://cache.nixos.org/nix-cache-info': Couldn't resolve host name (6); retrying in 293 ms
^Cwarning: download of 'https://cache.nixos.org/nix-cache-info' was interrupted
don't know how to build these paths:
/nix/store/z6avpvg24f6d1br2sr6qlphsq3h4d91v-nix-2.0.2
error: interrupted by the user
warning: don't know how to get latest Nix
In the end, @Emmanuel Rosa's answer is right one, especially because (as he points it out) nixos-install
can be safely executed multiple times.
answered May 31 at 5:58
toraritte
1639
1639
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446501%2fhow-to-rebuild-the-configuration-of-a-nixos-installation-from-live-cd%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Use
chroot
to edit the configuration and rebuild. wiki.archlinux.org/index.php/Change_root#Using_chrootâ Mioriin
May 28 at 15:32
In the end it was easier to just re-install NixOS, and the outdated NixOS
chroot
articles seemed intimidating, but I just realized thatnixos-enter
does just that. (It is also invoked bynixos-install
when installing the boot loader.)â toraritte
May 29 at 19:25