You are not logged in.

#1 2021-09-16 07:31:27

riadkabir45
Member
Registered: 2021-09-16
Posts: 4

No devices detected in initramfs shell

I made a custom initramfs with busybox. Now when i boot with kernel from any iso, no devices are detected. No reaction in dmesg. But when i compile a kernel with defconfig, everything works fine. I see my pluged device light on.

Now i cant send any log here as even my internal hard disk not detected.

I tried mdev -s but no /dev/sdX or /dev/block

Even the /sys/block is empty.

Again none of this are present when i boot with my compiled kernel. And stock kernel works fine in its stock system

Offline

#2 2021-09-16 08:12:47

Wild Penguin
Member
Registered: 2015-03-19
Posts: 320

Re: No devices detected in initramfs shell

riadkabir45 wrote:

I made a custom initramfs with busybox. Now when i boot with kernel from any iso, no devices are detected. No reaction in dmesg. But when i compile a kernel with defconfig, everything works fine. I see my pluged device light on.

What devices? You need to be more specific. Are these SATA HDDs, USB devices or something else?

In any case, you've made an initramfs for another Kernel you are using it with. What you are seeing is expected. You can not use an initramfs (or it's modules) for a different Kernel on another.

riadkabir45 wrote:

Now i cant send any log here as even my internal hard disk not detected.

There may be other ways, such as SSHing to another computer. This might not work if all you get is the busybox recovery shell, though. I don't remember the tools it has - maybe netcat?

This should be moved to the newbie section IMHO...

Offline

#3 2021-09-21 09:16:20

riadkabir45
Member
Registered: 2021-09-16
Posts: 4

Re: No devices detected in initramfs shell

The initramfs has nothing unique to specific kernel. Its structure is

+----dev
|
+----sys
|
+----proc
|
+----bin
|      +----busybox
|
+----init

init:

#!/bin/busybox sh
/bin/busybox --install -s /bin
mount -t devtmpfs udev /dev
mount -t sysfs sysfs /sys
mount -t proc proc /proc
sysctl -w kernel.printk="2 4 1 7"
ash -i

This works with any version of kernel compiled with defconfig
but not kernels from iso

Offline

#4 2021-09-21 10:07:54

frostschutz
Member
Registered: 2013-11-15
Posts: 1,418

Re: No devices detected in initramfs shell

Kernel drivers can be built-in or compiled as a separate module. If it's a module, it has to included into the initramfs and the initramfs then has to load the module. Without modules for devices and filesystems, you can't detect devices, and can't mount filesystems. So unless you use custom kernel where all drivers necessary to mount real rootfs are built in, you have to deal with kernel modules in your initramfs.

If you are by chance coming from this Custom Initramfs guide https://wiki.gentoo.org/wiki/Custom_Ini … figuration

Warning
Also enable all drivers, filesystems, compression methods and other settings that are required for booting and accessing your root partition. If you select such drivers as modules, you'll have to collect and integrate the module files into your initramfs and load them in your /init. Generally this means a lot of unnecessary extra work, so just use built-in drivers for now.

In ArchLinux, if you want to do some custom action in initramfs, you might want to write it as an initcpio hook instead. https://wiki.archlinux.org/title/Mkinitcpio#HOOKS

The Arch wiki also has a suggestion how to customize it even further here: https://wiki.archlinux.org/title/Mkinit … _initramfs

Offline

#5 2021-09-21 10:23:14

riadkabir45
Member
Registered: 2021-09-16
Posts: 4

Re: No devices detected in initramfs shell

Sorry if i am becoming annoying tongue

But if the kernel needs modules to detect disks and mount them, how does it make use of 'root=/dev/sda2' argument. As there is not modules in the stock  initramfs except the microcode for amd cpus while mine is intel.

Offline

#6 2021-09-21 10:41:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,736

Re: No devices detected in initramfs shell

Of course there are modules in the stock initramfs, precisely due to the situation described by frostschutz, what makes you claim there aren't ? For reference, from my system with a default mkinitcpio.conf lsinitcpio initramfs-linux.img gives

bin
buildconfig
config
dev/
etc/
etc/fstab
etc/initrd-release
etc/ld.so.cache
etc/ld.so.conf
etc/modprobe.d/
etc/mtab
hooks/
hooks/udev
init
init_functions
lib
lib64
new_root/
proc/
run/
sbin
sys/
tmp/
usr/
usr/bin/
usr/bin/[
usr/bin/arch
usr/bin/ash
usr/bin/awk
usr/bin/base32
usr/bin/base64
usr/bin/basename
usr/bin/bc
usr/bin/blkdiscard
usr/bin/blkid
usr/bin/busybox
usr/bin/bzip2
usr/bin/cat
usr/bin/chgrp
usr/bin/chmod
usr/bin/chown
usr/bin/chroot
usr/bin/clear
usr/bin/cp
usr/bin/cpio
usr/bin/cttyhack
usr/bin/cut
usr/bin/dd
usr/bin/depmod
usr/bin/df
usr/bin/dirname
usr/bin/dmesg
usr/bin/du
usr/bin/echo
usr/bin/env
usr/bin/expr
usr/bin/fallocate
usr/bin/false
usr/bin/fatattr
usr/bin/free
usr/bin/fsck
usr/bin/fsck.ext2
usr/bin/fsck.ext3
usr/bin/fsck.ext4
usr/bin/fsfreeze
usr/bin/fstrim
usr/bin/fsync
usr/bin/getopt
usr/bin/grep
usr/bin/gzip
usr/bin/halt
usr/bin/head
usr/bin/hexdump
usr/bin/hexedit
usr/bin/i2ctransfer
usr/bin/ifconfig
usr/bin/init
usr/bin/insmod
usr/bin/install
usr/bin/ip
usr/bin/ipaddr
usr/bin/iplink
usr/bin/ipneigh
usr/bin/iproute
usr/bin/iprule
usr/bin/iptunnel
usr/bin/kbd_mode
usr/bin/kill
usr/bin/killall
usr/bin/kmod
usr/bin/less
usr/bin/link
usr/bin/ln
usr/bin/loadfont
usr/bin/loadkmap
usr/bin/losetup
usr/bin/ls
usr/bin/lsmod
usr/bin/lsscsi
usr/bin/lzop
usr/bin/md5sum
usr/bin/mim
usr/bin/mkdir
usr/bin/mkfifo
usr/bin/mknod
usr/bin/mkpasswd
usr/bin/mktemp
usr/bin/modinfo
usr/bin/modprobe
usr/bin/mount
usr/bin/mountpoint
usr/bin/mv
usr/bin/nc
usr/bin/netstat
usr/bin/nologin
usr/bin/nproc
usr/bin/nsenter
usr/bin/nslookup
usr/bin/nuke
usr/bin/openvt
usr/bin/partprobe
usr/bin/paste
usr/bin/pgrep
usr/bin/pidof
usr/bin/ping
usr/bin/ping6
usr/bin/poweroff
usr/bin/printf
usr/bin/ps
usr/bin/pwd
usr/bin/readlink
usr/bin/realpath
usr/bin/reboot
usr/bin/resume
usr/bin/rm
usr/bin/rmdir
usr/bin/rmmod
usr/bin/route
usr/bin/run-init
usr/bin/sed
usr/bin/seq
usr/bin/setfattr
usr/bin/setfont
usr/bin/sh
usr/bin/sha1sum
usr/bin/sha256sum
usr/bin/sha512sum
usr/bin/shuf
usr/bin/sleep
usr/bin/sort
usr/bin/stat
usr/bin/strings
usr/bin/switch_root
usr/bin/sync
usr/bin/systemd-tmpfiles
usr/bin/tac
usr/bin/tail
usr/bin/tar
usr/bin/tcpsvd
usr/bin/tee
usr/bin/telnet
usr/bin/test
usr/bin/tftp
usr/bin/touch
usr/bin/true
usr/bin/truncate
usr/bin/ts
usr/bin/udevadm
usr/bin/udhcpc
usr/bin/udhcpc6
usr/bin/umount
usr/bin/uname
usr/bin/uniq
usr/bin/unlink
usr/bin/unshare
usr/bin/unzip
usr/bin/uptime
usr/bin/vi
usr/bin/wc
usr/bin/wget
usr/bin/which
usr/bin/xxd
usr/bin/xz
usr/bin/yes
usr/lib/
usr/lib64
usr/lib/ld-linux-x86-64.so.2
usr/lib/libacl.so.1
usr/lib/libaudit.so.1
usr/lib/libblkid.so.1
usr/lib/libcap-ng.so.0
usr/lib/libcap.so.2
usr/lib/libcom_err.so.2
usr/lib/libcrypto.so.1.1
usr/lib/libcrypt.so.2
usr/lib/libc.so.6
usr/lib/libdl.so.2
usr/lib/libe2p.so.2
usr/lib/libext2fs.so.2
usr/lib/libffi.so.7
usr/lib/libgcrypt.so.20
usr/lib/libgpg-error.so.0
usr/lib/libip4tc.so.2
usr/lib/libkmod.so.2
usr/lib/liblz4.so.1
usr/lib/liblzma.so.5
usr/lib/libmount.so.1
usr/lib/libp11-kit.so.0
usr/lib/libpam.so.0
usr/lib/libpthread.so.0
usr/lib/librt.so.1
usr/lib/libseccomp.so.2
usr/lib/libuuid.so.1
usr/lib/libz.so.1
usr/lib/libzstd.so.1
usr/lib/modprobe.d/
usr/lib/modprobe.d/bluetooth-usb.conf
usr/lib/modprobe.d/nvdimm-security.conf
usr/lib/modprobe.d/systemd.conf
usr/lib/modules/
usr/lib/modules/5.14.6-arch1-1/
usr/lib/modules/5.14.6-arch1-1/kernel/
usr/lib/modules/5.14.6-arch1-1/kernel/cdrom.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/crc16.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/crc32c_generic.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/crc32c-intel.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/crc-itu-t.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/ext4.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/firewire-core.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/firewire-sbp2.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/hid-logitech-dj.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/hid-logitech-hidpp.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/jbd2.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/mbcache.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/mmc_block.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/mmc_core.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/sr_mod.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/usbhid.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/usb-storage.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/virtio_blk.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/xhci-pci.ko.zst
usr/lib/modules/5.14.6-arch1-1/kernel/xhci-pci-renesas.ko.zst
usr/lib/modules/5.14.6-arch1-1/modules.alias.bin
usr/lib/modules/5.14.6-arch1-1/modules.builtin.alias.bin
usr/lib/modules/5.14.6-arch1-1/modules.builtin.bin
usr/lib/modules/5.14.6-arch1-1/modules.dep.bin
usr/lib/modules/5.14.6-arch1-1/modules.devname
usr/lib/modules/5.14.6-arch1-1/modules.softdep
usr/lib/modules/5.14.6-arch1-1/modules.symbols.bin
usr/lib/systemd/
usr/lib/systemd/libsystemd-shared-249.so
usr/lib/systemd/systemd-udevd
usr/lib/udev/
usr/lib/udev/ata_id
usr/lib/udev/rules.d/
usr/lib/udev/rules.d/50-udev-default.rules
usr/lib/udev/rules.d/60-persistent-storage.rules
usr/lib/udev/rules.d/64-btrfs.rules
usr/lib/udev/rules.d/80-drivers.rules
usr/lib/udev/scsi_id
usr/local/
usr/local/bin
usr/local/lib
usr/local/sbin
usr/sbin
var/
var/run
VERSION

Offline

#7 2021-09-21 10:53:26

frostschutz
Member
Registered: 2013-11-15
Posts: 1,418

Re: No devices detected in initramfs shell

root=/dev/sda2 (booting without initramfs) also only works if block device and filesystem driver (for whatever filesystem is on sda2) is built-in.

Before initramfs it was normal for core drivers to be built-in, and only have exotic, non-boot-related drivers as modules. with initramfs, it's possible to make everything a module.

Of course that leads to a huge filesize initramfs, which is why mkinitcpio tries to detect and remove unnecessary modules, which in turn causes keyboards to not work when booting for some people. Modules are annoying, they're never loaded when you need them, but at the same time it's the only way to make a generic kernel that supports nearly every possible hardware configuration without making everything no matter how exotic as a built-in driver, making the kernel huge for everyone.

If you are rolling your custom initramfs, and also building your own custom kernel, you can opt to disable the module system altogether and have built-in support for all drivers you actually need. That way you don't have to deal with modules in initramfs and don't have to rebuild initramfs for every new kernel. However in that case, whenever you add a new piece of hardware to the system, you'll have to recompile kernel to support it.

Last edited by frostschutz (2021-09-21 10:56:52)

Offline

#8 2021-09-21 11:53:48

Wild Penguin
Member
Registered: 2015-03-19
Posts: 320

Re: No devices detected in initramfs shell

I was assuming op was using an initramfs (either knowingly or not knowing it) with Kernel modules, as that would be an obvious reason why devices are not detected. I don't specifically know the differences between the kernels in question, but it seemed like a kernel module problem. But I may have been jumping into conclusions too soon? Even if I wasn't, my reply was poorly formatted. Initramfs can indeed contain other things besides modules.

But having a generic intitramfs (for many Kernels) is new information, if this was meant to be implied? I've been under the impression that the initramfs is supposed to be used with a certain Kernel (and not several different Kernels, although a Kernel may have several alternative initramfs for different setups).

Either way, we need more information from op, to help op, I think? smile

Offline

#9 2021-09-21 16:51:35

riadkabir45
Member
Registered: 2021-09-16
Posts: 4

Re: No devices detected in initramfs shell

This is my stock initramfs. BTW its debian tongue(Sorry but i tried asking in alot of sites,no answer)

.
./kernel
./kernel/x86
./kernel/x86/microcode
./kernel/x86/microcode/AuthenticAMD.bin

And this is my custom initramfs

.
./dev
./bin
./bin/busybox
./init
./proc
./sys

I first also thought this is due to modules. But when i saw the stock initramfs has no modules, i was like wtf? how? why?
And i also noticed there was not hotplag file in proc. Which is a feature of UDEV_HELPER. I even tried copying the microcode thinnking maybe theres a role for it.

So first i though  ye maybe udev missing so kernel cant read disks. But after seeing the empty initrd, i am crazy for the answer "How tf the kernel does it!!!!!!!"(Mind my language tongue)

Also i noticed pluging my usb mouse does noting in dmesg.

Also i want to note that this custom initramfs works when i boot from any kernel compiled with defconfig. (Tested with 4.19,5.11,5,13)

Last edited by riadkabir45 (2021-09-21 16:59:12)

Offline

#10 2021-09-21 17:31:00

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,736

Re: No devices detected in initramfs shell

Again, if the modules are built-in, you won't see them, unless you post your resultant kernel config which would show what it's actually doing we can only really do random guess work based on how things should be.

Offline

Board footer

Powered by FluxBB