GNU bug report logs - #35783
Guile-Parted crashes the installer on i686-linux

Previous Next

Package: guix;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Fri, 17 May 2019 19:47:02 UTC

Severity: important

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35783 in the body.
You can then email your comments to 35783 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Fri, 17 May 2019 19:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludo <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 17 May 2019 19:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: bug-Guix <at> gnu.org
Cc: Ricardo Wurmus <rekado <at> elephly.net>,
 Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: Guile-Parted crashes the installer on i686-linux
Date: Fri, 17 May 2019 21:46:06 +0200
[Message part 1 (text/plain, inline)]
Hello,

On i686-linux, the installer crashes when it reaches the partitioning
page with a null-pointer exception (or sometimes with a plain SIGSEGV),
in the call to ‘partition-disk’ in ‘esp-partition?’.  Screenshots
of two different crashes (null-pointer exception and SIGSEGV) attached.

The null-pointer exception happens when starting from a blank target
image (fresh ‘qemu-img create’), while the other crash happens (IIRC)
when the disk already has a partition table.

Mathieu, any ideas?

This is holding the 1.0.1 release (I actually have all the files ready
for upload after hours of builds :-/).  We’ll have to decide whether to
hold off until we have a fix, or whether to skip i686 altogether, or to
ship an install image where only the manual install may be used.

Thanks in advance!

Ludo’.

[i686-crash.png (image/png, attachment)]
[i686-crash-gmp.png (image/png, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Fri, 17 May 2019 20:04:01 GMT) Full text and rfc822 format available.

Message #8 received at 35783 <at> debbugs.gnu.org (full text, mbox):

From: Jonathan Brielmaier <jonathan.brielmaier <at> web.de>
To: 35783 <at> debbugs.gnu.org
Subject: Guile-Parted crashes the installer on i686-linux
Date: Fri, 17 May 2019 22:03:40 +0200
On my laptop (Thinkpad X240) as well as in QEMU I'll get the first error
(i686-crash.png). It makes no difference if I do separate home partition
or not. Encrypted partition or not still leads to this error...




Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 17 May 2019 20:49:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Fri, 17 May 2019 21:23:02 GMT) Full text and rfc822 format available.

Message #13 received at 35783 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 35783 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: Re: bug#35783: Guile-Parted crashes the installer on i686-linux
Date: Fri, 17 May 2019 23:22:47 +0200
Ludovic Courtès <ludo <at> gnu.org> skribis:

> On i686-linux, the installer crashes when it reaches the partitioning
> page with a null-pointer exception (or sometimes with a plain SIGSEGV),
> in the call to ‘partition-disk’ in ‘esp-partition?’.  Screenshots
> of two different crashes (null-pointer exception and SIGSEGV) attached.

Reverting 7d567af46b4e10ffafb1d0f76b524f5781460598 fixes the problem, so
I guess this has to do with the fact that the previous partition objects
(those listed in ‘initial-partitions’) are invalidated or something.

Now we need another way to address
<https://issues.guix.gnu.org/issue/35731>.

Ideas?

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Sat, 18 May 2019 09:31:02 GMT) Full text and rfc822 format available.

Message #16 received at 35783 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35783 <at> debbugs.gnu.org
Subject: Re: bug#35783: Guile-Parted crashes the installer on i686-linux
Date: Sat, 18 May 2019 11:30:21 +0200
[Message part 1 (text/plain, inline)]
Hey Ludo,

> Reverting 7d567af46b4e10ffafb1d0f76b524f5781460598 fixes the problem, so
> I guess this has to do with the fact that the previous partition objects
> (those listed in ‘initial-partitions’) are invalidated or something.

Yes I think that's what happened, even though I don't get why it didn't
cause an issue on x64.

>
> Now we need another way to address
> <https://issues.guix.gnu.org/issue/35731>.

I have a first draft, I'm about to test right now :)

Mathieu
[0001-draft-Fix-esp-user-partition-creation.patch (text/x-diff, inline)]
From 3c6018a448f38e263aeb5a23fbc88d226a048d67 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe <at> gmail.com>
Date: Sat, 18 May 2019 11:25:09 +0200
Subject: [PATCH] draft: Fix esp user-partition creation.

---
 gnu/installer/newt/partition.scm |  5 +----
 gnu/installer/parted.scm         | 12 ++++++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index f8e318fa0d..cd9d46316a 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -752,10 +752,7 @@ by pressing the Exit button.~%~%")))
                             (disk-commit disk)
                             disk)))
                 (scheme (symbol-append method '- (run-scheme-page)))
-                (user-partitions (append
-                                  (auto-partition! disk #:scheme scheme)
-                                  (create-special-user-partitions
-                                   (disk-partitions disk)))))
+                (user-partitions (auto-partition! disk #:scheme scheme)))
            (run-disk-page (list disk) user-partitions
                           #:guided? #t)))
        ((eq? method 'manual)
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index 4ccc0b1f51..ac9098cbde 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -1001,10 +1001,14 @@ swap partition, a root partition and a home partition."
                     (mount-point "/home")))))))
            (new-partitions* (force-user-partitions-formatting
                              new-partitions)))
-      (create-adjacent-partitions! disk
-                                   new-partitions*
-                                   #:last-partition-end
-                                   (or end-esp-partition 0)))))
+      (append
+       (if esp-partition
+           (partition->user-partition esp-partition)
+           '())
+       (create-adjacent-partitions! disk
+                                    new-partitions*
+                                    #:last-partition-end
+                                    (or end-esp-partition 0))))))
 
 
 ;;
-- 
2.17.1


Information forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Sat, 18 May 2019 10:26:01 GMT) Full text and rfc822 format available.

Message #19 received at 35783 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35783 <at> debbugs.gnu.org
Subject: Re: bug#35783: Guile-Parted crashes the installer on i686-linux
Date: Sat, 18 May 2019 12:25:38 +0200
[Message part 1 (text/plain, inline)]
With this almost indentical patch, disk partitioning seems fine with and
without existing esp partition on x64. I'll try to run more tests.

Mathieu
[0001-draft-Fix-esp-user-partition-creation.patch (text/x-diff, inline)]
From 1e0734c4829725cdee6cab3cb05332ffd2a36a57 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe <at> gmail.com>
Date: Sat, 18 May 2019 11:25:09 +0200
Subject: [PATCH] draft: Fix esp user-partition creation.

---
 gnu/installer/newt/partition.scm |  5 +----
 gnu/installer/parted.scm         | 12 ++++++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index f8e318fa0d..cd9d46316a 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -752,10 +752,7 @@ by pressing the Exit button.~%~%")))
                             (disk-commit disk)
                             disk)))
                 (scheme (symbol-append method '- (run-scheme-page)))
-                (user-partitions (append
-                                  (auto-partition! disk #:scheme scheme)
-                                  (create-special-user-partitions
-                                   (disk-partitions disk)))))
+                (user-partitions (auto-partition! disk #:scheme scheme)))
            (run-disk-page (list disk) user-partitions
                           #:guided? #t)))
        ((eq? method 'manual)
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index 4ccc0b1f51..196fa99cf4 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -1001,10 +1001,14 @@ swap partition, a root partition and a home partition."
                     (mount-point "/home")))))))
            (new-partitions* (force-user-partitions-formatting
                              new-partitions)))
-      (create-adjacent-partitions! disk
-                                   new-partitions*
-                                   #:last-partition-end
-                                   (or end-esp-partition 0)))))
+      (append
+       (if esp-partition
+           (list (partition->user-partition esp-partition))
+           '())
+       (create-adjacent-partitions! disk
+                                    new-partitions*
+                                    #:last-partition-end
+                                    (or end-esp-partition 0))))))
 
 
 ;;
-- 
2.17.1


Information forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Sat, 18 May 2019 11:51:02 GMT) Full text and rfc822 format available.

Message #22 received at 35783 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 35783 <at> debbugs.gnu.org
Subject: Re: bug#35783: Guile-Parted crashes the installer on i686-linux
Date: Sat, 18 May 2019 13:50:33 +0200
Hi Mathieu,

Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

> With this almost indentical patch, disk partitioning seems fine with and
> without existing esp partition on x64. I'll try to run more tests.

I was fiddling with this and had arrived to a similar patch, we’re in
perfect symbiosis.  :-)

I’ve done some testing both in an EFI and a non-EFI setup with QEMU, and
it seems to work well; I’ll do some more testing as well.

>>From 1e0734c4829725cdee6cab3cb05332ffd2a36a57 Mon Sep 17 00:00:00 2001
> From: Mathieu Othacehe <m.othacehe <at> gmail.com>
> Date: Sat, 18 May 2019 11:25:09 +0200
> Subject: [PATCH] draft: Fix esp user-partition creation.

[...]

> --- a/gnu/installer/parted.scm
> +++ b/gnu/installer/parted.scm
> @@ -1001,10 +1001,14 @@ swap partition, a root partition and a home partition."
>                      (mount-point "/home")))))))
>             (new-partitions* (force-user-partitions-formatting
>                               new-partitions)))
> -      (create-adjacent-partitions! disk
> -                                   new-partitions*
> -                                   #:last-partition-end
> -                                   (or end-esp-partition 0)))))
> +      (append
> +       (if esp-partition
> +           (list (partition->user-partition esp-partition))
> +           '())
> +       (create-adjacent-partitions! disk
> +                                    new-partitions*
> +                                    #:last-partition-end
> +                                    (or end-esp-partition 0))))))

Perhaps add something like this to the docstring of ‘auto-partition!’:

  Return the complete list of partitions on DISK, including the ESP when it
  exists.

Longer-term it would be good to audit Guile-Parted: it probably
shouldn’t be possible for Guile-Parted to refer to “defunct” Parted
objects.

Thank you for the quick response!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Sat, 18 May 2019 13:45:02 GMT) Full text and rfc822 format available.

Message #25 received at 35783 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 35783 <at> debbugs.gnu.org
Subject: Re: bug#35783: Guile-Parted crashes the installer on i686-linux
Date: Sat, 18 May 2019 15:44:11 +0200
[Message part 1 (text/plain, inline)]
It seems to be working well for me, including non-EFI i686.

I use the attached script to test an full install from the ISO, with or
without UEFI (though you cannot boot the install UEFI system because the
EFI variables set by GRUB are not saved.)

Ludo’.

[test-install.sh (text/plain, inline)]
#!/bin/sh
set -e
set -x
ISO="$(./pre-inst-env guix system disk-image --file-system-type=iso9660 gnu/system/install.scm)"
qemu-img create -f qcow2  /tmp/t.img 10G

#cp "$(guix build ovmf)/share/firmware/ovmf_x64.bin" /tmp
#chmod +w /tmp/ovmf_x64.bin
EFI_OPTS="-bios $(guix build ovmf)/share/firmware/ovmf_x64.bin"

exec qemu-system-x86_64 -enable-kvm -hda /tmp/t.img -cdrom "$ISO" -m 1024 -boot d -net user -net nic,model=virtio -no-reboot $EFI_OPTS

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 19 May 2019 10:10:03 GMT) Full text and rfc822 format available.

Notification sent to Ludovic Courtès <ludo <at> gnu.org>:
bug acknowledged by developer. (Sun, 19 May 2019 10:10:03 GMT) Full text and rfc822 format available.

Message #30 received at 35783-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 35783-done <at> debbugs.gnu.org
Subject: Re: bug#35783: Guile-Parted crashes the installer on i686-linux
Date: Sun, 19 May 2019 12:09:37 +0200
Hi,

I went ahead and pushed the patch as
d68de958b60426798ed62797ff7c96c327a672ac.

I’ll build the release from that commit.

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Sun, 19 May 2019 14:25:01 GMT) Full text and rfc822 format available.

Message #33 received at 35783 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35783 <at> debbugs.gnu.org
Subject: Re: bug#35783: Guile-Parted crashes the installer on i686-linux
Date: Sun, 19 May 2019 16:24:26 +0200
Hey Ludo,

> Longer-term it would be good to audit Guile-Parted: it probably
> shouldn’t be possible for Guile-Parted to refer to “defunct” Parted
> objects.

Yup, with hindsight I realize that keeping Guile-Parted so low-level was
a mistake. With a few more abstractions (gnu installer parted) could be
less complicated.

Anyway, thanks for pushing this patch.

Mathieu




Information forwarded to bug-guix <at> gnu.org:
bug#35783; Package guix. (Mon, 20 May 2019 08:18:02 GMT) Full text and rfc822 format available.

Message #36 received at 35783 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 35783 <at> debbugs.gnu.org
Subject: Re: bug#35783: Guile-Parted crashes the installer on i686-linux
Date: Mon, 20 May 2019 10:17:29 +0200
Hi Mathieu,

Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

>> Longer-term it would be good to audit Guile-Parted: it probably
>> shouldn’t be possible for Guile-Parted to refer to “defunct” Parted
>> objects.
>
> Yup, with hindsight I realize that keeping Guile-Parted so low-level was
> a mistake. With a few more abstractions (gnu installer parted) could be
> less complicated.

I don’t know; as a rule of thumb, I think it’s good to make bindings a
direct mapping to the underlying library, and to build abstractions on
top of that.

That said, my point was more that it shouldn’t be possible to get a
null-pointer exception or a SIGSEGV when using Guile-Parted, even if you
make a mistake.  In this case, it seems that the underlying C object had
been reclaimed somehow; the bindings should protect against that.

Thoughts?

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 17 Jun 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.