1
July
2024
Enabling AHCI support in the Linux kernel
17:07

Enabling AHCI support in the Linux kernel

1 July 2024 17:07

If the operating system was installed on the PC in SATA IDE controller mode, then the same mode will be enabled in the kernel, and the system will not start in AHCI mode (for example, after replacing the motherboard).

Symptom:

After starting the computer in SATA's AHCI mode in the BIOS, loading stops at the message "Loading Operating System..."

Solution

1) Enabled IDE mode in BIOS Setup, selected the boot hard drive in the advanced startup options, and saved the changes.

2) Normal computer start. Editing a file /etc/initramfs-tools/modules:

sudo nano /etc/initramfs-tools/modules

In the "modules" file I added two lines "ahci" and "libahci":

# List of modules that you want to include in your initramfs.
# They will be loaded at boot time in the order below.
#
# Syntax:  module_name [args ...]
#
# You must run update-initramfs(8) to effect this change.
#
# Examples:
#
# raid1
# sd_mod
ahci
libahci

(On my PC, the file /etc/initramfs-tools/modules also contains the lines lz4, lz4_compress, z3fold for the in-memory page compression system to work - on other PCs they may be absent).

2) Opened the driver-policy file in the nano editor in the /etc/initramfs-tools/conf.d/ directory:

sudo nano /etc/initramfs-tools/conf.d/driver-policy

In which I added one line

MODULES=dep

3) Updated all kernels with the command

sudo update-initramfs -u -k all

4) Rebooted the PC and enabled AHCI mode in the BIOS and selected the boot hard drive in the Advanced Boot parameters.

Booting from the hard drive in AHCI mode was successful.


Tip source: askubuntu.com: Switch to a targeted initrd after setup.


Date of last change: 04/22/2025



Related publications