[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: switch from IDE to AHCI causes not finding root FS



David Wright composed on 2023-01-28 09:10 (UTC-0600):

> On Sat 28 Jan 2023 at 03:15:11 (-0500), Felix Miata wrote:

>> I thought only Windows was like that, but apparently not always. I keep my
>> initramfs configuration set to =dep.
 
> And is that the reason behind, and cure for, your mushrooming initrd
> size complaint in https://lists.debian.org/debian-user/2022/11/msg00331.html

That =dep might cause a larger initrd size than =most on most PCs is logically backwards. My object was and remains smaller size. Really old PCs tend to load kernels and initrds at a snail's pace.
<https://www.linuxquestions.org/questions/linux-general-1/grub-legacy-delay-of-more-than-2-minutes-loading-initrd-from-ext4-filesystem-4175599620/>

Over years of continuously bloating kernel and initrd size, getting a boot started is taking longer and longer. Also, my partition sizes on these old PCs were sized appropriately considering the state of affairs many moons ago, before years of overall bloat. New ones I give more space, but with up to 50 installations per 500G disk on old ones, repartitioning as a practical matter isn't feasible, and adding or replacing disks is undesirable. Thus, whatever can result in smaller initrd sizes can be desirable activity.

2 days ago I wanted to upgrade a Mint 20.3 to 21.1. I was only able to get 20.3's
freespace on / down to 18%, forgetting to purge the prior kernel first. I cleaned
/var/cache/apt/archives/ and mounted a filesystem on it to do the upgrade. There
was ample space for the downloads, but the upgrade didn't fit. Several transactions
failed for lack of freespace, and lack of freespace prevented creating more by
purging packages. I had to run apt --fix-broken install on zero freespace several
times before I had enough freespace to allow purging unneededs. /root/.bash_history
on that installation now has 200 lines with string purge in it. e.g. It had
mint-background installed going back 5 releases. Mint is bloat piled on top of bloat. :p

>> I have an old multiboot Core2Duo on ICH8 that
>> I found had been set to IDE instead of AHCI. I changed it to AHCI, which makes
>> Grub load sooner, and probably Linux I/O more efficient. Fedora, openSUSE and
>> Mageia are having no trouble booting this way. Looking at their lsmod output, it
>> seems they must include whatever supports AHCI in the kernel, so I can't tell what
>> module needs to be added to Debian and derivatives' initrds to enable them to boot
>> again without switching the BIOS back to IDE.
 
>> Anyone here know how I can determine what to add?
 
> One might suppose you need:
 
> ahci                   40960  5
> libahci                45056  1 ahci
> libata                299008  2 libahci,ahci
> scsi_mod              270336  4 sd_mod,libata,sg,sr_mod

I would expect that last line is independent of whether or not ahci is needed,
required also when BIOS is set to IDE.

> and I hope the initrd doesn't mushroom excessively.
 
It caused surprising changes, larger and smaller than expected. On Bookworm I
switched back to IDE, added ahci to /etc/initramfs-tools/modules, regenerated
current initrd, switched BIOS back to ahci, and boot succeeds:
# ls -Gg /boot/.initrd.img-6.0*
-rw-r--r-- 1 9289082 Jan 22 03:30 /boot/.initrd.img-6.0.0-6-amd641
-rw-r--r-- 1 9334920 Jan 28 03:58 /boot/.initrd.img-6.0.0-6-amd642
Increase in size: 45838
# lsinitramfs initrd | grep ahci
cpio: premature end of archive
#
I suppose maybe lsinitramfs hasn't added support for zstd compression yet. :p
Or maybe initrd build ran out of space and only perchance it currently works
with whatever portion did get written.

# ls -Gg /lib/modules/6.0.0-6-amd64/kernel/drivers/ata/*ahci*
-rw-r--r-- 1  45059 Dec  9 00:54 /lib/modules/6.0.0-6-amd64/kernel/drivers/ata/acard-ahci.ko
-rw-r--r-- 1 114755 Dec  9 00:54 /lib/modules/6.0.0-6-amd64/kernel/drivers/ata/ahci.ko
-rw-r--r-- 1 116371 Dec  9 00:54 /lib/modules/6.0.0-6-amd64/kernel/drivers/ata/libahci.ko
# lsmod | grep ahci
ahci                   49152  14
libahci                49152  1 ahci
libata                401408  2 libahci,ahci
#
Based upon size of ahci.ko, I was expecting a larger initrd size increase.

For Bullseye, after Bookworm, still with AHCI in BIOS, I chrooted from
Bookworm to Bullseye, added ahci to its /etc/initramfs-tools/modules, rebuilt
current initrd, and boot succeeds:
# ls -gG /disks/deb11/boot/.initrd.img-5.10.0-20-amd64*
-rw-r--r-- 1 7268254 Jan 22 01:25 /disks/deb11/boot/.initrd.img-5.10.0-20-amd641
-rw-r--r-- 1 8853489 Jan 28 07:17 /disks/deb11/boot/.initrd.img-5.10.0-20-amd642
#
Increase in size 1,585,235
# lsinitramfs /disks/deb11/boot/initrd.img-5.10.0-20-amd64 | egrep 'ahci|libata'
usr/lib/modules/5.10.0-20-amd64/kernel/drivers/ata/ahci.ko
usr/lib/modules/5.10.0-20-amd64/kernel/drivers/ata/libahci.ko
usr/lib/modules/5.10.0-20-amd64/kernel/drivers/ata/libata.ko
# ls -gG /disks/deb11/lib/modules/5.10.0-20-amd64/kernel/drivers/ata/ | egrep 'ahci|libata'
-rw-r--r-- 1  21547 Dec 13 15:46 acard-ahci.ko
-rw-r--r-- 1  86211 Dec 13 15:46 ahci.ko
-rw-r--r-- 1  86731 Dec 13 15:46 libahci.ko
-rw-r--r-- 1 591147 Dec 13 15:46 libata.ko
#
Combined total of ahci + libahci = 172,942 = 10.9% of 1,585,235. :p
Combined total of ahci + libahci + libata = 764,089 = 48.2% of 1,585,235.
Very different result on Bullseye than on Bookworm.

Current Bookworm initrd:  9,334,920
Current Bullseye initrd:  8,853,489
Increase:		    481,431  5.44%

Current Bookworm vmlinuz: 7,809,888
Current Bullseye vmlinuz: 7,008,928
Increase:		    800,960 11.43%
-- 
Evolution as taught in public schools is, like religion,
	based on faith, not based on science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata


Reply to: