1

So I'm building a custom Linux-based OS, and I chose to run it as a RAM disk (initramfs). Unfortunately, I keep getting a Kernel Panic during boot.

RAMDISK: gzip image found at block 0
using deprecated initrd support, will be removed in 2021.
exFAT-fs (ram0): invalid boot record signature
exFAT-fs (ram0): failed to read boot sector
exFAT-fs (ram0): failed to recognize exfat type
exFAT-fs (ram0): invalid boot record signature
exFAT-fs (ram0): failed to read boot sector
exFAT-fs (ram0): failed to recognize exfat type
List of all partitions:
0100            4096 ram0 
 (driver?)
0101            4096 ram1 
 (driver?)
0102            4096 ram2 
 (driver?)
0103            4096 ram3 
 (driver?)
0104            4096 ram4 
 (driver?)
0105            4096 ram5 
 (driver?)
0106            4096 ram6 
 (driver?)
0107            4096 ram7 
 (driver?)
0108            4096 ram8 
 (driver?)
0109            4096 ram9 
 (driver?)
010a            4096 ram10 
 (driver?)
010b            4096 ram11 
 (driver?)
010c            4096 ram12 
 (driver?)
010d            4096 ram13 
 (driver?)
010e            4096 ram14 
 (driver?)
010f            4096 ram15 
 (driver?)
No filesystem could mount root, tried: 
 vfat
 msdos
 exfat
 ntfs
 ntfs3

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

Any chance this is something missing in my kernel build?

Here's how I've designed the OS:

Component My Choice
Init Daemon initrd
Commands busybox 1.35.0
Kernel Linux 5.15.12
filesystem msdos, fat, exfat, ext2, ext3, or ext4
Bootloader syslinux or extlinux

NOTES: I tried each file system one at a time, and all provide the same response, which leads me to believe that it is not an issue with the filesystem itself. I also tried both syslinux and extlinux for testing purposes.

Here's how I've structured my disk:

/media/vfloppy
└── [        512 Jan  3 08:06]  boot
    ├── [      36896 Jan  3 08:06]  initramfs.cpio.gz
    ├── [        512 Jan  3 08:06]  syslinux
    │   ├── [        283 Jan  3 08:06]  boot.msg
    │   ├── [     120912 Jan  3 08:06]  ldlinux.c32
    │   ├── [      60928 Jan  3 08:06]  ldlinux.sys
    │   └── [        173 Jan  3 08:06]  syslinux.cfg
    └── [     939968 Jan  3 08:06]  vmlinux

Here is my syslinux.cfg:

DISPLAY boot.msg
DEFAULT linux
label linux
    KERNEL /boot/vmlinux
    INITRD /boot/initramfs.cpio.gz
    APPEND root=/dev/ram0 init=/init loglevel=3
PROMPT 1    
TIMEOUT 10
F1 boot.msg

I've also enabled the following filesystem options in my kernel's .config file:

CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_FS_IOMAP=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_FS_MBCACHE=y
CONFIG_EXPORTFS_BLOCK_OPS=y
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_PROC_FS=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_RD_GZIP=y
CONFIG_DECOMPRESS_GZIP=y
0

2 Answers 2

0

What's the state of CONFIG_BLK_DEV_INITRD option? It should be just before the CONFIG_INITRAMFS_SOURCE, and I believe it should be enabled.

CONFIG_BLK_DEV_RAM is a generic RAM disk, while CONFIG_BLK_DEV_INITRD would be the initramfs/initrd specifically.

Since your initramfs.cpio.gz is gzipped, you'll also need CONFIG_RD_GZIP=y.

2
  • It's showing as CONFIG_BLK_DEV_INITRD=y, so it should be enabled. I'll update the original post to reflect it. Jan 3 at 16:47
  • GZIP is also enabled. CONFIG_HAVE_KERNEL_GZIP=y, CONFIG_RD_GZIP=y, and CONFIG_DECOMPRESS_GZIP=y Jan 3 at 17:24
0

The issue in this instance was directly related to the CPIO archive I created. Although I was using the correct cpio and gzip commands, I was piping incorrectly due to a typo in the TinyCore book. Using the following command, I was able to create a cpio file that was readable:

cd fs_folder
sudo find | sudo cpio -o -H newc > ../fs.cpio
gzip -2 ../fs.cpio
advdef -z4 ../fs.cpio.gz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.