You are not logged in.

#1 2021-02-28 15:09:54

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Cannot boot Arch USB on legacy mode

I recently bought Lenovo Thinkpad T420. I want to install Arch on it with only Legacy Boot enabled. I have 32GB USB drive. I downloaded newest .iso and followed instructions for MacOS from here:

https://wiki.archlinux.org/index.php/US … m#In_macOS

I made sure not to put s1 suffix after disk name and updated BIOS to newest available version.

This is the output when I run fdisk -l:

GPT PMBR size mismatch (1424023 != 60063743) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
Disk /dev/sda: 28.7 GiB, 30752636928 bytes, 60063744 sectors
Disk model: Ultra
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 31323032-3230-4130-B130-30353138333

And output of diskutil list:

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *30.8 GB    disk2
   1:           Linux Filesystem                         664.8 MB   disk2s1
   2:                        EFI ARCHISO_EFI             64.0 MB    disk2s2
   3:       Microsoft Basic Data                         307.2 KB   disk2s3

After selecting boot my usb drive as a boot device, screen goes blank for a couple of seconds and then goes back to boot device selection.

If I use both UEFI and Legacy mode or only UEFI, I can boot from pendrive without a problem, although on the boot list only Arch UEFI boot is available.

When flashing different distros such as Ubuntu, Fedora or Manjaro, I don't run into this problem.

It seems that when flashing them their partition table is MBR instead of GPT.
I ran gdisk to change from GPT to MBR after flashing Arch .iso. I'm wondering what might be the reason to do it differently than other distros.

Did Arch deprecated support for older devices that do not work with GPT in Legacy mode?
Maybe there is something wrong with my BIOS setup? I reset it to default values and only forced Legacy mode to be sure that no other thing is affecting booting.

Offline

#2 2021-03-01 03:15:45

edacval
Member
From: .LT
Registered: 2008-10-23
Posts: 75

Re: Cannot boot Arch USB on legacy mode

This is nothing wrong with your BIOS setup or Arch .iso. T420 firmware strictly follows UEFI specifications, so when you change to Legacy mode you are asking BIOS to forget all UEFI features, including GPT layout. More details on this in Arch wiki. I have on hands T420 and Acer XC-603, they both behave the same way.

Offline

#3 2021-03-01 09:47:33

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 287

Re: Cannot boot Arch USB on legacy mode

edacval wrote:

More details on this in Arch wiki.

The official iso already uses that trick, check with:

$ fdisk -t mbr -l archlinux-2021.02.01-x86_64.iso

you'll see:

Device                           Boot Start     End Sectors   Size Id Type
archlinux-2021.02.01-x86_64.iso1          1 1424023 1424023 695,3M ee GPT
archlinux-2021.02.01-x86_64.iso2 *        0       0       1   512B  0 Empty

It's accomplished by the combination of xorrisofs options -appended_part_as_gpt and --mbr-force-bootable in mkarchiso.

Offline

#4 2021-03-01 20:02:14

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

Thanks for the info! I was not able to find good explanation when googling for it and this wiki answers it perfectly.

Offline

#5 2021-03-05 22:38:34

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

nl6720 wrote:
edacval wrote:

More details on this in Arch wiki.

The official iso already uses that trick, check with:

$ fdisk -t mbr -l archlinux-2021.02.01-x86_64.iso

you'll see:

Device                           Boot Start     End Sectors   Size Id Type
archlinux-2021.02.01-x86_64.iso1          1 1424023 1424023 695,3M ee GPT
archlinux-2021.02.01-x86_64.iso2 *        0       0       1   512B  0 Empty

It's accomplished by the combination of xorrisofs options -appended_part_as_gpt and --mbr-force-bootable in mkarchiso.

I went through the whole installation process and applied all necessary changes to make BIOS/GTP setup work.
If I understood you post correctly, I should not have a problem with booting arch live iso from the usb.
It seems that something might be still wrong with my BIOS setup or device, because without modifying flashed usb with gdisk to force change from GTP to MBR, I am not able to boot from USB.
The same issue applies to installed Arch on the disk, as I'm not able to boot from it.

Offline

#6 2021-03-06 07:01:19

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 287

Re: Cannot boot Arch USB on legacy mode

This is likely because of https://gitlab.archlinux.org/archlinux/ … equests/80 & https://gitlab.archlinux.org/archlinux/ … /issues/49. It affects ISOs starting from archlinux-2020.11.01-x86_64.iso, you can try archlinux-2020.10.01-x86_64.iso to see if it boots. Also, you said it didn't happen with Ubuntu, but from what I can see ubuntu-20.10-desktop-amd64.iso has practically the same partition layout as archlinux-2021.03.01-x86_64.iso.

Using MBR instead of GPT is not really an option for archiso, since that breaks booting for some hardware, see https://bugs.launchpad.net/ubuntu-cdimage/+bug/1886148. The only option would be to revert to previously used crazy layout with valid MBR and invalid GPT (xorrisofs option -isohybrid-gpt-basdat) sad

Offline

#7 2021-03-06 12:15:19

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

Thanks for further explanation. I know that with this setup I'm going against the tide, but as I stumbled into this problem, I wanted to figure it out and learn something new. wink

Offline

#8 2021-03-06 16:46:57

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

I can confirm that I can boot from .iso that you provided without the need to modify it in any way after flashing. Do I understand correctly that this is not going to be fixed as it would require some crazy layout to make it work, so it is most likely not worth the effort and maintenance power?

I will try to install it on the disk with BIOS/GPT configuration and see how it goes. Although, for a normal setup it seems that it is better to choose BIOS/MBR or UEFI/GPT.

Offline

#9 2021-03-06 17:02:54

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 287

Re: Cannot boot Arch USB on legacy mode

The change was made with the assumption that it doesn't break booting, so I don't think anything actually prevents returning to the old layout. The fact that the partition tables are unusual doesn't matter that much as long as the ISO boots.

I'd appreciate if you could test archlinux-isohybrid-gpt-basdat-test1-2021.03.06-x86_64.iso and archlinux-isohybrid-gpt-basdat-test2-2021.03.06-x86_64.iso, and tell me if they boot in both BIOS and UEFI mode. Also it would be interesting to know if ubuntu-20.10-desktop-amd64.iso boots in BIOS mode for you.

Offline

#10 2021-03-06 22:06:52

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

I tested a couple of different images to see how they behave with BIOS and UEFI. This is what I found:

test1 - BIOS: OK, UEFI: OK
test2 - BIOS: OK, UEFI: OK
arch 2020.10.01 - BIOS: OK, UEFI: OK
arch 2021.02.01 - BIOS: NO BOOT, UEFI: OK
ubuntu 20.10 - BIOS: NO BOOT, UEFI: OK
ubuntu 20.04 - BIOS: OK, UEFI: OK
fedora 33 - BIOS: OK, UEFI: OK
manjaro xfce 20.2.1 - BIOS: OK, UEFI: OK

I haven't tried installing them yet. I'll post an update when I do it with some of them.

Offline

#11 2021-03-07 05:30:02

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 287

Re: Cannot boot Arch USB on legacy mode

test1 is a slightly different than what was used before, but if it works then that's good. I'll go with that, https://gitlab.archlinux.org/archlinux/ … issues/102 .

Offline

#12 2021-03-07 19:04:05

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

I went through installation using test1 iso. Unfortunately I'm still not able to boot from disk after it.
I applied the trick that was mentioned before:
https://wiki.archlinux.org/index.php/Pa … g_from_GPT
I did it both before and after installing GRUB, as I was not sure what moment is correct to apply it.

I also installed intel microcode patches and I applied Legacy Boot Label, as advised here:
https://wiki.archlinux.org/index.php/GR … ooting_GPT
I first applied it to the 1MB partition, but then I noticed that this is probably not the one that should be marked, so I applied it to my '/' partition.

Offline

#13 2021-03-09 12:35:09

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 287

Re: Cannot boot Arch USB on legacy mode

For the installed system, you could either, if possible, just use MBR, or you can try if hybrid MBR would work.

Now, about getting the ISO to BIOS boot, I've consulted with Thomas Schmitt (the developer of libisoburn). I'd appreciate if you could try a few more ISOs to see where exactly the problem with your hardware lies:

test3 leaves out -isohybrid-gpt-basdat and -appended_part_as_gpt.
test4 is build like archlinux-2021.03.01-x86_64.iso but leaves out the option --mbr-force-bootable.
test5 adds to the ISO from test 3 a dummy partition 3, removes the boot flag from partition 1 and sets it in the new partition table entry.

Offline

#14 2021-03-09 15:15:30

scdbackup
Member
Registered: 2013-05-30
Posts: 61

Re: Cannot boot Arch USB on legacy mode

Hi,

let me add some motivation for the new tests.

They aim for finding out which property of archlinux-2021.02.01-x86_64.iso
actually keeps the Lenovo T420 firmware from accepting it as BIOS boot
device.
The problems with booting from the disk installation are out of my scope,
i fear.

My scope is ISO 9660 and i think that archlinux-2021.02.01-x86_64.iso is
a beauty, whereas the *test1*.iso is an ugly jackalope of which i cannot
guarantee that its head won't fall off after some future release of
libisoburn.

So if the neat layout of archlinux-2021.02.01-x86_64.iso has to be
abandoned, i would strongly promote the use of the old Arch Linux ISO
layout, which is about the same as with Ubuntu 20.04, Debian 10, or
Fedora for which it was invented by Matthew J. Garrett.

His layout from 2012 bears an MBR partition table and a GPT.
The MBR partition table with an own EFI partition prevents the GPT from
being valid.
The new layout of archlinux-2021.02.01-x86_64.iso and Ubuntu 20.10 bears
a GPT which is valid by a proper "protective" MBR partition table.
The only flaw is a second MBR partition entry of type 0x00 which carries
the boot flag. It's job is to please some old BIOSes which do not accept
a storage device where no partition entry bears the boot flag.

I see two plausible candidates for an explanation of the problem with the
firmware of the Lenovo T420:

  1. It takes a valid GPT as reason not to boot via CSM BIOS.

  2. Or it takes the semi-legal MBR partition 2 of type 0x00 with boot flag as
    reason not to boot via CSM.

The three test ISOs shall distinguish the two theories:

  • test3 has no GPT but only an MBR partition table. I expect it to boot
    on the T420 in CSM BIOS mode. (But during development of Ubuntu 20.10 some
    Lenovos did not boot in native UEFI mode from a pure MBR table.)

  • test4 has a valid GPT and a flawless "protective" MBR, because its
    partition slot 2 is entirely filled with zeros. If it boots, then theory 2
    is probably right. If it does not boot, then theory 1 wins.

  • test5 is of interest only if test3 and test4 both
    succeed with booting. It shall find out whether test1 succeeded
    because the partition with the boot flag is larger than just a single
    block. If test5 fails to boot, then T420 hates microscopic dummy partitions
    with boot flag.

Have a nice day smile

Thomas

Edit: Corrected date in ISO name from 2021.03.01 to 2021.02.01

Last edited by scdbackup (2021-03-09 18:07:48)

Offline

#15 2021-03-11 21:45:43

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

To make sure, I'm doing the install for GPT/BIOS correctly, here's list of steps that I take:
1. Prepare partitions with fdisk. Create new GTP table. First is BIOS Boot 1MB partition. Second is '/' partition with size of 40GB and ext4 filesystem. Third is for '/home', takes rest of the disk space and uses ext4.
2. Mount /dev/sda2 and /dev/sda3
3. Run pacstrap.
4. genfstab
5. chroot
6. Download grub and intel-ucode.
7. Install grub and generate config.
8. Apply workaround for GPT/BIOS setup - https://wiki.archlinux.org/index.php/Pa … g_from_GPT
9. Apply fix for intel - https://wiki.archlinux.org/index.php/GR … ooting_GPT
10. Exit chroot and reboot.

test3 - no boot after install
test4 - no boot on Legacy BIOS from live USB
test5 - no boot after install

Edit: I added info that I try to do BIOS/GPT installation.

Last edited by jaworek3211 (2021-03-12 17:04:19)

Offline

#16 2021-03-11 22:10:23

scdbackup
Member
Registered: 2013-05-30
Posts: 61

Re: Cannot boot Arch USB on legacy mode

Hi,

> test3 - no boot after install
> test4 - no boot on Legacy BIOS from live USB

This means that a valid GPT causes the firmware of T420 not to consider
the storage device for CSM BIOS booting.


I consider this a firmware bug of an old machine (the web tells me that
it is probably about 8 years old).
The trick of
  https://wiki.archlinux.org/index.php/Un … ical_media
should fix the problem for test4 or archlinux-2021.02.01-x86_64.iso.

But there is no need at all for any partition table for booting via legacy
BIOS. An ISO with ISOLINUX for BIOS and valid GPT should become a BIOS-only
isohybrid by just zeroizing bytes 446 to 510 and 512 to 520:

dd if=/dev/zero conv=notrunc bs=1 seek=446 count=64 \
   of=archlinux-2021.02.01-x86_64.iso
dd if=/dev/zero conv=notrunc bs=1 seek=512 count=8 \
   of=archlinux-2021.02.01-x86_64.iso

This would kill both, MBR table and GPT but leave the BIOS boot code and
the magic number in the MBR undamaged.
Copied onto an USB stick, this should boot on the T420 via CSM BIOS.

The dd runs should work alike for test4, archlinux-2021.02.01-x86_64.iso,
and Ubuntu 20.10.

------------------------------------------------------------------------

> test3 - no boot after install

Although this is out of my scope:
Is the disk perhaps partitioned by a GPT after the installation ?
(I.e. does fdisk say about the disk "Disklabel type: gpt" ?)

If so, check whether the installation offers partitioning by MBR (sometimes
called "MS-DOS" or "DOS" partitioning).


Have a nice day smile

Thomas

Offline

#17 2021-03-12 17:07:49

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

Hi,

I'm trying to install with BIOS/GPT setup. I'm aware that this is not recommended way to do it, but I'm just trying to figure out if it is possible at all. There is no particular reason for it. Just messing with different options and this is the way I stumbled upon problems with booting arch iso from Legacy BIOS.
I can successfully install with BIOS/MBR setup.

Thanks again for the input and I'm happy to help with more tests, if someone has other ideas.

Offline

#18 2021-03-12 17:47:19

scdbackup
Member
Registered: 2013-05-30
Posts: 61

Re: Cannot boot Arch USB on legacy mode

Hi,

> I can successfully install with BIOS/MBR setup.

So i believe that every test result in this thread can be explained by
a GPT allergy of the CSM legacy BIOS mode of the particular machine.

> I'm happy to help with more tests, if someone has other ideas.

You could verify my prediction that these two dd runs

iso=archlinux-2021.02.01-x86_64.iso
dd if=/dev/zero conv=notrunc bs=1 seek=446 count=64 of="$iso"
dd if=/dev/zero conv=notrunc bs=1 seek=512 count=8 of="$iso"

make the current Arch Linux ISO suitable for booting from USB stick
by your T420 in CSM BIOS mode.

It won't work for UEFI afterwards. So if you plan UEFI experiments, do
the dd runs with a copy of the original ISO.

The new image state will also be inconvenient for adding partitions to
the USB stick.
If you want to explore that task, you will have to create a partition 1
which marks the byte range of the ISO 9660 filesystem. Best by inspecting
the partition table of the image before the dd runis:

$ /sbin/fdisk -l archlinux-2021.02.01-x86_64.iso
...
Device                             Start     End Sectors  Size Type
archlinux-2021.02.01-x86_64.iso1      64 1298431 1298368  634M Linux filesystem
...

After the dd runs, use fdisk to create a "dos" partition table with
partition number 1 bearing the same start and end blocks.
(The other partitions contain EFI equipment and CD-R padding, which you
don't need.)
Afterwards you may add more partitions and give them filesystems.

Have a nice day smile

Thomas

Offline

#19 2021-03-29 17:44:32

jaworek3211
Member
Registered: 2021-02-28
Posts: 10

Re: Cannot boot Arch USB on legacy mode

Hi,

Sorry for late reply. I did an install with a modified .iso using dd commands that you suggested. I was able to boot from USB and install it on a Legacy BIOS only mode with MBR setup.
I think this issue can be marked as solved. Although, I'm happy to do more Legacy BIOS and GTP setup testing if anyone has more ideas what might be an issue.

Thanks again to everyone who helped!

Offline

#20 2021-04-01 10:36:04

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 287

Re: Cannot boot Arch USB on legacy mode

For your installed system, I don't think it will be possible to BIOS/GPT boot with valid partition tables. You can try hybrid MBR, but I'd advise sticking to your current BIOS/MBR setup instead.

As for the official installation ISO where valid partition tables are not as important, I'd appreciate if you'd help solving this.
scdbackup will know better how to proceed further.

Offline

#21 2021-04-02 10:53:33

scdbackup
Member
Registered: 2013-05-30
Posts: 61

Re: Cannot boot Arch USB on legacy mode

Hi,

April 1st is over and sincerity mode is on again.
(I'm still riddling whether
  https://askubuntu.com/questions/1328670 … untu-20-04
is a double april joke, a single one, or none at all.)

As for the GPT allergy of the Thinkpad T420 firmware in CSM mode, which is
joke-wise a border case, i think that the only possible remedy is an ISO
without GPT.

Creating the partition table in MBR would be possible, but that would invite
  https://bugs.launchpad.net/ubuntu-cdimage/+bug/1886148
which together with
  https://bugs.launchpad.net/ubuntu-cdimage/+bug/1899308
yielded the format of current Ubuntu and ArchLinux ISOs as outmost compromise.
Actually it is already a bit overstretched.
So catering for the oldish T420 in CSM mode would drop support for newish
Lenovos V130 (>= 2016) and V14 IIL (>= 2019).

I can only propose to accompany the wiki section
  https://wiki.archlinux.org/index.php/Un … ical_media
by a section "Remove GPT from image for USB flash drive".

(The second point of the "Note:" in that wiki section is now outdated
because there is no MBR partition of type EF any more.
The first point is partly wrong, because the proposed xorriso run removes
UEFI support for USB stick, too. It is the motivation of the section which
applies to optical media only: The Macs have an allergy towards El Torito
entries for EFI, which get into effect on optical media only.)

The new section would point to the old one as luxury remedy with partition
table and would mention the shell commands

iso=archlinux-2021.02.01-x86_64.iso
dd if=/dev/zero conv=notrunc bs=1 seek=446 count=64 of="$iso"
dd if=/dev/zero conv=notrunc bs=1 seek=512 count=8 of="$iso"

as quick-and-dirty workaround for a USB stick which shall just boot on
legacy BIOS or EFI CSM. Such a stick will not offer any partition table.

I have a wiki account. Shall i write such a section ?
Would you proof-read it ?

If so: shall i edit the old "Note:" box, too ?
(And maybe add a xorriso run as alternative to the bsdtar run ?)

Have a nice day smile

Thomas

Offline

#22 2021-04-02 15:36:20

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 287

Re: Cannot boot Arch USB on legacy mode

You're the expert, so you're welcome to edit the wiki.
About xorriso (osirrox, I presume) vs bsdtar, if the section already requires libisoburn (for another xorriso command), then there's no harm in using xorriso instead of bsdtar.

Seeing as test1 (the unthinkable combination of -isohybrid-gpt-basdat and -append_partition big_smile ) works here, I wish we could know if works for Lenovo V130 and Lenovo V14 IIL too. If it does, then test1 would produce the perfect ISO that boots everywhere™.

Last edited by nl6720 (2021-04-02 15:36:44)

Offline

#23 2021-04-02 16:33:12

scdbackup
Member
Registered: 2013-05-30
Posts: 61

Re: Cannot boot Arch USB on legacy mode

Hi,

> You're the expert, so you're welcome to edit the wiki.

I am expert for xorriso and for what people usually do with it.
The Arch Linux ISO producer can at any time do something unexpected. smile)

> Seeing as test1 (the unthinkable combination of -isohybrid-gpt-basdat
> and -append_partition big_smile ) works here, I wish we could know if
> works for Lenovo V130 and Lenovo V14 IIL too.

sudodus, the owner of the V130, was the one who notified me about launchpad
bug 1886148.
See the IRC address on
  https://launchpad.net/~nio-wiklund
or the 4th line of a little project we did together:
  https://dev.lovelyhq.com/libburnia/libi … -dd-target

>  If it does, then test1 would produce the perfect ISO that boots everywhere™.

... until its head falls off by future bitrot.

If you really consider test1.iso, then also consider to just go back to the
old layout with -isohybrid-gpt-basdat and an EFI El Torito image which is
a file in the ISO.
This old layout is still used by Debian, Fedora, and others. Such a large
convoy is better protected from bitrot. (Chances are better that somebody
detects regressions before they can bite you.)

I will edit the wiki when you have decided about the layout question.

Have a nice day smile

Thomas

Offline

#24 2021-04-03 08:21:23

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 287

Re: Cannot boot Arch USB on legacy mode

I'll try contacting sudodus after the holidays.

One of my motivations for changing the layout was that I didn't like that El Torito image file in the ISO. Something about seeing that file there just annoyed me, so I'm very tempted to go with test1 ISO.  wink 

You may want to add it as another method to https://wiki.archlinux.org/index.php/US … _GNU/Linuxsmile

Last edited by nl6720 (2021-04-03 08:22:06)

Offline

#25 2021-04-03 09:58:38

scdbackup
Member
Registered: 2013-05-30
Posts: 61

Re: Cannot boot Arch USB on legacy mode

Hi,

> I didn't like that El Torito image file in the ISO.

Yes. That's ugly and only justfied by a decade of world-wide usage.

> I'm very tempted to go with test1 ISO.

Well, i have no means to stop you and will not intentionally obstruct your
decision. (That's about the most nice thing i can say about test1.iso.)

As for xorriso-dd-target, the new paragraph
  https://wiki.archlinux.org/index.php/US … -dd-target
became a bit lengthy. But about a third of it shows what actually should be
done around the proposed runs of cat, cp, dd, and tee.

Have a nice day smile

Thomas

Offline

Board footer

Powered by FluxBB