Bug 25924

Summary: Mageia-7.1-Live-Xfce-i586.iso hangs on some BIOS computers when booting from USB stick
Product: Mageia Reporter: Ihar Areshchankau <r0bur>
Component: Release (media or process)Assignee: Martin Whitaker <mageia>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Normal CC: lewyssmith, sysadmin-bugs, tmb
Version: 7Keywords: FOR_ERRATA7
Target Milestone: Mageia 8   
Hardware: i586   
OS: Linux   
Whiteboard:
Source RPM: CVE:
Status comment:
Attachments: Python3 program to fix Mageia-7.1 hybrid ISO MBR
rdsosreport.txt, 1st partition OS code = 0x17, system hang
rdsosreport.txt, 1st partition OS code = 0x00, system boot
Python3 program to fix Mageia-7.1 hybrid ISO MBR (2nd edition)

Description Ihar Areshchankau 2019-12-22 13:19:33 CET
Description of problem:
Live media hangs on BIOS computers when booting from USB stick.
rdsosreport.txt contains messages:
[ ] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ ] print_req_error: I/O error, dev loop0, sector 0 flags 0
[ ] SQUASHFS error: squashfs_read_data failed to read block 0x0
[ ] squashfs: SQUASHFS error: unable to read squashfs_super_block
[ ] print_req_error: I/O error, dev loop0, sector 0 flags 0
[ ] SQUASHFS error: squashfs_read_data failed to read block 0x0
[ ] squashfs: SQUASHFS error: unable to read squashfs_super_block
[ ] dracut Warning: /sysroot has no proper rootfs layout, ignoring and removing offending mount hook
[ ] dracut Warning: Can't mount root filesystem

Version-Release number of selected component (if applicable):
Mageia-7.1-Live-Xfce-i586.iso

How reproducible:

Every time when booting from bootable USB Stick.

Steps to Reproduce:
1. Write hybrid ISO image Mageia-7.1-Live-Xfce-i586.iso to an USB stick.
2. Choose BIOS setup boot source: Hard Drive -> USB stick
3. Boot the computer

The trouble is:
Hybrid ISO image Mageia-7.1-Live-Xfce-i586.iso MBR contains wrong first partition OS code: 0x17 instead 0x0.

How to fix:

Solution #1. Use "fdisk Mageia-7.1-Live-Xfce-i586.iso" to replace partition #1 OS code to 0.

Solution #2. Execute the Python 3 program (provided bellow) to the Mageia-7.1-Live-Xfce-i586.iso image:

#mageia-iso-fix.py
import sys, os
if len (sys.argv) != 2:
	print (" Mageia hybrid ISO image MBR patching utility.")
	print (" Usage:")
	print ("python3 mageia-iso-fix.py Mageia-...-i586.iso")
else:
	IsoFileName = sys.argv[1]
	FirstPartTypeOffset = 450
	MbrSignatureOffset = 510
	if not os.path.isfile (IsoFileName):
		print ("Error:", IsoFileName, "isn't a file name.")
	else:
		f = open (IsoFileName, "r+b")
		sector = bytearray (f.read (512))
		if sector[MbrSignatureOffset] != 0x55 or sector[MbrSignatureOffset + 1] != 0xAA:
			print ("Error:", IsoFileName, "doesn't have MBR.")
		elif sector[FirstPartTypeOffset] == 0:
			print (IsoFileName, "doesn't need to be patched.")
		else:
			print ("Patching", IsoFileName, " MBR:")
			print ("First partition code is:", hex (sector[FirstPartTypeOffset]))
			sector[FirstPartTypeOffset] = 0
			print ("First partition code changed to:", hex (sector[FirstPartTypeOffset]))
			f.seek (0)
			f.write (sector)
			print (IsoFileName, "is patched now.")
		f.close ()
Comment 1 Lewis Smith 2019-12-22 14:49:38 CET
Sorry for the trouble you are having.
Be assured that both 32-bit ISOs do get tested for booting from USB as well as DVD; and they are almost always BIOS/MBR systems.
Can we assume you did checksum the .iso file?
Can you say how you created the bootable USB stick?
Are you able to try from DVD?
------
I hope you will excuse me for assigning this to you, Martin; but it looks up your street for comment. Especially:
> The trouble is:
> Hybrid ISO image Mageia-7.1-Live-Xfce-i586.iso MBR contains wrong first
> partition OS code: 0x17 instead 0x0.
I recall seeing something similar previously - complaints about the squash FS; but cannot find exactly that.
"dracut Warning: Can't mount root filesystem" appears in other bugs, but not for the same reason.

Assignee: bugsquad => mageia
CC: (none) => lewyssmith

Comment 2 Thomas Backlund 2019-12-22 15:08:51 CET
Yes, squashfs errors like that always means either a broken iso download, or some failures when creating the usb from the iso

CC: (none) => tmb

Comment 3 Ihar Areshchankau 2019-12-22 15:26:06 CET
> Can we assume you did checksum the .iso file?

Yes, I've calculated checksum MD5 of Mageia-7.1-Live-Xfce-i586.iso using fciv utility:
//
// File Checksum Integrity Verifier version 2.05.
//
80ee334223a87d97212d8bcec1ce16d8 mageia-7.1-live-xfce-i586.iso

> Can you say how you created the bootable USB stick?
I've used "Win32 Disk Imager - 1.0"

> Are you able to try from DVD?

I've successfully installed VirtualBox VM using this ISO image as DVD image. But the trouble was appear when I've tried to boot up hardware computer (AMD 690G chipset based) using USB Stick.
Comment 4 Ihar Areshchankau 2019-12-22 15:37:04 CET
Created attachment 11418 [details]
Python3 program to fix Mageia-7.1 hybrid ISO MBR
Comment 5 Ihar Areshchankau 2019-12-22 17:36:22 CET
P.S. I see some correlation my issue with the Bug #23431.
Comment 6 Martin Whitaker 2019-12-22 17:37:53 CET
Changing the partition code to 0x00 would stop it working on other machines.

The fact that it failed at the point of mounting the squashfs filesystem means you have successfully booted and read from the iso9660 filesystem, so I don't understand how changing the partition code could make any difference. Could you change it back, boot, save a copy of the rdsosreport.txt, and attach that here. You should be able to manually mount another filesystem from the dracut prompt - either on your hard disk or on another USB stick.
Comment 7 Ihar Areshchankau 2019-12-22 17:54:03 CET
> The fact that it failed at the point of mounting the squashfs filesystem
> means you have successfully booted and read from the iso9660 filesystem, so
> I don't understand how changing the partition code could make any
> difference.
_GRUB2_ successfully booted and read kernel and initrd.img from iso9660 filesystem . But this base system can't mount partition that contains squashfs filesystem.
Comment 8 Martin Whitaker 2019-12-22 18:02:04 CET
The squashfs filesystem is a file contained in the iso9660 filesystem. It's mounted using a loopback. The first partition is a protective partition only, and should never be mounted or accessed.
Martin Whitaker 2019-12-23 01:21:48 CET

Keywords: (none) => NEEDINFO

Comment 9 Ihar Areshchankau 2019-12-23 09:46:52 CET
Created attachment 11424 [details]
rdsosreport.txt, 1st partition OS code = 0x17, system hang
Comment 10 Ihar Areshchankau 2019-12-23 09:47:47 CET
Created attachment 11425 [details]
rdsosreport.txt, 1st partition OS code = 0x00, system boot
Comment 11 Martin Whitaker 2019-12-23 15:06:59 CET
This is strange. On your machine blkid is returning a PART_UUID for the hidden partition. This doesn't happen on any machine I own. I'm really surprised blkid gives different results depending on what machine it is run on.

As already mentioned, we use code 0x17 because code 0x00 causes problems with some older BIOSs. So I'll have to try a different fix.

Keywords: NEEDINFO => FOR_ERRATA7
Target Milestone: --- => Mageia 8
Summary: Live media Mageia-7.1-Live-Xfce-i586.iso hangs on BIOS computers when booting from USB stick => Mageia-7.1-Live-Xfce-i586.iso hangs on some BIOS computers when booting from USB stick

Comment 12 Thomas Backlund 2019-12-23 15:22:59 CET
(In reply to Martin Whitaker from comment #11)
> This is strange. On your machine blkid is returning a PART_UUID for the
> hidden partition. This doesn't happen on any machine I own. I'm really
> surprised blkid gives different results depending on what machine it is run
> on.


I'm not sure the "Win32 Disk Imager" is capable of properly processing our hybrid isos.

If you want a tool on Windows, I suggest Rufus (from https://rufus.ie/), as it when it detects our hybrid, suggests to switch to dd and creates a working iso
Comment 13 Ihar Areshchankau 2019-12-23 15:28:45 CET
> I'm not sure the "Win32 Disk Imager" is capable of properly processing our
> hybrid isos.

"Win32 Disk Imager" is nice GUI tool that does the same things as "dd" Unix utility.
Comment 14 Ihar Areshchankau 2019-12-23 15:35:33 CET
> This is strange. On your machine blkid is returning a PART_UUID for the
> hidden partition. This doesn't happen on any machine I own. I'm really
> surprised blkid gives different results depending on what machine it is run
> on.

I'm glad to provide new information.

> As already mentioned, we use code 0x17 because code 0x00 causes problems
> with some older BIOSs. So I'll have to try a different fix.

Understood. It was just simplest way to solve my personal trouble.

Thank you!
Comment 15 Martin Whitaker 2019-12-23 19:15:09 CET
I've pushed a change to the dracut mgalive module in cauldron, which should fix this for Mageia 8.
Comment 16 Ihar Areshchankau 2019-12-23 19:17:15 CET
(In reply to Martin Whitaker from comment #15)
> I've pushed a change to the dracut mgalive module in cauldron, which should
> fix this for Mageia 8.

Great!
Comment 17 Lewis Smith 2019-12-25 22:00:28 CET
Gosh! What a buzz of activity. Thanks to Martin for jumping in with the usual expertise. Surprised a fix was needed (for M8). Does the bug have to remain open until then, or can it be closed fixed?

Is the Classic 32-bit ISO affected?
@Ihar: did you try that? (Should have asked this before).
Comment 18 Ihar Areshchankau 2019-12-26 12:20:44 CET
> Is the Classic 32-bit ISO affected?
> @Ihar: did you try that? (Should have asked this before).

The Mageia-7.1-i586.iso image works on that PC well, it doesn't need any modification.

The another trouble with Mageia-7.1-Live-Xfce-i586.iso is that it doesn't boot up on AMD-64 hardware in UEFI mode. It displays a black screen only. After I placed bootx64.efi in the EFI partition it displays GRUB starting menu. But when I select some menu item and press [Enter], the black screen appears and nothing happened.

I don't know is it bug or a feature?
Comment 19 Martin Whitaker 2019-12-28 21:29:57 CET
@Lewis, the bug should remain open. I can't verify the fix, as the bug does not manifest on any of my hardware.

@Ihar, yes, the 32-bit media only support 32-bit UEFI boot.
Comment 20 Ihar Areshchankau 2019-12-29 10:42:58 CET
Created attachment 11436 [details]
Python3 program to fix Mageia-7.1 hybrid ISO MBR (2nd edition)

I found another workaround to make bootable USB stick for my PC. It is to replace first MBR partition record with the second one and zeroing second partition record. I assume this way will be acceptable for all PCs that boots for now.
Yes, we've lost the data protection. But this protection has matter when using partitioning tools only. I think nobody uses fdisk or GPartEd for the live USB media.

Attachment 11418 is obsolete: 0 => 1

Comment 21 Lewis Smith 2019-12-29 17:48:13 CET
(In reply to Martin Whitaker from comment #19)
> @Lewis, the bug should remain open. I can't verify the fix, as the bug does
> not manifest on any of my hardware.
We shall have to remember to ask Ihar to test it - on the box which gave the trouble. So Ihar please keep it!
Comment 22 Ihar Areshchankau 2020-07-06 17:24:29 CEST
(In reply to Lewis Smith from comment #21)
> We shall have to remember to ask Ihar to test it - on the box which gave the
> trouble. So Ihar please keep it!

Hello again!

I'm happy to confirm that the trouble of this ticket is solved with the release "Mageia 8 alpha".

I've tested "Mageia-8-alpha1-Live-Xfce-i586.iso" image and it boots correctly on my hardware without any modifications.

So you may close this ticket.
@Martin, @Lewis - thank you very much!
Comment 23 Martin Whitaker 2020-07-06 18:23:32 CEST
Thanks for remembering to test this Ihar!

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 24 Lewis Smith 2020-07-07 20:29:16 CEST
I second that. It really helps when users report back.
Comment 25 Mageia Robot 2024-04-25 08:07:30 CEST
commit 0cee55d5a1b60cc67a623f0b107a950633ed72fc
Author: Jybz <j.biernacki@...>
Date:   Sat Apr 20 22:22:14 2024 +0200

    Updated to support encrypted persistent partition and fix mga#25924.
    
    - origin:
      https://svnweb.mageia.org/packages/cauldron/dracut/current/SOURCES/0511-mgalive-A-module-to-mount-Mageia-Live-media.patch?r1=1368035&r2=1469756
    - mgalive: support encrypted persistent partitions (mga#25191)
    - mgalive: fix boot failure on some machines (mga#25924)
---
 Commit Link:
   https://gitweb.mageia.org/software/mageia-dracut-conf/commit/?id=0cee55d5a1b60cc67a623f0b107a950633ed72fc

 Bug links:
   Mageia
      https://bugs.mageia.org/25191
      https://bugs.mageia.org/25924