Re: kernel panic booting from USB flash drive

"Xi Ruoyao" ([email protected] via lfs-support Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.support
Message-ID <[email protected]>
On Sun, 2024-10-13 at 21:22 -0700, Michael Peters wrote:
> Build Host: x86_64 LFS 11.3 SystemV running kernel 6.6.56
> 
> I'm building LFS 12.2 SystemD (also kernel 6.6.56, I prefer LTS kernels) to a
> USB flash drive (using shell scripts) with the intent of then booting from the
> USB flash drive to re-run my scripts to build it to a partition on the hd.
> 
> Everything is working well *except* the boot.
> 
> The flash drive is a single ext4 partition created by using fdisk (LFS 11.3) to
> delete what the manufacturer put on it, create a single primary partition of
> type Linux, and marking the partition bootable in fdisk.
> 
> I then format the single partition with mkfs.ext4 (I *probably* should have used
> ext2 but that's not the issue).

You can use an ext4 w/o journal instead of ext2 (turning off the journal
with some mkfs.ext4 option, I cannot remember the option precisely but
IIRC it's possible).

And yes it's not the issue anyway.

/* snip */

>     [    0.605403]  msdos
>     [    0.605474]  iso9660
>     [    0.605545]
>     [    0.605685] Kernel panic - not syncing: VFS: Unable to mount root fs on unkno
>     wn-block(0,0)

One issue here is the panic message is trimmed (because the VGA output
area cannot fit too many lines).  On EFI (where we use SimpleDRM) the
panic message can be pretty broken because panic output on DRM has been
broken since day 1.  Both are very annoying for diagnostic.

I'm taking a look at the new "DRM panic" support in Linux 6.12 and see
if it can solve the issue.

Still it looks like you've not set CONFIG_EXT4 to y, because the kernel
seems dumping a list of available filesystems to indicate you are
lacking something.

Note that setting it to M won't work because it would create a chicken-
or-egg problem.

/* snip */

> Same kernel config used as what works with LFS 11.3 but I wonder if maybe there
> are some kernel options I need (or need as built-in instead of modular) to boot
> a kernel off of USB? Anyone know?

See above.  Just remember you need to avoid the chicken-or-egg problem
(i.e. remember any module can only be loaded after the file system
containing the kernel modules is mounted) and you should be able to
figure it out on your own.

> Would it be better to make an initramfs that lets kernel modules load before the
> filesystem is mounted and does anyone have a clear reference to that process?

No, unless you really need to make an universal distro or using some
advanced partitioning scheme like LVM.

Just making some drivers (mainly, AHCI, NVME, EXT4_FS, and in the case
of booting from USB also XHCI_HCD, XHCI_PCI, USB_STORAGE, USB_UAS)
built-in instead of modules should be enough to boot on all "normal"
desktop or laptop models launched in the recent 10 years.

-- 
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-support
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.