Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure

  • Done
  • quality assurance status badge
Details
4 participants
  • Bengt Richter
  • Ludovic Courtès
  • Mathieu Othacehe
  • Vagrant Cascadian
Owner
unassigned
Submitted by
Vagrant Cascadian
Severity
important
V
V
Vagrant Cascadian wrote on 20 Oct 2020 19:06
(address . bug-guix@gnu.org)(name . Mathieu Othacehe)(address . othacehe@gnu.org)
87a6wgrfnp.fsf@ponder
It appears that:

b97b423e3f61c80d5877dadc95b3f316cd61788f bootloader: Fix u-boot
installation.

Breaks using a /dev/disk/by-id/ symlink in the bootloader target field
on systems using u-boot with "guix system reconfigure".

Frustratingly, It claims to succeed with bootloader installation, but
does not actually install u-boot to the device... when updating to the
new version of u-boot, I had to manually install the new version.


Using a raw device (e.g. /dev/mmcblk1) still works, but those devices
are not necessarily enumerated in a consistent order and so cannot be
used in a config.scm with guix system reliably.


Reverting that patch fixes using the /dev/disk symlink, though probably
breaks other use-cases.


I'm writing this from memory now, but I can also boot the machines at a
later point and get the exact configurations, if needed.


live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCX48Y+wAKCRDcUY/If5cW
qtNLAQCYaVNki1OZtsAZDo0WOronbeuMOVjnxz9rwR/tCQJ1+QEAjkikEqx8jo4Y
s+eCyk2mrF0SQuDbhPn2meYnVlSG6wY=
=4VkK
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 21 Oct 2020 15:04
control message for bug #44101
(address . control@debbugs.gnu.org)
87ft674tnd.fsf@gnu.org
severity 44101 important
quit
M
M
Mathieu Othacehe wrote on 22 Oct 2020 09:58
Re: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . bug-guix@gnu.org)
87zh4ezo7k.fsf@gnu.org
Hey Vagrant,

Toggle quote (3 lines)
> I'm writing this from memory now, but I can also boot the machines at a
> later point and get the exact configurations, if needed.

Sorry for breaking your use-case. Recently I have split up the
bootloader installation in two distinct parts:

- Installing a bootloader directly on a mounted directory.
- Installing a bootloader on a raw-image or device.

Depending on the bootloader type, one or both of the methods are
supported. u-boot does not really support the first method, so the
patch you are mentioning is disabling this method.

The problem is while reconfiguring, the first method only is used. The
attached patch tries to fallback to the second method if the first one
is not defined.

WDYT?

Thanks,

Mathieu
From 7fd5fb804317df5af5e14a6a95179acb3c8ac598 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <othacehe@gnu.org>
Date: Wed, 21 Oct 2020 10:42:50 +0200
Subject: [PATCH] system: reconfigure: Use the disk-installer if provided.

---
gnu/tests/reconfigure.scm | 4 +++-
guix/scripts/system/reconfigure.scm | 12 +++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)

Toggle diff (61 lines)
diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm
index 928a210a94..52beeef447 100644
--- a/gnu/tests/reconfigure.scm
+++ b/gnu/tests/reconfigure.scm
@@ -260,7 +260,9 @@ bootloader's configuration file."
;; test suite, the bootloader installer script is omitted. 'grub-install'
;; would attempt to write directly to the virtual disk if the
;; installation script were run.
- (test (install-bootloader-program #f #f bootcfg bootcfg-file #f "/")))))
+ (test
+ (install-bootloader-program #f #f #f bootcfg bootcfg-file #f "/")))))
+
(define %test-switch-to-system
(system-test
diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm
index d89caf80fc..b1982b20d2 100644
--- a/guix/scripts/system/reconfigure.scm
+++ b/guix/scripts/system/reconfigure.scm
@@ -204,7 +204,8 @@ services as defined by OS."
;;; Bootloader configuration.
;;;
-(define (install-bootloader-program installer bootloader-package bootcfg
+(define (install-bootloader-program installer disk-installer
+ bootloader-package bootcfg
bootcfg-file device target)
"Return an executable store item that, upon being evaluated, will install
BOOTCFG to BOOTCFG-FILE, a target file name, on DEVICE, a file system device,
@@ -246,10 +247,12 @@ BOOTLOADER-PACKAGE."
;; a broken installation.
(switch-symlinks new-gc-root #$bootcfg)
(install-boot-config #$bootcfg #$bootcfg-file #$target)
- (when #$installer
+ (when (or #$installer #$disk-installer)
(catch #t
(lambda ()
- (#$installer #$bootloader-package #$device #$target))
+ (if #$installer
+ (#$installer #$bootloader-package #$device #$target)
+ (#$disk-installer #$bootloader-package 0 #$device)))
(lambda args
(delete-file new-gc-root)
(match args
@@ -272,11 +275,14 @@ additional configurations specified by MENU-ENTRIES can be selected."
(let* ((bootloader (bootloader-configuration-bootloader configuration))
(installer (and run-installer?
(bootloader-installer bootloader)))
+ (disk-installer (and run-installer?
+ (bootloader-disk-image-installer bootloader)))
(package (bootloader-package bootloader))
(device (bootloader-configuration-target configuration))
(bootcfg-file (bootloader-configuration-file bootloader)))
(eval #~(parameterize ((current-warning-port (%make-void-port "w")))
(primitive-load #$(install-bootloader-program installer
+ disk-installer
package
bootcfg
bootcfg-file
--
2.28.0
V
V
Vagrant Cascadian wrote on 22 Oct 2020 22:08
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 44101@debbugs.gnu.org)
87k0vi9g6q.fsf@ponder
On 2020-10-22, Mathieu Othacehe wrote:
Toggle quote (8 lines)
> Hey Vagrant,
>
>> I'm writing this from memory now, but I can also boot the machines at a
>> later point and get the exact configurations, if needed.
>
> Sorry for breaking your use-case. Recently I have split up the
> bootloader installation in two distinct parts:

Thanks for your work on it, even if it resulted in a regression. :)


Toggle quote (11 lines)
> - Installing a bootloader directly on a mounted directory.
> - Installing a bootloader on a raw-image or device.
>
> Depending on the bootloader type, one or both of the methods are
> supported. u-boot does not really support the first method, so the
> patch you are mentioning is disabling this method.
>
> The problem is while reconfiguring, the first method only is used. The
> attached patch tries to fallback to the second method if the first one
> is not defined.

I don't quite understand why that would be the issue here; guix system
reconfigure works fine when /dev/mmcblkN is specified target in the
system config.scm, just not when the target is /dev/disk/by-id/...

My wild guess was something was checking for a literal block device, and
failing with a symlink pointing to a block device.


Trying your patch gets me a backtrace, unfortunately...

With the bootloader section...

(bootloader (bootloader-configuration
(target "/dev/disk/by-id/mmc-SDU64_0xbaf3002e")
(bootloader u-boot-pinebook-bootloader)
))

And your patch applied on top of 3e09453884efa82ef97b8ec6e34470c67a1206a7...

$ sudo -E ./pre-inst-env guix system reconfigure --keep-going ~/pinebook-1080p-desktop.scm
...
waiting for locks or build slots...
building /gnu/store/n17lkvs6vhq0x16mk0rxnv4j5ifvrlyr-switch-to-system.scm.drv...
making '/gnu/store/vc3bzajlv0yxrdjmqph4sikzqkywvfq1-system' the current system...
setting up setuid programs in '/run/setuid-programs'...
populating /etc from /gnu/store/gssnxbhwa9dygn1i6i46j81ww5gczzav-etc...
The following derivation will be built:
/gnu/store/s19y61jrdys760zccxm2qiiqjpcv1fcx-install-bootloader.scm.drv

building /gnu/store/s19y61jrdys760zccxm2qiiqjpcv1fcx-install-bootloader.scm.drv...
Backtrace:
In guix/scripts/system.scm:
1339:8 19 (_)
In guix/status.scm:
776:4 18 (call-with-status-report _ _)
In guix/scripts/system.scm:
1172:4 17 (_)
In ice-9/boot-9.scm:
1736:10 16 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
631:37 15 (thunk)
1300:8 14 (call-with-build-handler _ _)
1300:8 13 (call-with-build-handler _ _)
1300:8 12 (call-with-build-handler _ _)
1300:8 11 (call-with-build-handler _ _)
1300:8 10 (call-with-build-handler _ _)
1300:8 9 (call-with-build-handler #<procedure ffff658a29f0 at g…> …)
2042:24 8 (run-with-store #<store-connection 256.99 ffff67755d70> …)
In guix/scripts/system.scm:
842:13 7 (_ _)
844:15 6 (_ _)
750:13 5 (_ _)
In ice-9/boot-9.scm:
152:2 4 (with-fluid* _ _ _)
In unknown file:
3 (primitive-load "/gnu/store/81w2h9zd6b5q0ddchc0wr6vph22…")
In ice-9/eval.scm:
619:8 2 (_ #(#(#<directory (guile-user) ffff7c2c4f00> "//v…") #))
In ice-9/boot-9.scm:
1669:16 1 (raise-exception _ #:continuable? _)
1669:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1669:16: In procedure raise-exception:
ERROR:
1. &i/o-filename: "/dev/disk/by-id/mmc-SDU64_0xbaf3002e"


It also fails when target is /dev/mmcblk1.

So, clearly this is some other issue...


live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCX5HmzwAKCRDcUY/If5cW
qiOzAQDdEVhHzTBXIfAZz+SZ2SbSxwaBuLWwX+LygW6xGZQQugEAu0YT5nNddiq+
yG75SXiFsm6GsBHjreSmX8NHnOK9AAE=
=72AU
-----END PGP SIGNATURE-----

B
B
Bengt Richter wrote on 23 Oct 2020 01:12
Re: bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
(name . Vagrant Cascadian)(address . vagrant@debian.org)
20201022231202.GA2497@LionPure
Hi,

On +2020-10-22 13:08:45 -0700, Vagrant Cascadian wrote:
Toggle quote (31 lines)
> On 2020-10-22, Mathieu Othacehe wrote:
> > Hey Vagrant,
> >
> >> I'm writing this from memory now, but I can also boot the machines at a
> >> later point and get the exact configurations, if needed.
> >
> > Sorry for breaking your use-case. Recently I have split up the
> > bootloader installation in two distinct parts:
>
> Thanks for your work on it, even if it resulted in a regression. :)
>
>
> > - Installing a bootloader directly on a mounted directory.
> > - Installing a bootloader on a raw-image or device.
> >
> > Depending on the bootloader type, one or both of the methods are
> > supported. u-boot does not really support the first method, so the
> > patch you are mentioning is disabling this method.
> >
> > The problem is while reconfiguring, the first method only is used. The
> > attached patch tries to fallback to the second method if the first one
> > is not defined.
>
> I don't quite understand why that would be the issue here; guix system
> reconfigure works fine when /dev/mmcblkN is specified target in the
> system config.scm, just not when the target is /dev/disk/by-id/...
>
> My wild guess was something was checking for a literal block device, and
> failing with a symlink pointing to a block device.
>

IIUC [1] implies the contents of /dev/disk/by-id is populated on udev events, so IIRC
the values can be stale. Maybe that's an eliminated race by now, or a clue about old systems?

Toggle quote (69 lines)
>
> Trying your patch gets me a backtrace, unfortunately...
>
> With the bootloader section...
>
> (bootloader (bootloader-configuration
> (target "/dev/disk/by-id/mmc-SDU64_0xbaf3002e")
> (bootloader u-boot-pinebook-bootloader)
> ))
>
> And your patch applied on top of 3e09453884efa82ef97b8ec6e34470c67a1206a7...
>
> $ sudo -E ./pre-inst-env guix system reconfigure --keep-going ~/pinebook-1080p-desktop.scm
> ...
> waiting for locks or build slots...
> building /gnu/store/n17lkvs6vhq0x16mk0rxnv4j5ifvrlyr-switch-to-system.scm.drv...
> making '/gnu/store/vc3bzajlv0yxrdjmqph4sikzqkywvfq1-system' the current system...
> setting up setuid programs in '/run/setuid-programs'...
> populating /etc from /gnu/store/gssnxbhwa9dygn1i6i46j81ww5gczzav-etc...
> The following derivation will be built:
> /gnu/store/s19y61jrdys760zccxm2qiiqjpcv1fcx-install-bootloader.scm.drv
>
> building /gnu/store/s19y61jrdys760zccxm2qiiqjpcv1fcx-install-bootloader.scm.drv...
> Backtrace:
> In guix/scripts/system.scm:
> 1339:8 19 (_)
> In guix/status.scm:
> 776:4 18 (call-with-status-report _ _)
> In guix/scripts/system.scm:
> 1172:4 17 (_)
> In ice-9/boot-9.scm:
> 1736:10 16 (with-exception-handler _ _ #:unwind? _ # _)
> In guix/store.scm:
> 631:37 15 (thunk)
> 1300:8 14 (call-with-build-handler _ _)
> 1300:8 13 (call-with-build-handler _ _)
> 1300:8 12 (call-with-build-handler _ _)
> 1300:8 11 (call-with-build-handler _ _)
> 1300:8 10 (call-with-build-handler _ _)
> 1300:8 9 (call-with-build-handler #<procedure ffff658a29f0 at g…> …)
> 2042:24 8 (run-with-store #<store-connection 256.99 ffff67755d70> …)
> In guix/scripts/system.scm:
> 842:13 7 (_ _)
> 844:15 6 (_ _)
> 750:13 5 (_ _)
> In ice-9/boot-9.scm:
> 152:2 4 (with-fluid* _ _ _)
> In unknown file:
> 3 (primitive-load "/gnu/store/81w2h9zd6b5q0ddchc0wr6vph22…")
> In ice-9/eval.scm:
> 619:8 2 (_ #(#(#<directory (guile-user) ffff7c2c4f00> "//v…") #))
> In ice-9/boot-9.scm:
> 1669:16 1 (raise-exception _ #:continuable? _)
> 1669:16 0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> ERROR:
> 1. &i/o-filename: "/dev/disk/by-id/mmc-SDU64_0xbaf3002e"
>
>
> It also fails when target is /dev/mmcblk1.
>
> So, clearly this is some other issue...
>
>
> live well,
> vagrant


HTH, otherwise sorry for the noise :)

--
Regards,
Bengt Richter
M
M
Mathieu Othacehe wrote on 23 Oct 2020 10:13
Re: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 44101@debbugs.gnu.org)
875z71jr61.fsf@gnu.org
Hello,

Toggle quote (4 lines)
> I don't quite understand why that would be the issue here; guix system
> reconfigure works fine when /dev/mmcblkN is specified target in the
> system config.scm, just not when the target is /dev/disk/by-id/...

I don't think it works fine with /dev/mmcblkN. I think the bootloader
configuration file is installed in /boot/extlinux/extlinux.conf when
using /dev/mmcblkN or /dev/disk/, but the bootloader itself is actually
never installed.

Toggle quote (4 lines)
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
> ERROR:
> 1. &i/o-filename: "/dev/disk/by-id/mmc-SDU64_0xbaf3002e"

Thanks for testing. This is probably a regression in
"write-file-on-device" that fails to open this kind of files. I'll try
to reproduce it locally.

Thanks,

Mathieu
M
M
Mathieu Othacehe wrote on 23 Oct 2020 10:44
Re: bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 44101@debbugs.gnu.org)
87y2jxib6n.fsf@gnu.org
Hello,

Toggle quote (8 lines)
>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>> ERROR:
>> 1. &i/o-filename: "/dev/disk/by-id/mmc-SDU64_0xbaf3002e"
>
> Thanks for testing. This is probably a regression in
> "write-file-on-device" that fails to open this kind of files. I'll try
> to reproduce it locally.

This is because the O_EXCL flag was passed, which causes open to fail if
the block device is mounted.

The revised patch attached should fix it.

Thanks,

Mathieu
From 780327ebb0db74ca4cc43d26ba7cf945d64c7d30 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <othacehe@gnu.org>
Date: Wed, 21 Oct 2020 10:42:50 +0200
Subject: [PATCH] system: reconfigure: Use the disk-installer if provided.

---
gnu/build/bootloader.scm | 4 ++--
gnu/tests/reconfigure.scm | 4 +++-
guix/scripts/system/reconfigure.scm | 12 +++++++++---
3 files changed, 14 insertions(+), 6 deletions(-)

Toggle diff (77 lines)
diff --git a/gnu/build/bootloader.scm b/gnu/build/bootloader.scm
index 5ec839f902..06a2c3ab76 100644
--- a/gnu/build/bootloader.scm
+++ b/gnu/build/bootloader.scm
@@ -39,9 +39,9 @@
(let ((bv (get-bytevector-n input size)))
(call-with-port
(open-file-output-port device
- (file-options no-truncate no-create)
+ (file-options no-truncate no-fail)
(buffer-mode block)
- (native-transcoder))
+ (make-transcoder (latin-1-codec)))
(lambda (output)
(seek output offset SEEK_SET)
(put-bytevector output bv)))))))
diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm
index 928a210a94..52beeef447 100644
--- a/gnu/tests/reconfigure.scm
+++ b/gnu/tests/reconfigure.scm
@@ -260,7 +260,9 @@ bootloader's configuration file."
;; test suite, the bootloader installer script is omitted. 'grub-install'
;; would attempt to write directly to the virtual disk if the
;; installation script were run.
- (test (install-bootloader-program #f #f bootcfg bootcfg-file #f "/")))))
+ (test
+ (install-bootloader-program #f #f #f bootcfg bootcfg-file #f "/")))))
+
(define %test-switch-to-system
(system-test
diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm
index d89caf80fc..b1982b20d2 100644
--- a/guix/scripts/system/reconfigure.scm
+++ b/guix/scripts/system/reconfigure.scm
@@ -204,7 +204,8 @@ services as defined by OS."
;;; Bootloader configuration.
;;;
-(define (install-bootloader-program installer bootloader-package bootcfg
+(define (install-bootloader-program installer disk-installer
+ bootloader-package bootcfg
bootcfg-file device target)
"Return an executable store item that, upon being evaluated, will install
BOOTCFG to BOOTCFG-FILE, a target file name, on DEVICE, a file system device,
@@ -246,10 +247,12 @@ BOOTLOADER-PACKAGE."
;; a broken installation.
(switch-symlinks new-gc-root #$bootcfg)
(install-boot-config #$bootcfg #$bootcfg-file #$target)
- (when #$installer
+ (when (or #$installer #$disk-installer)
(catch #t
(lambda ()
- (#$installer #$bootloader-package #$device #$target))
+ (if #$installer
+ (#$installer #$bootloader-package #$device #$target)
+ (#$disk-installer #$bootloader-package 0 #$device)))
(lambda args
(delete-file new-gc-root)
(match args
@@ -272,11 +275,14 @@ additional configurations specified by MENU-ENTRIES can be selected."
(let* ((bootloader (bootloader-configuration-bootloader configuration))
(installer (and run-installer?
(bootloader-installer bootloader)))
+ (disk-installer (and run-installer?
+ (bootloader-disk-image-installer bootloader)))
(package (bootloader-package bootloader))
(device (bootloader-configuration-target configuration))
(bootcfg-file (bootloader-configuration-file bootloader)))
(eval #~(parameterize ((current-warning-port (%make-void-port "w")))
(primitive-load #$(install-bootloader-program installer
+ disk-installer
package
bootcfg
bootcfg-file
--
2.28.0
V
V
Vagrant Cascadian wrote on 23 Oct 2020 17:14
Re: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 44101@debbugs.gnu.org)
87ft65t1n6.fsf@ponder
On 2020-10-23, Mathieu Othacehe wrote:
Toggle quote (9 lines)
>> I don't quite understand why that would be the issue here; guix system
>> reconfigure works fine when /dev/mmcblkN is specified target in the
>> system config.scm, just not when the target is /dev/disk/by-id/...
>
> I don't think it works fine with /dev/mmcblkN. I think the bootloader
> configuration file is installed in /boot/extlinux/extlinux.conf when
> using /dev/mmcblkN or /dev/disk/, but the bootloader itself is actually
> never installed.

That does not match the behavior I observed; it definitely successfully
installs the bootloader when passing the raw device rather than a
symlink. Which I can only think of a small number of conditions that
would trigger that sort of behavior...

I'm fairly confident in this because I've been experimenting with two
incompatible u-boot bootloaders on the same boot media (one for
pinebook, and one for pinebook pro) and a successful installation
overwrites the bootloader, resulting in the expected machine booting,
and the other machine not booting. With a symlink it doesn't install to
the raw device at all...

That said, I'll move on to testing your next patch. :)


live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCX5LzbwAKCRDcUY/If5cW
qhFzAP9584ajRl0cA8xYDHOB8Z+2b9c2curDnEfnGNcP2O07qQEA+70HFDHKN3qm
KOIb9reADaeFkIIRxYGdoV3jMhUlGwA=
=6hT6
-----END PGP SIGNATURE-----

V
V
Vagrant Cascadian wrote on 24 Oct 2020 03:40
Re: bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 44101@debbugs.gnu.org)
875z70mmdx.fsf@ponder
On 2020-10-23, Mathieu Othacehe wrote:
Toggle quote (13 lines)
>>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>>> ERROR:
>>> 1. &i/o-filename: "/dev/disk/by-id/mmc-SDU64_0xbaf3002e"
>>
>> Thanks for testing. This is probably a regression in
>> "write-file-on-device" that fails to open this kind of files. I'll try
>> to reproduce it locally.
>
> This is because the O_EXCL flag was passed, which causes open to fail if
> the block device is mounted.
>
> The revised patch attached should fix it.

Yes, this patch fixes the issue for me.

Thanks!

live well,
vagrant

Toggle quote (88 lines)
> From 780327ebb0db74ca4cc43d26ba7cf945d64c7d30 Mon Sep 17 00:00:00 2001
> From: Mathieu Othacehe <othacehe@gnu.org>
> Date: Wed, 21 Oct 2020 10:42:50 +0200
> Subject: [PATCH] system: reconfigure: Use the disk-installer if provided.
>
> ---
> gnu/build/bootloader.scm | 4 ++--
> gnu/tests/reconfigure.scm | 4 +++-
> guix/scripts/system/reconfigure.scm | 12 +++++++++---
> 3 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/gnu/build/bootloader.scm b/gnu/build/bootloader.scm
> index 5ec839f902..06a2c3ab76 100644
> --- a/gnu/build/bootloader.scm
> +++ b/gnu/build/bootloader.scm
> @@ -39,9 +39,9 @@
> (let ((bv (get-bytevector-n input size)))
> (call-with-port
> (open-file-output-port device
> - (file-options no-truncate no-create)
> + (file-options no-truncate no-fail)
> (buffer-mode block)
> - (native-transcoder))
> + (make-transcoder (latin-1-codec)))
> (lambda (output)
> (seek output offset SEEK_SET)
> (put-bytevector output bv)))))))
> diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm
> index 928a210a94..52beeef447 100644
> --- a/gnu/tests/reconfigure.scm
> +++ b/gnu/tests/reconfigure.scm
> @@ -260,7 +260,9 @@ bootloader's configuration file."
> ;; test suite, the bootloader installer script is omitted. 'grub-install'
> ;; would attempt to write directly to the virtual disk if the
> ;; installation script were run.
> - (test (install-bootloader-program #f #f bootcfg bootcfg-file #f "/")))))
> + (test
> + (install-bootloader-program #f #f #f bootcfg bootcfg-file #f "/")))))
> +
>
> (define %test-switch-to-system
> (system-test
> diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm
> index d89caf80fc..b1982b20d2 100644
> --- a/guix/scripts/system/reconfigure.scm
> +++ b/guix/scripts/system/reconfigure.scm
> @@ -204,7 +204,8 @@ services as defined by OS."
> ;;; Bootloader configuration.
> ;;;
>
> -(define (install-bootloader-program installer bootloader-package bootcfg
> +(define (install-bootloader-program installer disk-installer
> + bootloader-package bootcfg
> bootcfg-file device target)
> "Return an executable store item that, upon being evaluated, will install
> BOOTCFG to BOOTCFG-FILE, a target file name, on DEVICE, a file system device,
> @@ -246,10 +247,12 @@ BOOTLOADER-PACKAGE."
> ;; a broken installation.
> (switch-symlinks new-gc-root #$bootcfg)
> (install-boot-config #$bootcfg #$bootcfg-file #$target)
> - (when #$installer
> + (when (or #$installer #$disk-installer)
> (catch #t
> (lambda ()
> - (#$installer #$bootloader-package #$device #$target))
> + (if #$installer
> + (#$installer #$bootloader-package #$device #$target)
> + (#$disk-installer #$bootloader-package 0 #$device)))
> (lambda args
> (delete-file new-gc-root)
> (match args
> @@ -272,11 +275,14 @@ additional configurations specified by MENU-ENTRIES can be selected."
> (let* ((bootloader (bootloader-configuration-bootloader configuration))
> (installer (and run-installer?
> (bootloader-installer bootloader)))
> + (disk-installer (and run-installer?
> + (bootloader-disk-image-installer bootloader)))
> (package (bootloader-package bootloader))
> (device (bootloader-configuration-target configuration))
> (bootcfg-file (bootloader-configuration-file bootloader)))
> (eval #~(parameterize ((current-warning-port (%make-void-port "w")))
> (primitive-load #$(install-bootloader-program installer
> + disk-installer
> package
> bootcfg
> bootcfg-file
> --
> 2.28.0
-----BEGIN PGP SIGNATURE-----

iHQEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCX5OGLAAKCRDcUY/If5cW
qi+TAPUV4Hhkw1C7YurjPEb1ah6pagSugmaY+3UpynfPtVDFAQC5BqcIcH/FZEQr
UwL3qXK8OFNBQ4WRGKE2OiKRR4ZqAA==
=0w9F
-----END PGP SIGNATURE-----

V
V
Vagrant Cascadian wrote on 2 Nov 2020 20:14
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 44101@debbugs.gnu.org)
87pn4vo9jh.fsf@yucca
On 2020-10-23, Vagrant Cascadian wrote:
Toggle quote (18 lines)
> On 2020-10-23, Mathieu Othacehe wrote:
>>>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>>>> ERROR:
>>>> 1. &i/o-filename: "/dev/disk/by-id/mmc-SDU64_0xbaf3002e"
>>>
>>> Thanks for testing. This is probably a regression in
>>> "write-file-on-device" that fails to open this kind of files. I'll try
>>> to reproduce it locally.
>>
>> This is because the O_EXCL flag was passed, which causes open to fail if
>> the block device is mounted.
>>
>> The revised patch attached should fix it.
>
> Yes, this patch fixes the issue for me.
>
> Thanks!

Any reason not to apply this patch yet? Hope it can land in the next
guix release, at least.


live well,
vagrant

Toggle quote (88 lines)
>> From 780327ebb0db74ca4cc43d26ba7cf945d64c7d30 Mon Sep 17 00:00:00 2001
>> From: Mathieu Othacehe <othacehe@gnu.org>
>> Date: Wed, 21 Oct 2020 10:42:50 +0200
>> Subject: [PATCH] system: reconfigure: Use the disk-installer if provided.
>>
>> ---
>> gnu/build/bootloader.scm | 4 ++--
>> gnu/tests/reconfigure.scm | 4 +++-
>> guix/scripts/system/reconfigure.scm | 12 +++++++++---
>> 3 files changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/gnu/build/bootloader.scm b/gnu/build/bootloader.scm
>> index 5ec839f902..06a2c3ab76 100644
>> --- a/gnu/build/bootloader.scm
>> +++ b/gnu/build/bootloader.scm
>> @@ -39,9 +39,9 @@
>> (let ((bv (get-bytevector-n input size)))
>> (call-with-port
>> (open-file-output-port device
>> - (file-options no-truncate no-create)
>> + (file-options no-truncate no-fail)
>> (buffer-mode block)
>> - (native-transcoder))
>> + (make-transcoder (latin-1-codec)))
>> (lambda (output)
>> (seek output offset SEEK_SET)
>> (put-bytevector output bv)))))))
>> diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm
>> index 928a210a94..52beeef447 100644
>> --- a/gnu/tests/reconfigure.scm
>> +++ b/gnu/tests/reconfigure.scm
>> @@ -260,7 +260,9 @@ bootloader's configuration file."
>> ;; test suite, the bootloader installer script is omitted. 'grub-install'
>> ;; would attempt to write directly to the virtual disk if the
>> ;; installation script were run.
>> - (test (install-bootloader-program #f #f bootcfg bootcfg-file #f "/")))))
>> + (test
>> + (install-bootloader-program #f #f #f bootcfg bootcfg-file #f "/")))))
>> +
>>
>> (define %test-switch-to-system
>> (system-test
>> diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm
>> index d89caf80fc..b1982b20d2 100644
>> --- a/guix/scripts/system/reconfigure.scm
>> +++ b/guix/scripts/system/reconfigure.scm
>> @@ -204,7 +204,8 @@ services as defined by OS."
>> ;;; Bootloader configuration.
>> ;;;
>>
>> -(define (install-bootloader-program installer bootloader-package bootcfg
>> +(define (install-bootloader-program installer disk-installer
>> + bootloader-package bootcfg
>> bootcfg-file device target)
>> "Return an executable store item that, upon being evaluated, will install
>> BOOTCFG to BOOTCFG-FILE, a target file name, on DEVICE, a file system device,
>> @@ -246,10 +247,12 @@ BOOTLOADER-PACKAGE."
>> ;; a broken installation.
>> (switch-symlinks new-gc-root #$bootcfg)
>> (install-boot-config #$bootcfg #$bootcfg-file #$target)
>> - (when #$installer
>> + (when (or #$installer #$disk-installer)
>> (catch #t
>> (lambda ()
>> - (#$installer #$bootloader-package #$device #$target))
>> + (if #$installer
>> + (#$installer #$bootloader-package #$device #$target)
>> + (#$disk-installer #$bootloader-package 0 #$device)))
>> (lambda args
>> (delete-file new-gc-root)
>> (match args
>> @@ -272,11 +275,14 @@ additional configurations specified by MENU-ENTRIES can be selected."
>> (let* ((bootloader (bootloader-configuration-bootloader configuration))
>> (installer (and run-installer?
>> (bootloader-installer bootloader)))
>> + (disk-installer (and run-installer?
>> + (bootloader-disk-image-installer bootloader)))
>> (package (bootloader-package bootloader))
>> (device (bootloader-configuration-target configuration))
>> (bootcfg-file (bootloader-configuration-file bootloader)))
>> (eval #~(parameterize ((current-warning-port (%make-void-port "w")))
>> (primitive-load #$(install-bootloader-program installer
>> + disk-installer
>> package
>> bootcfg
>> bootcfg-file
>> --
>> 2.28.0
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCX6BasgAKCRDcUY/If5cW
qukMAQCnItRLdg7hEFRcsaVtvje/h1wWZeNC02jYfu5/K8qY2wEAoX0pLCkMaxai
6up9hl9Yt4U+unyUdfWgjmIqTayzVA0=
=PXI3
-----END PGP SIGNATURE-----

M
M
Mathieu Othacehe wrote on 3 Nov 2020 08:02
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 44101-done@debbugs.gnu.org)
875z6mj53g.fsf@gnu.org
Hello,

Toggle quote (3 lines)
> Any reason not to apply this patch yet? Hope it can land in the next
> guix release, at least.

Nothing besides lack of time. Pushed as
a38d861e571c952f78ca588b50bdcc4adcb0c88c.

Thanks for reporting and testing,

Mathieu
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 44101@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 44101
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch