Skip to content

Instantly share code, notes, and snippets.

@jboynyc
Last active October 22, 2019 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jboynyc/ef312a686749de693dddc4f3a657a919 to your computer and use it in GitHub Desktop.
Save jboynyc/ef312a686749de693dddc4f3a657a919 to your computer and use it in GitHub Desktop.

Upgrading Debian 9 to GuixSD on Netcup

Here's a useful reference I kept handy during this process.

Installing guix

After re-initializing the server and changing the disk driver from SCSI to IDE in the control panel, I logged in and ran the following:

# apt update
# apt upgrade
# apt install gnupg2
# wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -
# wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
# sh guix-install.sh
# guix pull
# export PATH="/root/.config/guix/current/bin${PATH:+:}$PATH" 
# hash guix
# guix package -i glibc-locales vim
# cat <<END >>.profile
PATH="/root/.config/guix/current/bin${PATH:+:}$PATH"
GUIX_PROFILE="/root/.guix-profile"
. "$GUIX_PROFILE/etc/profile"
END

I also verified that the guix-daemon was running.

Taking over the system

Here's the disk layout of the Debian system:

# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1 1024M  0 rom  
sda    254:0    0   60G  0 disk 
├─sda1 254:1    0    2M  0 part 
├─sda2 254:2    0    1G  0 part /boot
└─sda3 254:3    0   59G  0 part /

Config file:

(use-modules (gnu)) 
(use-modules (gnu packages linux)) 
(use-modules (gnu services certbot)) 
(use-service-modules networking ssh) 
(use-package-modules admin) 
 
(operating-system 
  (host-name "rakuli") 
  (timezone "Europe/Amsterdam") 
  (locale "en_US.UTF-8") 
  (kernel linux-libre-4.14) 
  (bootloader 
    (bootloader-configuration 
      (bootloader grub-bootloader) 
      (target "/dev/sda"))) 
  (file-systems (append 
                  (list (file-system 
                          (device (uuid "...")) 
                          (mount-point "/") 
                          (type "ext4")) 
                        (file-system 
                          (device (uuid "...") 
                          (mount-point "/boot") 
                          (type "ext4"))) 
                  %base-file-systems)) 
  ;; This is where user accounts are specified.  The "root" 
  ;; account is implicit, and is initially created with the 
  ;; empty password. 
  (users (cons (user-account
                 (name "jboy")
                 (group "users")
                 ;; Adding the account to the "wheel" group
                 ;; makes it a sudoer.
                 (supplementary-groups '("wheel"))
                 (home-directory "/home/jboy"))
               %base-user-accounts))
  ;; Globally-installed packages.
  (packages (cons tcpdump %base-packages))
  (services (append
              (list (service dhcp-client-service-type)
                    (service openssh-service-type
                             (openssh-configuration
                               (permit-root-login 'without-password)
                               (authorized-keys
                                 `(("root" ,(local-file "jboy.pub"))
                                   ("jboy" ,(local-file "jboy.pub"))))))
                    (service certbot-service-type
                             (certbot-configuration
                               (email "jboy+letsencrypt@bius.moe")
                               (certificates
                                 (list
                                   (certificate-configuration
                                     (domains '("rakuli.example"))))))))
              %base-services)))

I added a file jboy.pub with the contents of ~/.ssh/id_edsa.pub from home machine, then I ran:

# guix system build rakuli-config.scm
# guix system init rakuli-config.scm /

Everything looked good, so I ran:

# mv /etc /etc.old
# reboot

Things fall apart

At this point I opened the VNC screen to watch what was going on during reboot. Everything went well and I was even able to log in as root via ssh using my private key.

I then ran guix package -i vim and things started running their course, until suddenly I got this error:

error: executing `/gnu/store/23q7cbgqj7afvmnmrvy8npi26vc72y7f-guix-1.0.1-9.f63e493/bin/guix substitute': No such file or directory
guix package: error: unexpected EOF reading a line

Then everything was seemingly broken. On my VNC session I could see that sshd from /gnu/store could no longer be found ("No such file or directory").

I booted from a recovery disk and mounted /dev/sda3 to find that all files were still, in fact, there. fsck said the device was clean. Running ldd and file on binaries in the /gnu/store didn't turn up anything unusual either.

The IRC channel had a few suggestions that I believe I've exhausted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment