2022-06-04 11:41:50 |
Thomas Schmitt |
bug |
|
|
added bug |
2022-06-04 11:43:34 |
Thomas Schmitt |
description |
Hi,
i propose to let function find_or_create_persistent_partition in
scripts/casper-helpers preserve the MBR partition entries 2 to 4 when
it applies sfdisk to create the persistent partition.
Currently it writes an MBR partition entry 2 with start LBA 0, size 1,
and boot flag if it detects GPT after the persistent partition was created.
(sfdisk had overwritten it by zeros but normally the ISO shall have it.)
My idea for casper-helpers is to record the three entries in a file:
MBR_STASH=/tmp/mbr_stash_$$
dd if="$DEVICE" bs=1 skip=462 count=48 of="$MBR_STASH"
and to restore them after creation of the new partition
dd if="$MBR_STASH" bs=1 seek=462 conv=notrunc count=48
instead of writing a newly composed entry 2, as is done now:
echo $escape_arg -n '\0200\00\01\00\00\00\01\00\00\00\00\00\01\00\00\00' \
| dd of=$DEVICE bs=1 seek=462 conv=notrunc count=16
-----------------------------------------------------------------------
Reasoning:
In the course of
https://bugs.launchpad.net/ubuntu/+source/casper/+bug/1922342
we found out that some rare old machines need 10 minutes or longer to boot
the current Ubuntu ISOs from USB stick. The trigger is the presence of the
MBR partition 2 with boot flag.
This partition exists for some old but not so rare machines. It is a
mild violation of UEFI/GPT specs which don't offer a clear way to equip
a GPT partitioned device with an MBR boot flag.
If MBR partition entry 2 of the ISO image is overwritten by zero bytes
before the image is put onto the USB stick, then it boots substantially
faster. E.g. 3 minutes rather than 10 minutes.
But casper re-installs MBR partition 2 when starting the first Live
session. So after one swift boot, the problem is back and the USB stick
needs the removal of MBR partition 2 again.
This time the remedy is permanent. But it has to be applied to the
USB stick with superuser authority.
Given that the Ubuntu tutorial proposes to put the ISO image onto the
USB stick by Balena Etcher rather than by cp or dd, i deem it not safe
to propose a dd run as superuser.
I make this change proposal so that it is possible to apply the remedy
as normal user to the ISO image file rather than as superuser to the stick.
-----------------------------------------------------------------------
Additional details:
Affected are:
- a tablet computer "motion computing j3400" of Chris Guiver,
- a Gigabyte H61M-D2H-USB3 mainboard of José Marinho (see also
https://launchpadlibrarian.net/531427797/lshw.txt),
- (a Gigabyte GA-970A-DS3, BIOS F7a 01/24/2013 of tlk, of which we have
no confirmation that removing MBR partition 2 really helps).
The long delay happens after the GRUB boot menu, probably still in GRUB.
I lack of ideas how to even find out whether vmlinuz hasn't started yet,
not to speak of diagnosing why it only happens with particular firmwares.
Bug 1922342 mentions an error message "Error can't find grub_platform"
which is related to a few lines grub.cfg. In the end it turned out that
disabling these lines silences the message but does not speed up booting.
Have a nice day :)
Thomas |
Hi,
i propose to let function find_or_create_persistent_partition in
scripts/casper-helpers preserve the MBR partition entries 2 to 4 when
it applies sfdisk to create the persistent partition.
Currently it writes an MBR partition entry 2 with start LBA 0, size 1,
and boot flag if it detects GPT after the persistent partition was created.
(sfdisk had overwritten it by zeros but normally the ISO shall have it.)
My idea for casper-helpers is to record the three entries in a file:
MBR_STASH=/tmp/mbr_stash_$$
dd if="$DEVICE" bs=1 skip=462 count=48 of="$MBR_STASH"
and to restore them after creation of the new partition
dd if="$MBR_STASH" bs=1 seek=462 conv=notrunc count=48 of="$DEVICE"
instead of writing a newly composed entry 2, as is done now:
echo $escape_arg -n '\0200\00\01\00\00\00\01\00\00\00\00\00\01\00\00\00' \
| dd of=$DEVICE bs=1 seek=462 conv=notrunc count=16
-----------------------------------------------------------------------
Reasoning:
In the course of
https://bugs.launchpad.net/ubuntu/+source/casper/+bug/1922342
we found out that some rare old machines need 10 minutes or longer to boot
the current Ubuntu ISOs from USB stick. The trigger is the presence of the
MBR partition 2 with boot flag.
This partition exists for some old but not so rare machines. It is a
mild violation of UEFI/GPT specs which don't offer a clear way to equip
a GPT partitioned device with an MBR boot flag.
If MBR partition entry 2 of the ISO image is overwritten by zero bytes
before the image is put onto the USB stick, then it boots substantially
faster. E.g. 3 minutes rather than 10 minutes.
But casper re-installs MBR partition 2 when starting the first Live
session. So after one swift boot, the problem is back and the USB stick
needs the removal of MBR partition 2 again.
This time the remedy is permanent. But it has to be applied to the
USB stick with superuser authority.
Given that the Ubuntu tutorial proposes to put the ISO image onto the
USB stick by Balena Etcher rather than by cp or dd, i deem it not safe
to propose a dd run as superuser.
I make this change proposal so that it is possible to apply the remedy
as normal user to the ISO image file rather than as superuser to the stick.
-----------------------------------------------------------------------
Additional details:
Affected are:
- a tablet computer "motion computing j3400" of Chris Guiver,
- a Gigabyte H61M-D2H-USB3 mainboard of José Marinho (see also
https://launchpadlibrarian.net/531427797/lshw.txt),
- (a Gigabyte GA-970A-DS3, BIOS F7a 01/24/2013 of tlk, of which we have
no confirmation that removing MBR partition 2 really helps).
The long delay happens after the GRUB boot menu, probably still in GRUB.
I lack of ideas how to even find out whether vmlinuz hasn't started yet,
not to speak of diagnosing why it only happens with particular firmwares.
Bug 1922342 mentions an error message "Error can't find grub_platform"
which is related to a few lines grub.cfg. In the end it turned out that
disabling these lines silences the message but does not speed up booting.
Have a nice day :)
Thomas |
|
2022-06-04 12:07:17 |
Chris Guiver |
bug |
|
|
added subscriber Chris Guiver |
2022-06-04 12:49:13 |
sudodus |
bug |
|
|
added subscriber sudodus |
2022-06-06 16:31:14 |
Brian Murray |
tags |
|
rls-jj-incoming rls-kk-incoming |
|
2022-06-09 15:13:14 |
Matthieu Clemenceau |
tags |
rls-jj-incoming rls-kk-incoming |
fr-2456 rls-jj-incoming rls-kk-incoming |
|
2022-06-09 22:11:38 |
Brian Murray |
casper (Ubuntu): milestone |
|
ubuntu-22.04.1 |
|
2022-06-09 22:23:10 |
Brian Murray |
bug |
|
|
added subscriber Brian Murray |
2022-06-10 22:17:43 |
Brian Murray |
nominated for series |
|
Ubuntu Kinetic |
|
2022-06-10 22:17:43 |
Brian Murray |
bug task added |
|
casper (Ubuntu Kinetic) |
|
2022-06-10 22:17:43 |
Brian Murray |
nominated for series |
|
Ubuntu Jammy |
|
2022-06-10 22:17:43 |
Brian Murray |
bug task added |
|
casper (Ubuntu Jammy) |
|
2022-06-10 22:25:33 |
Brian Murray |
casper (Ubuntu Jammy): milestone |
|
ubuntu-22.04.1 |
|
2022-06-10 22:25:39 |
Brian Murray |
casper (Ubuntu Kinetic): milestone |
ubuntu-22.04.1 |
|
|
2022-06-14 23:43:58 |
Brian Murray |
casper (Ubuntu Jammy): importance |
Undecided |
Medium |
|
2022-06-14 23:44:01 |
Brian Murray |
casper (Ubuntu Kinetic): importance |
Undecided |
Medium |
|
2022-06-16 15:13:52 |
Brian Murray |
tags |
fr-2456 rls-jj-incoming rls-kk-incoming |
fr-2456 |
|
2022-07-08 04:44:24 |
Launchpad Janitor |
merge proposal linked |
|
https://code.launchpad.net/~mwhudson/casper/+git/casper/+merge/426522 |
|
2022-07-08 04:44:40 |
Michael Hudson-Doyle |
casper (Ubuntu Kinetic): assignee |
|
Michael Hudson-Doyle (mwhudson) |
|
2022-07-08 04:44:48 |
Michael Hudson-Doyle |
casper (Ubuntu Kinetic): status |
New |
In Progress |
|
2022-07-08 15:30:18 |
Launchpad Janitor |
casper (Ubuntu Jammy): status |
New |
Confirmed |
|
2022-08-03 21:47:41 |
Brian Murray |
casper (Ubuntu Kinetic): milestone |
|
ubuntu-22.10-beta |
|
2022-08-03 21:47:47 |
Brian Murray |
casper (Ubuntu Jammy): milestone |
ubuntu-22.04.1 |
ubuntu-22.04.2 |
|
2022-08-05 09:07:47 |
Launchpad Janitor |
casper (Ubuntu Kinetic): status |
In Progress |
Fix Released |
|
2022-09-11 23:58:17 |
Matthieu Clemenceau |
tags |
fr-2456 |
foundations-todo fr-2456 |
|
2022-09-11 23:58:28 |
Matthieu Clemenceau |
bug |
|
|
added subscriber Ubuntu Foundations Team |
2022-09-15 15:35:56 |
Matthieu Clemenceau |
removed subscriber Ubuntu Foundations Team |
|
|
|
2022-09-15 15:36:02 |
Matthieu Clemenceau |
bug |
|
|
added subscriber Ubuntu Foundations Bugs |