Hi Guix,

If you forgot to set the file system label for the root file system to the
label you specified in the operating system configuration file then you won't
be able to boot.  Instead you'll end up in a recovery Guile REPL.

Here's what I did when I found myself in this very situation:

--8<---------------cut here---------------start------------->8---
,use (ice-9 ftw)
,use (srfi srfi-1)
,use (gnu build file-systems)

;; Mount the root file system by device handle
(mount-file-system '("/dev/sda1" any "/" "ext4" () #f #f) #:root "/")

;; Oops!  We lost /dev!  Let's find the "mount" tool.
(filter (lambda (f) (string-contains f "util-linux")) (scandir "/gnu/store"))

;; … pick out the directory that looks right

;; Mount /dev
(system* 
"/gnu/store/6z06w9zfnq3zcr50vcv2wvzr5wpzvy7l-util-linux-2.29.2/bin/mount" "-t" 
"devtmpfs" "none" "/dev")

;; Find e2label
(filter (lambda (f) (string-contains f "e2fsprogs")) (scandir "/gnu/store"))

;; … pick out the directory that looks right

;; Use it to change the label on /dev/sda1
(system* 
"/gnu/store/jh49klm0gkns071jsa8f9jr7g3cdlfwz-e2fsprogs-1.43.4/sbin/e2label" 
"/dev/sda1" "my-root")

;; reboot!
--8<---------------cut here---------------end--------------->8---

-- 
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net


Reply via email to