Increasing Disk Detection Timeout at Boot with Linux/Systemd

bootbtrfslinuxsystemdtimeout

I have a machine with a lot of disks, and an extra SAS controller in HBA mode.
This seems to cause Linux to think for at least 8-10 seconds once in initramfs before the disks actually appear. The timeout for disk detection is 10 seconds. This causes BTRFS/MDADM/etc fail to mount a RAID1 that I have in my system, dropping me to an emergency shell from where I can actually mount the disks and continue just fine.

My question is, how do I increase this timeout at boot from 10 seconds? Is it in systemd? is it in udev? somewhere else? I'm not sure where to start looking, and googling about this problem mostly seems to yield people looking to raise the I/O timeout or some other (scsi/lun/etc) timeouts, but I'm not looking for that.

Best Answer

I've finally found it! It's of course but a simple kernel parameter, found here https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html

The parameter I was specifically looking for is rootdelay, I had already tried rootwait but apparently that wasn't enough, as it still aborted the wait after 10 seconds. Now it actually does not wait the full 30 seconds specified, but only about 10-15 seconds depending on how long it takes for my disks to show up, so setting a really high value doesn't seem to hurt, although I've only set 30 for my use case, which so far seems to have completely resolved the issue!

You can add it to your kernel boot parameters in Grub or systemd-boot.

Grub: /etc/defaults/grub -> GRUB_CMDLINE_LINUX_DEFAULT="rootdelay=30 quiet"

systemd-boot: /boot/loader/entries/yourentry.cfg -> options rootdelay=30 [other options]