unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
@ 2020-10-20 17:06 Vagrant Cascadian
  2020-10-22  7:58 ` Mathieu Othacehe
  0 siblings, 1 reply; 10+ messages in thread
From: Vagrant Cascadian @ 2020-10-20 17:06 UTC (permalink / raw)
  To: 44101; +Cc: Mathieu Othacehe

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-10-20 17:06 bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure Vagrant Cascadian
@ 2020-10-22  7:58 ` Mathieu Othacehe
  2020-10-22 20:08   ` Vagrant Cascadian
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Othacehe @ 2020-10-22  7:58 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 44101

[-- Attachment #1: Type: text/plain, Size: 739 bytes --]


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:

- 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-system-reconfigure-Use-the-disk-installer-if-provide.patch --]
[-- Type: text/x-diff, Size: 3474 bytes --]

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

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-10-22  7:58 ` Mathieu Othacehe
@ 2020-10-22 20:08   ` Vagrant Cascadian
  2020-10-22 23:12     ` Bengt Richter
  2020-10-23  8:13     ` Mathieu Othacehe
  0 siblings, 2 replies; 10+ messages in thread
From: Vagrant Cascadian @ 2020-10-22 20:08 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 44101

[-- Attachment #1: Type: text/plain, Size: 3553 bytes --]

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.


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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-10-22 20:08   ` Vagrant Cascadian
@ 2020-10-22 23:12     ` Bengt Richter
  2020-10-23  8:13     ` Mathieu Othacehe
  1 sibling, 0 replies; 10+ messages in thread
From: Bengt Richter @ 2020-10-22 23:12 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: Mathieu Othacehe, 44101

Hi,

On +2020-10-22 13:08:45 -0700, Vagrant Cascadian wrote:
> 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?

[1] https://unix.stackexchange.com/questions/86764/understanding-dev-disk-by-folders
 
> 
> 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




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-10-22 20:08   ` Vagrant Cascadian
  2020-10-22 23:12     ` Bengt Richter
@ 2020-10-23  8:13     ` Mathieu Othacehe
  2020-10-23  8:44       ` Mathieu Othacehe
  2020-10-23 15:14       ` Vagrant Cascadian
  1 sibling, 2 replies; 10+ messages in thread
From: Mathieu Othacehe @ 2020-10-23  8:13 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 44101


Hello,

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

> 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




^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-10-23  8:13     ` Mathieu Othacehe
@ 2020-10-23  8:44       ` Mathieu Othacehe
  2020-10-24  1:40         ` Vagrant Cascadian
  2020-10-23 15:14       ` Vagrant Cascadian
  1 sibling, 1 reply; 10+ messages in thread
From: Mathieu Othacehe @ 2020-10-23  8:44 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 44101

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]


Hello,

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-system-reconfigure-Use-the-disk-installer-if-provide.patch --]
[-- Type: text/x-diff, Size: 4243 bytes --]

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-10-23  8:13     ` Mathieu Othacehe
  2020-10-23  8:44       ` Mathieu Othacehe
@ 2020-10-23 15:14       ` Vagrant Cascadian
  1 sibling, 0 replies; 10+ messages in thread
From: Vagrant Cascadian @ 2020-10-23 15:14 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 44101

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]

On 2020-10-23, Mathieu Othacehe wrote:
>> 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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-10-23  8:44       ` Mathieu Othacehe
@ 2020-10-24  1:40         ` Vagrant Cascadian
  2020-11-02 19:14           ` Vagrant Cascadian
  0 siblings, 1 reply; 10+ messages in thread
From: Vagrant Cascadian @ 2020-10-24  1:40 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 44101

[-- Attachment #1: Type: text/plain, Size: 5086 bytes --]

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!

live well,
  vagrant

> 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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-10-24  1:40         ` Vagrant Cascadian
@ 2020-11-02 19:14           ` Vagrant Cascadian
  2020-11-03  7:02             ` Mathieu Othacehe
  0 siblings, 1 reply; 10+ messages in thread
From: Vagrant Cascadian @ 2020-11-02 19:14 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 44101

[-- Attachment #1: Type: text/plain, Size: 5334 bytes --]

On 2020-10-23, Vagrant Cascadian wrote:
> 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

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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure
  2020-11-02 19:14           ` Vagrant Cascadian
@ 2020-11-03  7:02             ` Mathieu Othacehe
  0 siblings, 0 replies; 10+ messages in thread
From: Mathieu Othacehe @ 2020-11-03  7:02 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 44101-done


Hello,

> 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




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-11-03  7:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-20 17:06 bug#44101: Unable to use /dev/disk/by-id/ symlinks with u-boot and guix system reconfigure Vagrant Cascadian
2020-10-22  7:58 ` Mathieu Othacehe
2020-10-22 20:08   ` Vagrant Cascadian
2020-10-22 23:12     ` Bengt Richter
2020-10-23  8:13     ` Mathieu Othacehe
2020-10-23  8:44       ` Mathieu Othacehe
2020-10-24  1:40         ` Vagrant Cascadian
2020-11-02 19:14           ` Vagrant Cascadian
2020-11-03  7:02             ` Mathieu Othacehe
2020-10-23 15:14       ` Vagrant Cascadian

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