How to add support for booting from AHCI controller?

Issues related to hardware problems
Post Reply
sudburr
Posts: 5
Joined: 2015/09/24 21:22:14

How to add support for booting from AHCI controller?

Post by sudburr » 2015/09/24 21:43:22

I have my freshly installed, minimal CentOS 7.1 server installed and configured in a Hyper-V 2012 R2, Generation 1 machine.

I've captured and re-deployed the server to a physical machine.

The physical machine will only boot if I set the controller to IDE (compatibility) mode.

I want to use the board's controller's AHCI mode.

How do I add support to boot from and use the AHCI controller?

User avatar
TrevorH
Site Admin
Posts: 33228
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to add support for booting from AHCI controller?

Post by TrevorH » 2015/09/24 23:17:32

If you run lsinitrd /boot/initramfs-3.10.0-229.14.1.el7.x86_64.img | grep -i ahci do you see two lines of the format

Code: Select all

-rw-r--r--   1 root     root        61125 Sep 15 16:44 usr/lib/modules/3.10.0-229.14.1.el7.x86_64/kernel/drivers/ata/ahci.ko
-rw-r--r--   1 root     root        52157 Sep 15 16:44 usr/lib/modules/3.10.0-229.14.1.el7.x86_64/kernel/drivers/ata/libahci.ko
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

sudburr
Posts: 5
Joined: 2015/09/24 21:22:14

Re: How to add support for booting from AHCI controller?

Post by sudburr » 2015/09/25 16:55:13

If I run

Code: Select all

lsinitrd /boot/initramfs-3.10.0-229.14.1.el7.x86_64.img | grep -i ahci 
I get

Code: Select all

Usage: lsinitrd [options] [<initramfs file> [<filename> [<filename> [...] ]]]
Usage: lsinitrd [options] -k <kernel version>

-h, --help                  print a help message and exit.
-s, --size                  sort the contents of the initramfs by size.
-m, --mod                   list modules.
-f, --file <filename>       print the contents of <filename>.
-k, --kver <kernel version> inspect the initramfs of <kernel version>.
If I run

Code: Select all

lsinitrd /boot/initramfs-3.10.0-229.el7.x86_64.img | grep -i ahci
while running the destination controller in IDE mode I get nothing.

To clarify further, this is a single drive to single drive.

User avatar
TrevorH
Site Admin
Posts: 33228
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to add support for booting from AHCI controller?

Post by TrevorH » 2015/09/25 18:43:38

You obviously need to point lsinitrd to the initramfs for a kernel that is installed - my example used the latest CentOS 7 kernel at the present time so if yours if different then you need to use that file.

When you did run it against yours it shows that you do not have the right kernel modules in it to allow it to use ahci mode so you need to rebuild it with dracut and tell dracut that you want it to build the initramfs with the ahci modules in place. Read the man page for dracut and see the section on "Adding Kernel Modules" for examples. If I were you I would build this as a different filename than the one that you currently have that works - or, perhaps better, with it running in IDE mode, run yum update to get the latest kernel but edit /etc/dracut.conf first and add ahci to the add_drivers+="" line so that the newly installed kernel is built with the right ahci driver in place straight away.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

sudburr
Posts: 5
Joined: 2015/09/24 21:22:14

Re: How to add support for booting from AHCI controller?

Post by sudburr » 2015/09/28 16:36:57

Alrighty then, this is what I've done.

Code: Select all

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
01> For a Hyper-V Virtual FOG Server
	A> Create a New Virtual Machine: <Distro_#>, Generation 1, 512MB Dynamic Memory, Onboard Network, Create a virtual hard disk
		i.	Boot from CD
		ii.	Maximum RAM 2048MB
		iii.	DVD Drive Image File: "centos-7-x86_64-netinstall-1503.iso"
		iv.	REMOVE: SCSI Controller
		v.	Automatic Start Action: Nothing

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
02> Start machine

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
03> Installer Answers ( CentOS_7 )

@ CentOS 7
 : Install CentOS 7

@ What language would you like to use during the installation process?
 : English (Canada)

@ Installation Summary
 / Network & Host Name
 : Ethernet (eth0) = ON
 : Host Name = "centos7"
 
 / Date & Time
 : Americas + Toronto
 : Network Time = ON
 : Configure
 
 / Installation Source
 : On the network = "http://mirror.centos.org/centos/7/os/x86_64/"

 / Software Selection	
 : Minimal Install

/ Installation Destination
 : I will configure partitioning
 : <Msft Virtual Disk>

@ Manual Partitioning
 : Standard Partition
 : Create them Automatically
 : SDA1 File System = ext4 ... + wait
 : SDA2 File System = ext4
 : SDA3 File System = ext4

@ Installation Summary
 : Begin Installation

@ Configuration / Root Password
 : "... root password ..."

@ Configuration / User Creation	
 : Create User

 / Full name
 : Username
 / Username
 : Username

 : Make this user administrator
 / Password
 : "... password ..."

@ CentOS is now successfully installed ...
 : Reboot (.ISO is ejected)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
01> Update the OS
	## Login REMOTELY with Kitty ( http://kitty.9bis.net/ )
	## Elevate Access Level
	## --
	## Disable root access via SSH
	## Clean & Update the OS
	## Reboot

sudo su

sed -i "s|#PermitRootLogin yes|PermitRootLogin no|g" /etc/ssh/sshd_config
systemctl restart sshd.service
sed -i "s|#add_drivers+=""|#add_drivers+="ahci"|g" /etc/dracut.conf
yum clean all
yum makecache
yum update -y
reboot
- Capture with FOG build 4752
- Deploy to Physical Machine set to AHCI, then boot up

... and it worked. Thank you!

Now to experiment with:

Code: Select all

sed -i "s|#hostonly="yes"|hostonly="no"|g" /etc/dracut.conf

sudburr
Posts: 5
Joined: 2015/09/24 21:22:14

Re: How to add support for booting from AHCI controller?

Post by sudburr » 2015/09/28 20:48:08

Now to figure out why it worked once, but not twice. 8(

... and it broke the virtual machine too. Back to the errors. yargen.

[ OK ] Started Show Plymouth Boot Screen.
[ OK ] Reached target Paths.
[ OK ] Reached target Basic System.

... long wait later ...
Dracut initqueue[218]: Warning: Could not boot.
Dracut initqueue[218]: Warning: /dev/disk/by-uuid/ac6a...blah does not exist
Starting Dracut Emergency Shell ...

sudburr
Posts: 5
Joined: 2015/09/24 21:22:14

Re: How to add support for booting from AHCI controller?

Post by sudburr » 2015/09/29 14:10:47

Okay, my bad. It worked the first time because I made the changes manually. Second time was with a bad quote vs double-quote in my procedure script.

This works now.

Code: Select all

sed -i "s|#PermitRootLogin yes|PermitRootLogin no|g" /etc/ssh/sshd_config
systemctl restart sshd.service
sed -i 's|#add_drivers+="|add_drivers+="ahci|g' /etc/dracut.conf
sed -i 's|#hostonly="yes"|hostonly="no"|g' /etc/dracut.conf
yum clean all
yum makecache
yum update -y
shutdown now

Post Reply