Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Fresh install, grub runs, but will not mount rootfs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Fri Jan 28, 2022 11:28 am    Post subject: [SOLVED] Fresh install, grub runs, but will not mount rootfs Reply with quote

I just did a fresh install.
This is an Intel Atom system.
I used stage3-amd64-openrc-20211226T170559Z.tar.xz to install
Kernel parameters are taken from kernel-config-5.4.80-gentoo-r1-x86_64 found in the above as base.
I'm using DOS MBR.
/etc/fstab
Code:
livecd /tmp # tail -4 /mnt/gentoo/etc/fstab
/dev/sda1               /boot           vfat            defaults,noatime        0 2
/dev/sda3               /               ext4            noatime                 0 1
/dev/sda2               none            swap            sw                      0 0

Booting results in kernel panic, unable to mount root fs
https://imgur.com/a/ZI85zZx

Any ideas as what I've done wrong?


Last edited by pgu on Sun Jan 30, 2022 7:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Fri Jan 28, 2022 4:53 pm    Post subject: Reply with quote

Missing kernel config for either filesystem and/or block device.
Also make sure in /etc/default/grub you have
"root=......... rootfstype=..........."
Some kernel config to wet your appetite.
Code:

CONFIG_BLK_CGROUP=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_BLK_RQ_ALLOC_TIME=y
CONFIG_BLK_CGROUP_RWSTAT=y
CONFIG_BLK_DEV_BSG_COMMON=y
CONFIG_BLK_DEV_BSGLIB=y
CONFIG_BLK_DEV_INTEGRITY=y
CONFIG_BLK_DEV_INTEGRITY_T10=y
CONFIG_BLK_DEV_ZONED=y
CONFIG_BLK_DEV_THROTTLING=y
CONFIG_BLK_DEV_THROTTLING_LOW=y
CONFIG_BLK_WBT=y
CONFIG_BLK_WBT_MQ=y
CONFIG_BLK_CGROUP_IOLATENCY=y
CONFIG_BLK_CGROUP_FC_APPID=y
CONFIG_BLK_CGROUP_IOCOST=y
CONFIG_BLK_CGROUP_IOPRIO=y
# CONFIG_BLK_DEBUG_FS is not set
CONFIG_BLK_SED_OPAL=y
CONFIG_BLK_INLINE_ENCRYPTION=y
CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y
CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_BLK_MQ_RDMA=y
CONFIG_BLK_PM=y
CONFIG_MTD_BLKDEVS=m
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_NULL_BLK=m
CONFIG_BLK_DEV_FD=m
CONFIG_BLK_DEV_PCIESSD_MTIP32XX=m
CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_LOOP_MIN_COUNT=0
CONFIG_BLK_DEV_DRBD=m
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_SX8=m
CONFIG_BLK_DEV_RAM=m
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=16384
CONFIG_XEN_BLKDEV_FRONTEND=m
CONFIG_XEN_BLKDEV_BACKEND=m
CONFIG_VIRTIO_BLK=m
CONFIG_BLK_DEV_RBD=m
CONFIG_BLK_DEV_RSXX=m
CONFIG_BLK_DEV_RNBD=y
CONFIG_BLK_DEV_RNBD_CLIENT=m
CONFIG_BLK_DEV_RNBD_SERVER=m
CONFIG_BLK_DEV_NVME=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_SR=m
CONFIG_BLK_DEV_BSG=y
CONFIG_BLK_DEV_3W_XXXX_RAID=m
CONFIG_BLK_DEV_MD=m
CONFIG_BLK_DEV_DM_BUILTIN=y
CONFIG_BLK_DEV_DM=m
CONFIG_BLK_DEV_PMEM=m
CONFIG_ND_BLK=m

and
CONFIG_EXT4_FS=m
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y



Ofcourse you should use make menuconfig
Plz see
https://wiki.gentoo.org/wiki/Ext4#Kernel
https://wiki.gentoo.org/wiki/NVMe#Kernel
https://wiki.gentoo.org/wiki/HDD#Kernel
_________________
:)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Fri Jan 28, 2022 5:20 pm    Post subject: Reply with quote

pgu,

Code:
unknown-block(0,0)
in your image says the the kernel cannot see the drive that your rootfs is on.
The (0,0) is the kernel major,minor device number.

We need your kernel .config on a pastebin to see what you have and the output of
Code:
lspci -nnk
to see what you should have.

Tell us how you configured and made your kernel too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sun Jan 30, 2022 8:09 am    Post subject: Reply with quote

Thanks for the feedback.

The kernel on the install stick is working so I copied it by:
Code:
cp /etc/kernels/kernel-config-5.4.80-gentoo-r1-x86_64 .config


Then in the chroot env I did make oldconfig and accepted the default value for any new parameter.
The .config.old is identical to kernel-config-5.4.80-gentoo-r1-x86_64 as expected:

Code:
livecd /mnt/gentoo/usr/src/linux # md5sum .config.old  /etc/kernels/kernel-config-5.4.80-gentoo-r1-x86_64
66051fb1f2680bb2b726aa49d79c279a  .config.old
66051fb1f2680bb2b726aa49d79c279a  /etc/kernels/kernel-config-5.4.80-gentoo-r1-x86_64


The way I built it was:
Code:
make oldconfig
make; make modules_install; make install



This is the output of lspci:
https://pastebin.com/KkYav2NH

This is the diff of the kernel parameters suggested by alamahant in my .config, /proc/config.gz and kernel-config-5.4.80-gentoo-r1-x86_64
https://pastebin.com/i0dN3c1Y

This is the full .config
https://pastebin.com/603bbSsd

I did not modify /etc/default/grub, but the parameter automatically selected for root is correct:
Code:
livecd ~ # grep linux.*root= /mnt/gentoo/boot/grub/grub.cfg
        linux   /vmlinuz-5.15.16-gentoo-x86_64 root=/dev/sda3 ro 
                linux   /vmlinuz-5.15.16-gentoo-x86_64 root=/dev/sda3 ro 
                linux   /vmlinuz-5.15.16-gentoo-x86_64 root=/dev/sda3 ro single
                linux   /vmlinuz-5.15.11-gentoo-x86_64 root=/dev/sda3 ro 
                linux   /vmlinuz-5.15.11-gentoo-x86_64 root=/dev/sda3 ro single
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sun Jan 30, 2022 11:02 am    Post subject: Reply with quote

This is the outout of
Code:
gzip -dc /proc/config.gz | diff - /mnt/gentoo/usr/src/linux/.config


https://pastebin.com/HCLe70S8

I could try to repeat the procedure with a more recent install image since it will be closer to 5.15.16, perhaps even built with the same gcc.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Sun Jan 30, 2022 1:20 pm    Post subject: Reply with quote

pgu,

The kernel on the install stick is a fully modular kernel.
It requires a initrd to hold the modules so that they can be loaded before root is mounted.

Some will be needed to mount root too, hence your
Code:
unknown-block(0,0)
as your build process does not include the initrd.

There are two ways forward. Make an initrd with either genkernel, dracut or do it yourself.
genkernel will build the kernel, initrd and install it for you.

The other way is to configure the kernel to be able to boot without the aid of an initrd.
As this is Gentoo, the choice is yours.

Your HDD controller is
Code:
00:1f.2 IDE interface [0101]: Intel Corporation NM10/ICH7 Family SATA Controller [IDE mode] [8086:27c0] (rev 02)
        Subsystem: ZOTAC International (MCO) Ltd. NM10/ICH7 Family SATA Controller [IDE mode] [19da:a140]
        Kernel driver in use: ata_piix
        Kernel modules: ata_piix, pata_acpi, ata_generic

Don't run it in IDE Mode. That's slow and broken. It was intended to allow Windows XP users to install the ahci driver before they could switch to AHCI mode forever.
Many chipsets that support both IDF and AHCI modes only support PIO in IDE mode, hence slow.
Fix that in the BIOS.

To read the HDD and the filesystems it contains.

So far so good:
CONFIG_BLOCK=y
CONFIG_MSDOS_PARTITION=y
CONFIG_EFI_PARTITION=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y


Code:
CONFIG_SCSI_LOWLEVEL=y
Turn that off. Its a menu full of drivers for things you don't have. Save the bloat and compile time.

The following need to be built in, not modules.
Code:
CONFIG_ATA=m
CONFIG_SATA_AHCI=m
CONFIG_ATA_PIIX=m

That will fix your
Code:
unknown-block(0,0)
error but it may only change the numbers.
Having gained access to the the drive, the kernel needs to understand what it finds there. You need at least ext4 support.
vfat is not required to boot bet you will need it for kernel updates, so its a good idea to have it too.
Code:
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
...
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=y
Is all good.

Having got to the login prompt, its a good idea for your keyboard to work. DEVTMPFS and udev should make that happen.
USB support on your system requires uhci_hcd and ehci-pci

Code:
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_PCI=m
CONFIG_USB_EHCI_FSL=m
CONFIG_USB_UHCI_HCD=m
should all be built in too. Just in case.

Make those changes with
Code:
make menconconfig
not your favourite editor.

There is another trap in grub2 that you need to fix too.
The grub autoblackmagic likes to use root=UUID=<FIlesystem_UUID> to tell where the root filesystem is. That requires the userspace mount command, which in turn requires an initrd to hold it.
The kernel understands root=/dev/sda3, or root=PARTUUID=<Partition_UUID>

You need to use one or the other in grub.cfg, because root=UUID= will fail to mount root too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sun Jan 30, 2022 7:12 pm    Post subject: Reply with quote

Thank you NeddySeagoon,

NeddySeagoon wrote:
pgu,

The kernel on the install stick is a fully modular kernel.
It requires a initrd to hold the modules so that they can be loaded before root is mounted.


Yes, my assumption that the install stick kernel should be safe was wrong.


NeddySeagoon wrote:
pgu,
The following need to be built in, not modules.
Code:
CONFIG_ATA=m
CONFIG_SATA_AHCI=m
CONFIG_ATA_PIIX=m

That will fix your
Code:
unknown-block(0,0)
error but it may only change the numbers.


Yes, including these in the kernel itself resolved the problem.

Again, thank you!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Sun Jan 30, 2022 8:44 pm    Post subject: Reply with quote

pgu,

Did you change the IDE mode in the BIOS too?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Mon Jan 31, 2022 12:38 pm    Post subject: Reply with quote

NeddySeagoon wrote:
pgu,

Did you change the IDE mode in the BIOS too?


Yes, I did:

Code:
 # lspci -s 00:1f.2
00:1f.2 SATA controller: Intel Corporation NM10/ICH7 Family SATA Controller [AHCI mode] (rev 02)


Thank you for your thorough response.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum