12.1 Chrooting into an existing system
This section details how to chroot to an already installed Guix System
with the aim of reconfiguring it, for example to fix a broken GRUB
installation. The process is similar to how it would be done on other
GNU/Linux systems, but there are some Guix System particularities such as
the daemon and profiles that make it worthy of explaining here.
- Obtain a bootable image of Guix System. It is recommended the latest
development snapshot so the kernel and the tools used are at least as as new
as those of your installed system; it can be retrieved from the
https://ci.guix.gnu.org URL. Follow the see Установочная флеш и DVD section for copying it to a bootable media.
- Boot the image, and proceed with the graphical text-based installer until
your network is configured. Alternatively, you could configure the network
manually by following the manual-installation-networking section. If
you get the error ‘RTNETLINK answers: Operation not possible due to
RF-kill’, try ‘rfkill list’ followed by ‘rfkill unblock 0’, where
‘0’ is your device identifier (ID).
- Switch to a virtual console (tty) if you haven’t already by pressing
simultaneously the Control + Alt + F4 keys. Mount your file system at
/mnt. Assuming your root partition is /dev/sda2, you would
do:
- Mount special block devices and Linux-specific directories:
mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --rbind /dev /mnt/dev
If your system is EFI-based, you must also mount the ESP partition.
Assuming it is /dev/sda1, you can do so with:
mount /dev/sda1 /mnt/boot/efi
- Enter your system via chroot:
- Source the system profile as well as your user profile to setup the
environment, where user is the user name used for the Guix System you
are attempting to repair:
source /var/guix/profiles/system/profile/etc/profile
source /home/user/.guix-profile/etc/profile
To ensure you are working with the Guix revision you normally would as your
normal user, also source your current Guix profile:
source /home/user/.config/guix/current/etc/profile
- Start a minimal
guix-daemon
in the background:
guix-daemon --build-users-group=guixbuild --disable-chroot &
- Edit your Guix System configuration if needed, then reconfigure with:
guix system reconfigure your-config.scm
- Finally, you should be good to reboot the system to test your fix.