unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Oleg Pykhalov <go.wigust@gmail.com>
To: Mathieu <matf@disr.it>
Cc: 67218@debbugs.gnu.org
Subject: bug#67218: Reconfiguring from chroot to fix Grub/boot partition fails because D-bus crashes
Date: Fri, 17 Nov 2023 07:38:17 +0300	[thread overview]
Message-ID: <87r0kpyoxy.fsf@gmail.com> (raw)
In-Reply-To: <abe726fe-4ad0-4717-9dde-b291ef251180@disroot.org> (Mathieu's message of "Thu, 16 Nov 2023 01:30:51 +0100")


[-- Attachment #1.1: Type: text/plain, Size: 2033 bytes --]

Hi Mathieu,

Mathieu <matf@disr.it> writes:

> Dear Guix users,
>
> For some reason, still to be understood, my EFI partition is no longer
> detected at boot and I cannot boot my existing Guix System. I could confirm
> that the Guix partition (encrypted) is fine, but my BIOS won't detect any
> bootable partition. Turns out my `/dev/nvme0n1p1` partition only contains a
> single file: `EFI/Guix/grubx64.efi`.

It could be broken 'nvram' of a motherboard. Because of that happened to
me on a single UEFI motherboard, personally I try not to use it at all,
but use all available disks instead.

With current Guix I'm not sure it is supported by the distribution. If
anyone would like to implement it in the upstream, here is my
configuration which I use [1] hopefully 'nvram' is not touched at all on
'guix system reconfigure' and survive a disk failure.

[…]

> This looks like a bug since I did everything the guide indicates. Can anyone
> reproduce it and confirm that chrooting into an existing Guix installation to
> reconfigure and rescue the system does not work? Is there something missing in
> the how-to to prevent the D-bus crash? Would there be another way to save my
> system, i.e., reinstalling Guix from scratch on another SSD and then `dd` the
> LUKS partition from the broken SSD onto the root partition of the new one?

I could recommend to delete everything not required for a boot from the
configuration file and try to reconfigure again (warning that you will
probably get permission errors after adding those services again which
will require to 'chown' their state directories).

Another way to recover is reinstalling Guix from scratch, but it's
possible to do this without reformating or using another drive. Just
move every directory in your '/' to '/old-system' and proced regular
installation.


[1]: guix 1f734a6
       repository URL: https://git.savannah.gnu.org/git/guix.git
       branch: master
       commit: 1f734a6f0a7db5b0e12091a0c869c5c4810ac80e


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: grub uefi without nvram --]
[-- Type: text/x-scheme, Size: 1648 bytes --]

(define-module (bootloader grub)
  #:use-module (gnu bootloader)
  #:use-module (gnu bootloader grub)
  #:use-module (guix gexp)
  #:export (grub-efi-bootloader-removable))

(define install-grub-efi-removable
  #~(lambda (bootloader efi-dir mount-point)
      ;; There is nothing useful to do when called in the context of a disk
      ;; image generation.
      (when efi-dir
        ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the
        ;; system whose root is mounted at MOUNT-POINT.
        (let ((grub-install (string-append bootloader "/sbin/grub-install"))
              (install-dir (string-append mount-point "/boot"))
              ;; When installing Guix, it's common to mount EFI-DIR below
              ;; MOUNT-POINT rather than /boot/efi on the live image.
              (target-esp (if (file-exists? (string-append mount-point efi-dir))
                              (string-append mount-point efi-dir)
                              efi-dir)))
          ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
          ;; root partition.
          (setenv "GRUB_ENABLE_CRYPTODISK" "y")
          (invoke/quiet grub-install
                        "--boot-directory" install-dir
                        "--efi-directory" target-esp

                        ;; do not write to nvram on the motherboard
                        "--no-nvram"
                        "--target=x86_64-efi"
                        "--removable")))))

(define grub-efi-bootloader-removable
  (bootloader
   (inherit grub-efi-bootloader)
   (name 'grub-efi-bootloader-removable)
   (installer install-grub-efi-removable)))

[-- Attachment #1.3: Type: text/plain, Size: 2977 bytes --]


config.scm:
--8<---------------cut here---------------start------------->8---
(operating-system
  ;; ...
  (bootloader (bootloader-configuration
                 (bootloader grub-efi-bootloader-removable)
                 (targets '("/boot1/efi"
                            "/boot2/efi"
                            "/boot3/efi"))))
  (file-systems (cons* (file-system
                         (device (file-system-label "boot1"))
                         (mount-point "/boot1/efi")
                         (type "vfat"))
                       (file-system
                         (device (file-system-label "boot2"))
                         (mount-point "/boot2/efi")
                         (type "vfat"))
                       (file-system
                         (device (file-system-label "boot3"))
                         (mount-point "/boot3/efi")
                         (type "vfat"))
                       ;; ...
                       %base-file-systems)))
--8<---------------cut here---------------end--------------->8---

/boot?/efi current state:
--8<---------------cut here---------------start------------->8---
oleg@guixsd ~$ find /boot?/efi -type f -exec ls -l {} \;
-rwxr-xr-x 1 root root 159744 May  8  2022 /boot1/efi/EFI/Guix/grubx64.efi
-rwxr-xr-x 1 root root 159744 Nov 16 04:28 /boot1/efi/EFI/BOOT/BOOTX64.EFI
-rwxr-xr-x 1 root root 159744 Mar 17  2022 /boot2/efi/EFI/Guix/grubx64.efi
-rwxr-xr-x 1 root root 159744 Nov 16 04:28 /boot2/efi/EFI/BOOT/BOOTX64.EFI
-rwxr-xr-x 1 root root 76 Feb  9  2020 '/boot2/efi/System Volume Information/IndexerVolumeGuid'
-rwxr-xr-x 1 root root 12 Feb  9  2020 '/boot2/efi/System Volume Information/WPSettings.dat'
-rwxr-xr-x 1 root root 129 Feb  9  2020 '/boot2/efi/$RECYCLE.BIN/desktop.ini'
-rwxr-xr-x 1 root root 159744 Nov 16 04:28 /boot3/efi/EFI/BOOT/BOOTX64.EFI
--8<---------------cut here---------------end--------------->8---

as you can see /boot?/efi/EFI/BOOT/BOOTX64.EFI is the thing needed for
boot, everything else probably a garbage.

mount points:
--8<---------------cut here---------------start------------->8---
oleg@guixsd ~$ findmnt  | grep efi
│ ├─/sys/firmware/efi/efivars   efivarfs                  efivarfs   rw,relatime
├─/boot1/efi                    /dev/sdc1                 vfat       rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
├─/boot2/efi                    /dev/sda1                 vfat       rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
├─/boot3/efi                    /dev/sdd1                 vfat       rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
--8<---------------cut here---------------end--------------->8---

'/boot/grub' is not configured anywhere, but it's placed on a '/' mount
point which mounted from a raid disk array.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

      reply	other threads:[~2023-11-17  4:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16  0:30 bug#67218: Reconfiguring from chroot to fix Grub/boot partition fails because D-bus crashes Mathieu
2023-11-17  4:38 ` Oleg Pykhalov [this message]

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=87r0kpyoxy.fsf@gmail.com \
    --to=go.wigust@gmail.com \
    --cc=67218@debbugs.gnu.org \
    --cc=matf@disr.it \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).