Installing guix on IntelNUC
using the hardware you have, even if we are nonfree
- tags
- freesoftware
- guix
- docker
Contents
I’ve been getting into Guix and Emacs lately, going back to my Free Software roots. It’s amazing. Guix is a functional package manager that you can use on top of a linux distribution to have repeatable and rollbackable builds. Guix System is a distrubution that’s Guix all the way down.
I have an Intel NUC lying around that I wanted to use, so this is my effort to get a working Guix System installation on it. This post took me almost 14 days to write, because I wanted to use the WiFi interface rather than plugging it into my router directly, and so I had to build a custom kernel with non-free code. If you have an ethernet cord, or your hardware is supported by the linux-libre kernel this is all overkill and just follow the Guix System installer instructions.
I should reiterate that if a) I plugged into the router or b) had the right network hardware that linux-libre supported this guide would be much much shorter, and this was largely an excersize to force me to get into the details of how Guix System worked. This doesn’t, you know, make sense as a thing to do. Just plug in ethernet.
Overview
This is our strategy:
- Install guix in a virtual host running on the host machine
- Pull down the latest guix and nonguix channels
- Define an operating system configuration for the IntelNUC using non-free wifi
- Burn it onto a USB key
- Disable secure booting on the NUC
- Boot off of the USB
- Running
guix system init
to put the new operating system
We have three options of setting up the environment – one is to install guix ontop of a current Linux installation, another one is to install guix in a debian docker container, use that to generate the installation image and export it out. The other is to run an actual Guix System distrubution inside of qemu, use that the generate the installation image, and export it out. I don’t know how to make qemu
work well on OSX so I used the docker strategy (B). But (A) or (C) is probably nicer if you are starting with a Linux machine.
Option A: Install guix ontop of Linux
Follow the binary installation instructions from the Guix documentation to get Guix installed in your local environment. This will leave guix available on your machine, which could be great depending upon your use case. I’m doing this on a OSX machine which won’t work.
Option B: Dockerfile for guix
We are going to put the steps for binary installation of Guix into a Dockerfile
, which will be based upon debian
. This will all be in a container so once we are done we won’t ahve anything on the host machine left over.
One thing to note is that in order to run guix pull
we’ll need to run docker with --privileged
. Not totally sure why, but here is a list to the mailing list discussion about it. This Dockerfile
is basically a simple rewrite of the installer script, that helped me understand how guix was setup under the hood.
|
|
Then we build it and start it up.
|
|
One of my favorite things about this command is that everything basically goes away after you exit out. This is a play ground that will happy disappear and recreate itself as needed. You might not want to have --rm
flag since once you shut down or exist the container it will delete everything, but I like to have things clean up after themselves.
Once we are in, the first thing we need to do is to start up the guix-daemon
inside of the container.
|
|
Do a guix pull
to make sure that everything is installed correctly.
Once this is working, set your path:
|
|
You can test out the installation by guix install hello
and then trying to run hello
.
Option C: Installing QEMU
You can install qemu
and run the sample installer this way. This is painfully slow on OSX, but works pretty well on the Chromebook. This is because I remove --enable-kvm
on the MacBook so I guess it falls back to software cpu emulation or something, I don’t know the equivlent for how to do this on Darwin.
|
|
And then start it up. For OSX take out enable-kvm
|
|
Once this is started up, our directions converge together below. However, this is painfully slow on OSX so I don’t think it’s a viable option.
Include the nonguix
channel
As root, create a ~/.config/guix/channels.scm
file to include the nonguix
channel:
|
|
And then run guix pull
to update everything. This should take a bit, but not terribly long.
|
|
Build the boot image
Now we define the operating system that we will eventually install. Copy this config.scm file into the docker container:
|
|
And build the image with
|
|
This command will take forever (around 1 hour) mainly because it’s compiling the linux kernel and other fun stuff. There isn’t a substition server for the nonguix
pacakges so everything will happen using source on your local machine. My MacBook runneth hot.
If you get an error, make sure that the guixbuild users are added to the kvm group. (Edit /etc/group if needed.)
When this is done, you should a path name printed that has the installation image.
|
|
Copy the install image and a linux export to the host machine
Make sure that ssh is installed and copy to your local machine, in my case wschenk@192.168.1.52
. Yours should probably be somewhere else.
|
|
Write the ISO into the USB
And on the host machine, lets put it onto the USB stick. If you are on OSX, Etcher is a nice app for doing this. Otherwise you can use dd
and if it’s in /dev/disk2
|
|
Booting the InterNUC off of the USB key
As documented here:
- At BIOS POST (i.e. when the “Intel NUC” splash screen appears), rapidly press the F2 key over and over until the BIOS Setup (Visual BIOS) display appears.
- Click on Advanced, then Boot and then select the Secure Boot tab.
- Uncheck the Secure Boot option.
- Press F10 and then select Yes to save this change and reboot the system.
The installation
Now you should boot up off of the USB key and have guix running on your system! The root
user doesn’t have a password and neither does the user account defined.
C-Alt-F2
will switch to a console. Log in as root
here (without password), and set the password for your user, in my case passwd wschenk
.
C-Alt-F7
will go back to the Gnome login screen, where you’ll be able to login as your user if you want to use Gnome.
Setting up WiFi
sudo rfkill unblock all
will turn on your network card, which you can figure by going to the Activities
menu and selecting Settings
. You need to enable the interface in order for the Gnome network manager to be able to connect to WiFi. Go to a terminal and ping 1.1.1.1
to see if you can connect to the internet!
To do this in terminal (you can switch with C-Alt-F2
the steps are:
rfkill unblock all
nmcli device wifi
to list out the available SSIDsnmcli device wifi connect HappyFunCorp password mysekretpassword
to actually make the connection.ping 1.1.1.1
to verify that things are working
Preparing the target disk
The easiest way is probably to use cfdisk
or GNOME Disk
to format your target drive. I’m going to walk through using the CLI to do this, but it doesn’t really matter what you use.
First run lsblk
to see which devices are on your system.
|
|
From there we can use fdisk
to create the partitions on, in my case, /dev/nvme0n1
.
n
to create the first partition for with a size of +100M
. I don’t know if this is big or small, but seemed fine.
t
to change the partition type, select 1
for EFI System
.
n
to create another partition for the rest of the disk.
t
to change the partition type, select 20
for Linux Filesystem
w
to write the partition table.
Run sync
just to be safe.
Lets setup the first partition to be formatted as FAT32 and be bootable, and mount it on /boot/efi
|
|
Initialize the file system, which in my case is the 2nd partition, and label it as guix
, and then mount it on /mnt
.
|
|
Edit config.scm
file
You should find the config.scm
file that you built the system with in /etc/config.scm
. If not bring it over from the internet, and edit it to uncomment out the correct bootloader, and specify the right mount point for /boot/efi
so that the kernel will be installed in the right place.
Run guix system init
Finally we are going to build our system onto our target disk! Make sure that the target system is mounted at /mnt
and here we go!
|
|
Depending up on the time between building the USB key image and doing the pull, this will time to some time to build. (The main thing is if the linux kernel version is different.) This builds all of the dependant packages from our operatating-system
definition, and then moves overything over to the filesystem in /mnt
and should update the grub bootloader.
Once this is done you should be able to reboot, remove the USB key, and them boot into your new Guix System installation!
Setup
Once the system is booted, do C-Alt-F2
to get a console, and log in as root. Then give root and your username a password using passwd
.
Turn the wifi on using rfkill unblock all
.
You may want to put the nonguix
channel back into /root/.config/guix/channels.scm
to help with changing things in the future.
Enjoy!
References
- https://www.gnu.org/software/guix/download/
- https://www.gnu.org/software/guix/manual/en/html_node/Binary-Installation.html#Binary-Installation
- https://www.gnu.org/software/guix/manual/en/html_node/Installing-Guix-in-a-VM.html#Installing-Guix-in-a-VM
- https://gitlab.com/nonguix/nonguix/blob/master/README.org
- https://forums.intel.com/s/question/0D50P0000490X0zSAE/image-authorization-fail-system-can-not-boot-to-this-usb-device?language=en_US
- https://lists.gnu.org/archive/html/help-guix/2016-02/msg00046.html
- https://bbs.archlinux.org/viewtopic.php?pid=1324810#p1324810
- https://libreboot.org/docs/gnulinux/guix_system.html
Previously
Next