Compare commits
3 Commits
ad397cf89b
...
257cc752b5
Author | SHA1 | Date | |
---|---|---|---|
257cc752b5 | |||
1e33763085 | |||
55198472bc |
363
README.org
363
README.org
@ -6,341 +6,60 @@ This repository contains setup and management instructions for a Guix North Amer
|
||||
Farm.
|
||||
#+end_abstract
|
||||
|
||||
* Install Guix on debian to be used to bootstrap the Guix os installation
|
||||
* Using Substitutes from cuirass.genenetwork.org
|
||||
|
||||
Optionally, the below steps can be completed within tmux or screen. Tmux was installed and
|
||||
used in this case using the following.
|
||||
** On Guix System
|
||||
|
||||
#+begin_src shell
|
||||
sudo apt update
|
||||
sudo apt install tmux
|
||||
tmux
|
||||
#+end_src
|
||||
If you're using Guix System, you can use the cuirass.genenetwork.org substitute
|
||||
server completing the following:
|
||||
|
||||
Following the [[https://guix.gnu.org/manual/en/html_node/Binary-Installation.html][Binary Installation]] section from the Guix manual to install guix.
|
||||
1. Add ~https://cuirass.genenetwork.org~ to the list of substitute servers (using the
|
||||
~substitute-urls~ field of ~guix-configuration~ passed to the ~guix-daemon~ service).
|
||||
|
||||
#+begin_src shell
|
||||
sudo apt install -y guix
|
||||
#+end_src
|
||||
2. Adjust guix-daemon ACLs to include the following public key (using the
|
||||
~authorized-keys~ field of ~guix-configuration~ passed to the ~guix-daemon~ service).
|
||||
|
||||
This installs the Debian's packaged version of Guix, which likely is older then what's
|
||||
available upstream. As such, update our installation of Guix (following the [[https://guix.gnu.org/manual/en/html_node/Upgrading-Guix.html][Updating Guix]]
|
||||
documentation specific to foreign distros').
|
||||
#+begin_src scheme
|
||||
(public-key
|
||||
(ecc
|
||||
(curve Ed25519)
|
||||
(q #9578AD6CDB23BA51F9C4185D5D5A32A7EEB47ACDD55F1CCB8CEE4E0570FBF961#)
|
||||
)
|
||||
)
|
||||
#+end_src
|
||||
|
||||
#+begin_src shell
|
||||
sudo -i guix pull
|
||||
sudo systemctl restart guix-daemon.service
|
||||
#+end_src
|
||||
In the future, we hope to work with Guix maintainers to include this substitute
|
||||
server as one of the provided Guix System defaults.
|
||||
|
||||
* Define Guix operating-system for the machine
|
||||
** On Foreign Distributions
|
||||
|
||||
See: [[file:balg02.scm][balg02.scm]]
|
||||
When using Guix on a foreign distribution, you'll need to do the following to enable
|
||||
substitutes from cuirass.genenetwork.org:
|
||||
|
||||
** Bootloader configuration
|
||||
1. Add the public key (provided above) for cuirass.genenetwork.org to the guix-daemon ACLs.
|
||||
|
||||
For this installation, debian and its bootloader Grub will be left in place. Because we want
|
||||
to retain Guix's interactions with Grub (eg. to allow for restoring from failed upgrades to
|
||||
an earlier generation), we will have debian's Grub chainload Guix's Grub. To do so, we will
|
||||
need to manually adjust Debians' Grub in order to add another menu entry, and set it as the
|
||||
default menu item.
|
||||
#+begin_src shell
|
||||
sudo guix archive --authorize < cuirass.genenetwork.org.pub
|
||||
#+end_src
|
||||
|
||||
Below is a snippet from debian's ~/etc/default/grub~.
|
||||
2. Add the substitute url using the ~--substitute-urls~ option to guix-daemon. Assuming your
|
||||
foreign distribution uses systemd, this can be done using the following.
|
||||
|
||||
#+begin_src text
|
||||
GRUB_DEFAULT=0
|
||||
GRUB_TIMEOUT=5
|
||||
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200n8"
|
||||
GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200n8"
|
||||
GRUB_TERMINAL="console serial"
|
||||
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=1 --word=8 --parity=no --stop=1"
|
||||
#+end_src
|
||||
#+begin_src shell
|
||||
sudo systemctl edit --full guix-daemon
|
||||
#+end_src
|
||||
|
||||
From this we extract the necessary guix bootloader configuration options (for serial).
|
||||
If you want to just use ci.guix.gnu.org, or cuirass.genenetwork.org for that matter,
|
||||
you'll need to adjust the substitute URLs configuration for the guix-daemon to just refer
|
||||
to the substitute servers you want to use. Once edited and saved, restart the guix daemon.
|
||||
|
||||
- serial-unit :: 1
|
||||
- serial-speed :: 115200
|
||||
- terminal-inputs :: console serial
|
||||
- terminal-outputs :: console serial
|
||||
#+begin_src shell
|
||||
sudo systemctl restart guix-daemon.service
|
||||
#+end_src
|
||||
|
||||
*** Manual modifications to Debian's Grub
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: manual_modifications_to_debians_grub
|
||||
:END:
|
||||
* Reference
|
||||
|
||||
Modify grub config on debian to add an additional (and default) option to chainload Guix
|
||||
grub.
|
||||
|
||||
- Add a menuitem for Guix in ~/etc/grub.d/40_custom~, where ~<EFI-UUID>~ is replaced with the
|
||||
efi partition UUID.
|
||||
|
||||
#+begin_src text
|
||||
menuentry "Gnu Guix" {
|
||||
insmod part_gpt
|
||||
insmod search_fs_uuid
|
||||
insmod chain
|
||||
search --fs-uuid --no-floppy --set=root <EFI-UUID>
|
||||
chainloader ($root)/EFI/Guix/grubx64.efi
|
||||
}
|
||||
#+end_src
|
||||
|
||||
- Modify ~/etc/default/grub~ setting ~GRUB_DEFAULT="Gnu Guix"~
|
||||
|
||||
- Run ~grub-mkconfig -o /boot/grub/grub.cfg~
|
||||
|
||||
** Network configuration
|
||||
|
||||
Using the a snippet taken from ~/etc/network/interfaces~ on the existing debian installation
|
||||
(below), we can extract the necessary details to configure Guix's static-networking-service.
|
||||
|
||||
- Interface :: eno8303
|
||||
- Address :: 216.37.76.55/24
|
||||
- Gateway :: 216.37.76.1
|
||||
- DNS Name Servers :: 216.37.64.2 216.37.64.3
|
||||
- DNS Search :: genenetwork.org
|
||||
|
||||
#+begin_src text
|
||||
# The primary network interface
|
||||
allow-hotplug eno8303
|
||||
iface eno8303 inet static
|
||||
address 216.37.76.55/24
|
||||
gateway 216.37.76.1
|
||||
# dns-* options are implemented by the resolvconf package, if installed
|
||||
dns-nameservers 216.37.64.2 216.37.64.3
|
||||
dns-search genenetwork.org
|
||||
#+end_src
|
||||
|
||||
** Disk Partitioning
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: disk_partitioning
|
||||
:END:
|
||||
|
||||
For this installation we are using ~/dev/sdb~ (a 1.5T ssd which is faster then the
|
||||
alternative 3.6T ssd in the server).
|
||||
|
||||
First, we require a variety of tools to setup and partition the disk destined for Guix
|
||||
installation. These could be installed on debian, however an alternative approach would be to
|
||||
use Guix from debian as a package manager to temporarily provide the prerequisite tools. This
|
||||
can be done using the shell spawned from the following command.
|
||||
|
||||
#+begin_src shell
|
||||
guix shell parted btrfs-progs dosfstools
|
||||
#+end_src
|
||||
|
||||
*** Create disk partition table and layout
|
||||
|
||||
#+begin_src bash
|
||||
parted /dev/sda mklabel gpt
|
||||
#+end_src
|
||||
|
||||
*** Create partitions
|
||||
|
||||
A simple™️ partition layout is used for this installation, consisting of an EFI ESP partition,
|
||||
and the remaining disk partitions for use by btrfs, where btrfs subvolumes and a swapfile
|
||||
will be used.
|
||||
|
||||
#+begin_src bash
|
||||
parted /dev/sda mkpart primary fat32 0% 512MiB
|
||||
parted /dev/sda mkpart primary 512MiB 100%
|
||||
#+end_src
|
||||
|
||||
*** Create EFI partition
|
||||
|
||||
#+begin_src bash
|
||||
parted /dev/sda set 1 esp on
|
||||
mkfs.fat -F32 /dev/sda1
|
||||
#+end_src
|
||||
|
||||
*** Create btrfs 'pool' (file-system) and subvolumes
|
||||
|
||||
**** Create btrfs file-system
|
||||
|
||||
#+begin_src bash
|
||||
mkfs.btrfs --label root /dev/sda2
|
||||
#+end_src
|
||||
|
||||
**** Create btrfs subvolumes
|
||||
|
||||
First mount the btrfs top-level file-system.
|
||||
|
||||
#+begin_src bash
|
||||
mount /dev/sda2 /mnt
|
||||
#+end_src
|
||||
|
||||
Then create the root subvolume, and a subvolume for swapfiles.
|
||||
|
||||
#+begin_src bash
|
||||
btrfs subvolume create /mnt/@
|
||||
btrfs subvolume create /mnt/@swap
|
||||
#+end_src
|
||||
|
||||
Unmount the top-level btrfs file-system.
|
||||
|
||||
#+begin_src bash
|
||||
umount /mnt
|
||||
#+end_src
|
||||
|
||||
Mount the root subvolume.
|
||||
|
||||
#+begin_src bash
|
||||
mount -o subvol=@,compress=zstd /dev/sda2 /mnt
|
||||
#+end_src
|
||||
|
||||
Create nested subvolumes for ~/gnu/store~ and ~/home~.
|
||||
|
||||
#+begin_src bash
|
||||
mkdir -p /mnt/gnu
|
||||
|
||||
btrfs subvolume create /mnt/gnu/store
|
||||
btrfs subvolume create /mnt/home
|
||||
btrfs subvolume create /mnt/var
|
||||
#+end_src
|
||||
|
||||
*** Create swap
|
||||
|
||||
#+begin_src bash
|
||||
mkdir /mnt/swap
|
||||
mount -o subvol=@swap /dev/sda2 /mnt/swap
|
||||
btrfs filesystem mkswapfile --size 32g --uuid clear /swap/swapfile
|
||||
#+end_src
|
||||
|
||||
*** Prepare ~/mnt~ for Guix installation
|
||||
|
||||
Create ~/boot/efi~ directory for UEFI boot and mount the ESP partition there.
|
||||
|
||||
#+begin_src bash
|
||||
mkdir -p /mnt/boot/efi
|
||||
mount /dev/sda1 /mnt/boot/efi
|
||||
#+end_src
|
||||
|
||||
Both root and swap are already mounted and ready due to earlier steps.
|
||||
|
||||
** Testing
|
||||
|
||||
To test the configuration in a vm before deployment, the following can be used.
|
||||
|
||||
#+begin_src shell
|
||||
$(guix time-machine -C channels.scm -- system vm -e '(@ (guix-na config balg02) %system)') -m 2G -smp 2 -nic user,model=virtio-net-pci
|
||||
#+end_src
|
||||
|
||||
** Manual Testing of bootstrapping Guix from a Debian VM
|
||||
|
||||
To correctly test this deployment, a environment that mimics bal02g should be used. The
|
||||
closest to this is a VM with debian installed, with an additional virtual disk to bootstrap
|
||||
guix onto. This will enable validating bootloader changes required to chainboot Guix's Grub.
|
||||
|
||||
This testing could be automated, but was done manually as we do not expect to have to
|
||||
bootstrap a system like this often.
|
||||
|
||||
*** Setup Debian VM
|
||||
|
||||
1. Using ~qemu~, ~libvirt~, ~virtualbox~, etc.. create a VM that boots using UEFI firmware.
|
||||
|
||||
1. Create an additional virtual disk that will be used to bootstrap Guix onto from Debian.
|
||||
This disk should be ~>20GiB~.
|
||||
|
||||
2. Ensure that there is a serial device attached to the VM.
|
||||
|
||||
2. Install Debian 12 on the VM created during step 1 (this can be a minimal server
|
||||
installation, no desktop, etc..).
|
||||
|
||||
1. It's worth noting that for some reason debian didn't setup a efi boot
|
||||
entry for some reason. Not sure why. To create one I used:
|
||||
|
||||
#+begin_src shell
|
||||
efibootmgr --create --disk /dev/vda -p 1 -L "Debian" -l "\EFI\debian\grub64.efi"
|
||||
#+end_src
|
||||
|
||||
After which I would have adjusted the boot order with:
|
||||
|
||||
#+begin_src shell
|
||||
efibootmgr -o X,Y,...
|
||||
#+end_src
|
||||
|
||||
However, in my case it was not needed as the boot order had debian first.
|
||||
|
||||
3. Reboot VM; further configure Debian.
|
||||
|
||||
1. Enable serial for debian grub
|
||||
|
||||
Modify ~/etc/default/grub~, adjusting ~GRUB_TERMINAL~ and ~GRUB_CMDLINE_LINUX_DEFAULT~ as
|
||||
follows.
|
||||
|
||||
#+begin_src text
|
||||
GRUB_TERMINAL="console serial"
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200n8"
|
||||
#+end_src
|
||||
|
||||
2. Enable getty over serial
|
||||
|
||||
#+begin_src shell
|
||||
systemctl enable getty@ttyS0.service
|
||||
systemctl start getty@ttyS0.service
|
||||
#+end_src
|
||||
|
||||
*** Test Bootstrapping Gnu Guix from Debian
|
||||
|
||||
With the Debian VM setup, we can now apply the documented bootstrapping steps.
|
||||
|
||||
1. [[#disk_partitioning][Disk Partitioning]], but with disks adjusted to match the testing VM.
|
||||
2. [[#bootstrap_guix][Bootstrap Guix]], ensure ~<EFI-UUID>~ matches the VM efi partition used for Guix.
|
||||
3. [[#manual_modifications_to_debians_grub][Manual modifications to Debian's Grub]], again ensuring ~<EFI-UUID>~ matches the VM efi
|
||||
partition used for Guix.
|
||||
4. Reboot
|
||||
|
||||
Following rebooting the VM, its expected that:
|
||||
|
||||
- Debian Grub boots first, has "Gnu Guix" as its default selected option, which boots Guixs'
|
||||
Grub.
|
||||
- Serial access works for:
|
||||
- Debian and Guix Grub/s
|
||||
- Debian and Guix linux console
|
||||
|
||||
As this testing is occurring in a VM, its worth noting things that are NOT expected to to be
|
||||
testable.
|
||||
|
||||
- The network interfaces are not going to match what is on balg02, so its expected that the
|
||||
networking service will not be able to start.
|
||||
|
||||
* Bootstrap Guix
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: bootstrap_guix
|
||||
:END:
|
||||
|
||||
Using Guix on debian, bootstrap the machine using the configuration in [[*Define Guix operating-system for the machine][Define Guix
|
||||
operating-system for the machine]].
|
||||
|
||||
** Configure Guix Channels
|
||||
|
||||
First, fetch the most recent channel file from the target machine.
|
||||
|
||||
#+begin_src shell
|
||||
curl -O https://git.rekahsoft.ca/rekahsoft/guix-north-america/raw/branch/master/channels.scm
|
||||
#+end_src
|
||||
|
||||
** Create and Bootstrap System
|
||||
|
||||
Create a ~bootstrap.scm~ file like below, but where ~<EFI-UUID>~ is replaced with the efi
|
||||
partition UUID.
|
||||
|
||||
#+begin_src scheme
|
||||
((@ (guix-na config balg02) balg02) "<EFI-UUID>")
|
||||
#+end_src
|
||||
|
||||
Use ~guix system init ...~ to instantiate the system, but using guix time-machine to use
|
||||
pinned dependencies.
|
||||
|
||||
#+begin_src shell
|
||||
guix time-machine -C channels.scm -- system init bootstrap.scm /mnt
|
||||
#+end_src
|
||||
|
||||
** Post Boostrapping
|
||||
|
||||
After guix has been bootstrapped, its useful to do an initial ~guix pull~ using the same
|
||||
channels that were used during bootstrapping.
|
||||
|
||||
#+begin_src shell
|
||||
guix pull -C /run/current-system/channels.scm
|
||||
#+end_src
|
||||
|
||||
To ensure your shell refers to the correct guix after its been updated, run ~hash guix~.
|
||||
- [[./docs/initial-setup.org][Intial Setup Instructions]] :: Details the initial setup of a genenetwork.org sponsored,
|
||||
single node build farm.
|
||||
- [[./docs/administration.org][Administration of cuirass.genenetwork.org]] :: details maintenance and administration of
|
||||
cuirass.genenetwork.org
|
||||
|
@ -3,7 +3,7 @@
|
||||
(url "https://git.savannah.gnu.org/git/guix.git")
|
||||
(branch "master")
|
||||
(commit
|
||||
"94c8cec99969fe9f65777637fde1f05e1c576a3f")
|
||||
"bd59254b829396d050919065a879357fd0e994c7")
|
||||
(introduction
|
||||
(make-channel-introduction
|
||||
"9edb3f66fd807b096b48283debdcddccfea34bad"
|
||||
|
32
docs/administration.org
Normal file
32
docs/administration.org
Normal file
@ -0,0 +1,32 @@
|
||||
#+TITLE: Administration of cuirass.genenetwork.org
|
||||
#+AUTHOR: Collin J. Doering
|
||||
|
||||
#+begin_abstract
|
||||
This document details maintenance and administration of cuirass.genenetwork.org.
|
||||
#+end_abstract
|
||||
|
||||
* Updating cuirass.genenetwork.org
|
||||
|
||||
1. Fetch the most recent channel file.
|
||||
|
||||
#+begin_src shell
|
||||
curl -O https://git.genenetwork.org/guix-north-america/plain/channels.scm
|
||||
#+end_src
|
||||
|
||||
2. Update guix using the most recent channel file.
|
||||
|
||||
#+begin_src shell
|
||||
sudo -i guix pull -C $(relapath channels.scm)
|
||||
#+end_src
|
||||
|
||||
3. Update the system.
|
||||
|
||||
#+begin_src shell
|
||||
sudo guix system reconfigure -e '((@ (guix-na config balg02) balg02) %system)'
|
||||
#+end_src
|
||||
|
||||
4. Reboot.
|
||||
|
||||
#+begin_src shell
|
||||
sudo reboot
|
||||
#+end_src
|
346
docs/initial-setup.org
Normal file
346
docs/initial-setup.org
Normal file
@ -0,0 +1,346 @@
|
||||
#+TITLE: Balg02 Initial Setup Instructions
|
||||
#+AUTHOR: Collin J. Doering
|
||||
|
||||
#+begin_abstract
|
||||
This document details the initial setup of a genenetwork.org sponsored server hosted at the
|
||||
University of Tennessee.
|
||||
#+end_abstract
|
||||
|
||||
* Install Guix on debian to be used to bootstrap the Guix os installation
|
||||
|
||||
Optionally, the below steps can be completed within tmux or screen. Tmux was installed and
|
||||
used in this case using the following.
|
||||
|
||||
#+begin_src shell
|
||||
sudo apt update
|
||||
sudo apt install tmux
|
||||
tmux
|
||||
#+end_src
|
||||
|
||||
Following the [[https://guix.gnu.org/manual/en/html_node/Binary-Installation.html][Binary Installation]] section from the Guix manual to install guix.
|
||||
|
||||
#+begin_src shell
|
||||
sudo apt install -y guix
|
||||
#+end_src
|
||||
|
||||
This installs the Debian's packaged version of Guix, which likely is older then what's
|
||||
available upstream. As such, update our installation of Guix (following the [[https://guix.gnu.org/manual/en/html_node/Upgrading-Guix.html][Updating Guix]]
|
||||
documentation specific to foreign distros').
|
||||
|
||||
#+begin_src shell
|
||||
sudo -i guix pull
|
||||
sudo systemctl restart guix-daemon.service
|
||||
#+end_src
|
||||
|
||||
* Define Guix operating-system for the machine
|
||||
|
||||
See: [[file:balg02.scm][balg02.scm]]
|
||||
|
||||
** Bootloader configuration
|
||||
|
||||
For this installation, debian and its bootloader Grub will be left in place. Because we want
|
||||
to retain Guix's interactions with Grub (eg. to allow for restoring from failed upgrades to
|
||||
an earlier generation), we will have debian's Grub chainload Guix's Grub. To do so, we will
|
||||
need to manually adjust Debians' Grub in order to add another menu entry, and set it as the
|
||||
default menu item.
|
||||
|
||||
Below is a snippet from debian's ~/etc/default/grub~.
|
||||
|
||||
#+begin_src text
|
||||
GRUB_DEFAULT=0
|
||||
GRUB_TIMEOUT=5
|
||||
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200n8"
|
||||
GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200n8"
|
||||
GRUB_TERMINAL="console serial"
|
||||
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=1 --word=8 --parity=no --stop=1"
|
||||
#+end_src
|
||||
|
||||
From this we extract the necessary guix bootloader configuration options (for serial).
|
||||
|
||||
- serial-unit :: 1
|
||||
- serial-speed :: 115200
|
||||
- terminal-inputs :: console serial
|
||||
- terminal-outputs :: console serial
|
||||
|
||||
*** Manual modifications to Debian's Grub
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: manual_modifications_to_debians_grub
|
||||
:END:
|
||||
|
||||
Modify grub config on debian to add an additional (and default) option to chainload Guix
|
||||
grub.
|
||||
|
||||
- Add a menuitem for Guix in ~/etc/grub.d/40_custom~, where ~<EFI-UUID>~ is replaced with the
|
||||
efi partition UUID.
|
||||
|
||||
#+begin_src text
|
||||
menuentry "Gnu Guix" {
|
||||
insmod part_gpt
|
||||
insmod search_fs_uuid
|
||||
insmod chain
|
||||
search --fs-uuid --no-floppy --set=root <EFI-UUID>
|
||||
chainloader ($root)/EFI/Guix/grubx64.efi
|
||||
}
|
||||
#+end_src
|
||||
|
||||
- Modify ~/etc/default/grub~ setting ~GRUB_DEFAULT="Gnu Guix"~
|
||||
|
||||
- Run ~grub-mkconfig -o /boot/grub/grub.cfg~
|
||||
|
||||
** Network configuration
|
||||
|
||||
Using the a snippet taken from ~/etc/network/interfaces~ on the existing debian installation
|
||||
(below), we can extract the necessary details to configure Guix's static-networking-service.
|
||||
|
||||
- Interface :: eno8303
|
||||
- Address :: 216.37.76.55/24
|
||||
- Gateway :: 216.37.76.1
|
||||
- DNS Name Servers :: 216.37.64.2 216.37.64.3
|
||||
- DNS Search :: genenetwork.org
|
||||
|
||||
#+begin_src text
|
||||
# The primary network interface
|
||||
allow-hotplug eno8303
|
||||
iface eno8303 inet static
|
||||
address 216.37.76.55/24
|
||||
gateway 216.37.76.1
|
||||
# dns-* options are implemented by the resolvconf package, if installed
|
||||
dns-nameservers 216.37.64.2 216.37.64.3
|
||||
dns-search genenetwork.org
|
||||
#+end_src
|
||||
|
||||
** Disk Partitioning
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: disk_partitioning
|
||||
:END:
|
||||
|
||||
For this installation we are using ~/dev/sdb~ (a 1.5T ssd which is faster then the
|
||||
alternative 3.6T ssd in the server).
|
||||
|
||||
First, we require a variety of tools to setup and partition the disk destined for Guix
|
||||
installation. These could be installed on debian, however an alternative approach would be to
|
||||
use Guix from debian as a package manager to temporarily provide the prerequisite tools. This
|
||||
can be done using the shell spawned from the following command.
|
||||
|
||||
#+begin_src shell
|
||||
guix shell parted btrfs-progs dosfstools
|
||||
#+end_src
|
||||
|
||||
*** Create disk partition table and layout
|
||||
|
||||
#+begin_src bash
|
||||
parted /dev/sda mklabel gpt
|
||||
#+end_src
|
||||
|
||||
*** Create partitions
|
||||
|
||||
A simple™️ partition layout is used for this installation, consisting of an EFI ESP partition,
|
||||
and the remaining disk partitions for use by btrfs, where btrfs subvolumes and a swapfile
|
||||
will be used.
|
||||
|
||||
#+begin_src bash
|
||||
parted /dev/sda mkpart primary fat32 0% 512MiB
|
||||
parted /dev/sda mkpart primary 512MiB 100%
|
||||
#+end_src
|
||||
|
||||
*** Create EFI partition
|
||||
|
||||
#+begin_src bash
|
||||
parted /dev/sda set 1 esp on
|
||||
mkfs.fat -F32 /dev/sda1
|
||||
#+end_src
|
||||
|
||||
*** Create btrfs 'pool' (file-system) and subvolumes
|
||||
|
||||
**** Create btrfs file-system
|
||||
|
||||
#+begin_src bash
|
||||
mkfs.btrfs --label root /dev/sda2
|
||||
#+end_src
|
||||
|
||||
**** Create btrfs subvolumes
|
||||
|
||||
First mount the btrfs top-level file-system.
|
||||
|
||||
#+begin_src bash
|
||||
mount /dev/sda2 /mnt
|
||||
#+end_src
|
||||
|
||||
Then create the root subvolume, and a subvolume for swapfiles.
|
||||
|
||||
#+begin_src bash
|
||||
btrfs subvolume create /mnt/@
|
||||
btrfs subvolume create /mnt/@swap
|
||||
#+end_src
|
||||
|
||||
Unmount the top-level btrfs file-system.
|
||||
|
||||
#+begin_src bash
|
||||
umount /mnt
|
||||
#+end_src
|
||||
|
||||
Mount the root subvolume.
|
||||
|
||||
#+begin_src bash
|
||||
mount -o subvol=@,compress=zstd /dev/sda2 /mnt
|
||||
#+end_src
|
||||
|
||||
Create nested subvolumes for ~/gnu/store~ and ~/home~.
|
||||
|
||||
#+begin_src bash
|
||||
mkdir -p /mnt/gnu
|
||||
|
||||
btrfs subvolume create /mnt/gnu/store
|
||||
btrfs subvolume create /mnt/home
|
||||
btrfs subvolume create /mnt/var
|
||||
#+end_src
|
||||
|
||||
*** Create swap
|
||||
|
||||
#+begin_src bash
|
||||
mkdir /mnt/swap
|
||||
mount -o subvol=@swap /dev/sda2 /mnt/swap
|
||||
btrfs filesystem mkswapfile --size 32g --uuid clear /swap/swapfile
|
||||
#+end_src
|
||||
|
||||
*** Prepare ~/mnt~ for Guix installation
|
||||
|
||||
Create ~/boot/efi~ directory for UEFI boot and mount the ESP partition there.
|
||||
|
||||
#+begin_src bash
|
||||
mkdir -p /mnt/boot/efi
|
||||
mount /dev/sda1 /mnt/boot/efi
|
||||
#+end_src
|
||||
|
||||
Both root and swap are already mounted and ready due to earlier steps.
|
||||
|
||||
** Testing
|
||||
|
||||
To test the configuration in a vm before deployment, the following can be used.
|
||||
|
||||
#+begin_src shell
|
||||
$(guix time-machine -C channels.scm -- system vm -e '(@ (guix-na config balg02) %system)') -m 2G -smp 2 -nic user,model=virtio-net-pci
|
||||
#+end_src
|
||||
|
||||
** Manual Testing of bootstrapping Guix from a Debian VM
|
||||
|
||||
To correctly test this deployment, a environment that mimics bal02g should be used. The
|
||||
closest to this is a VM with debian installed, with an additional virtual disk to bootstrap
|
||||
guix onto. This will enable validating bootloader changes required to chainboot Guix's Grub.
|
||||
|
||||
This testing could be automated, but was done manually as we do not expect to have to
|
||||
bootstrap a system like this often.
|
||||
|
||||
*** Setup Debian VM
|
||||
|
||||
1. Using ~qemu~, ~libvirt~, ~virtualbox~, etc.. create a VM that boots using UEFI firmware.
|
||||
|
||||
1. Create an additional virtual disk that will be used to bootstrap Guix onto from Debian.
|
||||
This disk should be ~>20GiB~.
|
||||
|
||||
2. Ensure that there is a serial device attached to the VM.
|
||||
|
||||
2. Install Debian 12 on the VM created during step 1 (this can be a minimal server
|
||||
installation, no desktop, etc..).
|
||||
|
||||
1. It's worth noting that for some reason debian didn't setup a efi boot
|
||||
entry for some reason. Not sure why. To create one I used:
|
||||
|
||||
#+begin_src shell
|
||||
efibootmgr --create --disk /dev/vda -p 1 -L "Debian" -l "\EFI\debian\grub64.efi"
|
||||
#+end_src
|
||||
|
||||
After which I would have adjusted the boot order with:
|
||||
|
||||
#+begin_src shell
|
||||
efibootmgr -o X,Y,...
|
||||
#+end_src
|
||||
|
||||
However, in my case it was not needed as the boot order had debian first.
|
||||
|
||||
3. Reboot VM; further configure Debian.
|
||||
|
||||
1. Enable serial for debian grub
|
||||
|
||||
Modify ~/etc/default/grub~, adjusting ~GRUB_TERMINAL~ and ~GRUB_CMDLINE_LINUX_DEFAULT~ as
|
||||
follows.
|
||||
|
||||
#+begin_src text
|
||||
GRUB_TERMINAL="console serial"
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200n8"
|
||||
#+end_src
|
||||
|
||||
2. Enable getty over serial
|
||||
|
||||
#+begin_src shell
|
||||
systemctl enable getty@ttyS0.service
|
||||
systemctl start getty@ttyS0.service
|
||||
#+end_src
|
||||
|
||||
*** Test Bootstrapping Gnu Guix from Debian
|
||||
|
||||
With the Debian VM setup, we can now apply the documented bootstrapping steps.
|
||||
|
||||
1. [[#disk_partitioning][Disk Partitioning]], but with disks adjusted to match the testing VM.
|
||||
2. [[#bootstrap_guix][Bootstrap Guix]], ensure ~<EFI-UUID>~ matches the VM efi partition used for Guix.
|
||||
3. [[#manual_modifications_to_debians_grub][Manual modifications to Debian's Grub]], again ensuring ~<EFI-UUID>~ matches the VM efi
|
||||
partition used for Guix.
|
||||
4. Reboot
|
||||
|
||||
Following rebooting the VM, its expected that:
|
||||
|
||||
- Debian Grub boots first, has "Gnu Guix" as its default selected option, which boots Guixs'
|
||||
Grub.
|
||||
- Serial access works for:
|
||||
- Debian and Guix Grub/s
|
||||
- Debian and Guix linux console
|
||||
|
||||
As this testing is occurring in a VM, its worth noting things that are NOT expected to to be
|
||||
testable.
|
||||
|
||||
- The network interfaces are not going to match what is on balg02, so its expected that the
|
||||
networking service will not be able to start.
|
||||
|
||||
* Bootstrap Guix
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: bootstrap_guix
|
||||
:END:
|
||||
|
||||
Using Guix on debian, bootstrap the machine using the configuration in [[*Define Guix operating-system for the machine][Define Guix
|
||||
operating-system for the machine]].
|
||||
|
||||
** Configure Guix Channels
|
||||
|
||||
First, fetch the most recent channel file from the target machine.
|
||||
|
||||
#+begin_src shell
|
||||
curl -O https://git.rekahsoft.ca/rekahsoft/guix-north-america/raw/branch/master/channels.scm
|
||||
#+end_src
|
||||
|
||||
** Create and Bootstrap System
|
||||
|
||||
Create a ~bootstrap.scm~ file like below, but where ~<EFI-UUID>~ is replaced with the efi
|
||||
partition UUID.
|
||||
|
||||
#+begin_src scheme
|
||||
((@ (guix-na config balg02) balg02) "<EFI-UUID>")
|
||||
#+end_src
|
||||
|
||||
Use ~guix system init ...~ to instantiate the system, but using guix time-machine to use
|
||||
pinned dependencies.
|
||||
|
||||
#+begin_src shell
|
||||
guix time-machine -C channels.scm -- system init bootstrap.scm /mnt
|
||||
#+end_src
|
||||
|
||||
** Post Boostrapping
|
||||
|
||||
After guix has been bootstrapped, its useful to do an initial ~guix pull~ using the same
|
||||
channels that were used during bootstrapping.
|
||||
|
||||
#+begin_src shell
|
||||
guix pull -C /run/current-system/channels.scm
|
||||
#+end_src
|
||||
|
||||
To ensure your shell refers to the correct guix after its been updated, run ~hash guix~.
|
Loading…
Reference in New Issue
Block a user