unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: "Jonathan Marsden" <jmarsden@fastmail.fm>
To: help-guix@gnu.org
Subject: Status of Guix System on Raspberry Pi?
Date: Sun, 07 Feb 2021 22:44:08 -0600	[thread overview]
Message-ID: <6d5f1eb3-54e6-4570-822b-e94f444a4235@www.fastmail.com> (raw)

Goal:

I am trying to see how close things are to being able to install and run Guix System on a Raspberry Pi (specifically a 4GB Pi 4).

Background:

Back in 2017 on the help-guix mailing list this was discussed, and the answer then was basically "no but it should become possible in the future".  It is 2021.  Have things changed?  I can't find any recent success stories, asking in r/guix on Reddit did not result in anything definitive, nor did asking on IRC.  Time to try it!

(TL;DR : I didn't succeed 100%, so now I am looking for help and advice with troubleshooting and improving this process!)

Method:

Aiming for an aarch64-linux system, it seemed best to start from a "64bit" ARM8 aarch64 "foreign" Linux and see whether Guix (package manager) would run in that environment.

Then, creating a operating system definition in a .scm file and using guix system image 'should' generate an appropriate image that could be copied to a microSD card or a USB stick from which to boot a Raspberry Pi.

Process:

A. Install "foreign" aarch64 OS

I needed a stable known-working 64bit Linux for the Pi4 as a base "foreign" OS.  I chose Ubuntu Server 20.04 LTS.  Specifically, the image file ubuntu-20.10-preinstalled-server-arm64+raspi.img.xz downloaded from
https://cdimage.ubuntu.com/releases/20.10/release/ubuntu-20.10/ I was unable to find an equivalent Debian image to use.

I used Balena Etcher from https://www.balena.io/etcher to (extract and) copy this image to a new 64GB microSD card.

I booted the Pi4 from this card.

I logged in (ubuntu/ubuntu) and edited the /etc/netplan/50-cloud-init.yaml file to suit my home wifi network and rebooted it.

I updated the "foreign" OS: sudo apt-get update && sudo apt-get upgrade, and then rebooted once more.

B. Install Guix (package manager)

Using the steps in the Guix Reference Manual at https://guix.gnu.org/manual/en/guix.html I installed Guix.

  sudo -i
  cd /tmp
  wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
  chmod +x guix-install.sh 
  ./guix-install.sh 
  wget 'https://sv.gnu.org/people/viewgpg.php?user_id=15145' -qO - | sudo -i gpg --import -
  ./guix-install.sh 

The manual doesn't mention the extra step to grab the PGP key, and it should be updated, but other than that, this worked as it should.  Per the manual, I added glibc-utf8-locales using guix:

  guix install glibc-utf8-locales
  export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
  echo 'export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"' >>/root/.bashrc

C. Create a Guix System image for a Raspberry Pi 4

Using the examples in the Guix Reference Manual and a sample posted by another Reddit user, I created a file base2.scm which (hoepfully!) declares a simple Guix System for the Pi4.  This is enclosed at the end of this email, it has only 33 non-comment non-blank source lines.

I wanted to log what happened, so instead of just doing

  guix pull
  guix package -u
  guix system image bare2.scm

I did:

  time -p script -c "guix pull && guix package -u && guix system image bare2.scm" guix-system-image-$(date +%F-%H%M%S).log

Results:

Over 20 hours later (!), this failed:

build of /gnu/store/64g3sgsbz7pkyrdmsar0a9x7rjh2qnl9-disk-image.drv failed
View build log at '/var/log/guix/drvs/64/g3sgsbz7pkyrdmsar0a9x7rjh2qnl9-disk-image.drv.bz2'.
guix system: error: build of `/gnu/store/64g3sgsbz7pkyrdmsar0a9x7rjh2qnl9-disk-image.drv' failed

Investigating:

  cp -p /var/log/guix/drvs/64/g3sgsbz7pkyrdmsar0a9x7rjh2qnl9-disk-image.drv.bz2 .
  bunzip2 *drv.bz2

I see:

  /gnu/store/m38272iq1p0fq5rrvylx46cqambvv0cs-genimage.cfg:14: no sub-section title/index for 'config'
  INFO: cmd: "mkdir -p "/tmp/guix-build-disk-image.drv-0/tmp"" (stderr):
  INFO: cmd: "rm -rf "/tmp/guix-build-disk-image.drv-0/tmp"/*" (stderr):
  INFO: cmd: "mkdir -p "/tmp/guix-build-disk-image.drv-0/tmp"" (stderr):
  INFO: cmd: "cp -a "/tmp/guix-build-disk-image.drv-0/root" "/tmp/guix-build-disk-image.drv-0/tmp/root"" (stderr):
  INFO: cmd: "find '/tmp/guix-build-disk-image.drv-0/tmp/root' -depth -type d -printf '%P\0' | xargs -0 -I {} touch -r '/tmp/guix-build-disk-image.drv-0/root/{}' '/tmp/guix-build-disk-image.drv-0/tmp/root/{}'" (stderr):
  INFO: cmd: "mkdir -p "/tmp/guix-build-disk-image.drv-0/images"" (stderr):
  INFO: hdimage(image): adding partition 'GNU-ESP' (in MBR) from '/gnu/store/rizvjsgw89i1rvcqa78wcgq89qy36jma-partition.img' ...
  INFO: hdimage(image): adding partition 'Guix_image' (in MBR) from '/gnu/store/rqi121qpvnzp683ahf86mxxr5n4ans4i-partition.img' ...
  INFO: hdimage(image): writing MBR
  Backtrace:
	     2 (primitive-load "/gnu/store/mi91lnghvz6jsiqcfr01fv5ns8q?")
  In ice-9/eval.scm:
      619:8  1 (_ #(#<directory (guile-user) fffff5c9df00> ("/gn?" ?) ?))
  In ice-9/boot-9.scm:
     1991:7  0 (error _ . _)

  ice-9/boot-9.scm:1991:7: In procedure error:
  Failed to install U-Boot
  environment variable `PATH' set to `/gnu/store/pq7pspmz99y6jsdvl4rgfisq782b4hzn-genimage-11/bin:/gnu/store/sspkzm2dkw920068nvgr7nwv6b98zkxv-coreutils-8.32/bin:/gnu/store/jybfpdxpmm3jm2lajx8z661699276ifp-findutils-4.7.0/bin:/gnu/store/l4nwpbn90f47xyv0b9y9jngrdfpfh4bv-qemu-minimal-5.1.0/bin'

I can pastebin the typescript log (or parts of it), if that would be useful.

Tentative Conclusions:

Leaving aside that the Pi4 has proprietary boot firmware, since I can't change that, I seem to be "nearly" at the point of having an image to copy and test.

I suspect that "no sub-section title/index for 'config'" means that I need to specify some further configuration info in the .scm file so this image generation knows what to do.  Searching online for that error message did not yield any relevant results at all.

Next Steps:

How can I proceed from here?  Is anyone else in the Guix community attempting to get Guix system onto a Raspberry Pi4?  Can someone with a lot more U-Boot and SBC porting experience than I have provide some insight and suggestions?

----

;; This is an operating system configuration template
;; for a "bare bones" Guix system, with no X11 display server, on Raspberry Pi 4.

(use-modules (gnu)
             (gnu packages bootloaders)
             (gnu bootloader u-boot))

(use-service-modules networking ssh)
(use-package-modules ssh)

(define u-boot-rpi
  (make-u-boot-package "rpi_4" "aarch64-linux-gnu"))

(define u-boot-rpi-bootloader
  (bootloader
   (inherit u-boot-bootloader)
   (package u-boot-rpi)))

(operating-system
  (host-name "jmguixbare")
  (timezone "America/Chicago")
  (locale "en_US.utf8")

  ;; Boot using U-Boot for Raspberry Pi
  (bootloader
   (bootloader-configuration
    (bootloader u-boot-rpi-bootloader)
    (target "/dev/mmcblk0")))

  (file-systems (cons (file-system
                        (device (file-system-label "my-root"))
                        (mount-point "/")
                        (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 "pi")
                (comment "Raspberry Pi")
                (group "users")

                ;; Adding the account to the "wheel" group
                ;; makes it a sudoer.  Adding it to "audio"
                ;; and "video" allows the user to play sound
                ;; and access the webcam.
                (supplementary-groups '("wheel"
                                        "audio" "video"
					"lp" "netdev" "input" "cdrom")))
               %base-user-accounts))
)


-- 
  Jonathan Marsden
  jmarsden@fastmail.fm


                 reply	other threads:[~2021-02-08 19:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6d5f1eb3-54e6-4570-822b-e94f444a4235@www.fastmail.com \
    --to=jmarsden@fastmail.fm \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).