Ask the Argus
Booting Sandbox Part II
Experimenting With initramfs
Synopsis
In this lab I proceed to the second task of Shevek's boot fault lab: Broken initramfs. The lab can be found at the bottom of this page for download or in the sandbox archive listed on the homepage. As is most always the case, I start completely blind and clueless as to what to do, or as to what initramfs really is for that matter. I have Shevek make me a lesson plan and follow along. Along the way we encounter limitations to the lab created by my virtual machine using a LVM, I discover how to repair a broken system in three different ways as a consequence, and a means of activating dracut for the simulation is eventually arrived at.
Questions & Objectives
- I want to understand what
initramfsis and it's role in booting. - I will to deliberately miscofigure
initramfsto see it's effects. - I will then reconfigure the system so that it is returned to normal operation.
Process
-
As is always the case, since I didn't request a lesson with my lab, I don't get one. There is no context or guide stage in the lab. Just a few obscure reference to file-paths. I have Shevek make me a lesson plan so I have a shot at learning in this sandbox.
What Did You Hand Me, Shevek?
initramfsLab 1
initramfsLab 2
initramfsLab 3
initramfsLab 4
initramfsLab 5
initramfsLab 6
initramfsLab 7
initramfsLab 8
initramfsLab 9
-
In order to do the lab, I need to damage or remove the
initramfsimage, per what Shevek states. Unfortunately at no point in time does he make it apparent how I am supposed to do this. I consult with Shevek. Shevek, how do we destroy my virtual machine? He provides me three options for doing so.Damaging
initramfs1
Damaging
initramfs2
Damaging
initramfs3
Damaging
initramfs4
Damaging
initramfs5
Damaging
initramfs6
-
I proceed to set up the conditions for the fault. I follow Sheveks instructions to the detail. But, yet again, I encounter a limitation to the lab. Despite having followed instructions and simply changed the name of
initramfs, I am not yielding an emergency shell. The screen sits idly. I attempted aforce restartto no avail. Shevek goes on to explain we created an even more catastrophic failure than justinitramfs. TheKernelcan not even start theinitramfsenvironment. Not to worry, there is a solution.Changing the Name of
initramfs
Rebooting 1
Rebooting 2
Rebooting 3
Booting Fault Explained 1
Booting Fault Explained 2
Booting Fault Explained 3
Booting Fault Explained 4
Booting Fault Explained 5
Booting Fault Explained 6
-
I follow the steps Shevek lays out for me and it works. When prompted in the GRUB menu to select a
Kernel, I select the one whoseinitramfshas not been corrupted. I'm not certain HOW this gives me access to my directory, but it works. I change the name ofinitramfsback to it's original state. I reboot, select the originalKerneland it works as it did before.Using the "Rescue"
Kernel1
Using the "Rescue"
Kernel2
Using the "Rescue"
Kernel3
Rebooting With the Original
Kernel
Booting Success
-
I feel a little shaky on what a driver is and, seeing as to how they appear to play such a vital role in booting, I ask Shevek to elaborate on what they are. I appear to have the correct general understanding, but as always, Shevek refines it.
Drivers Explained 1
Drivers Explained 2
Drivers Explained 3
Drivers Explained 4
-
I return to the
initramfslab, prompt Shevek that I have reconfigured my VM to boot correctly, and proceed. I employ the commandsudo dracut --omit lvm --force. This creates a newinitramfs, leaves out the LVM module, and will cause boot to fail into dracut. I will ask for more clarification on how that command works in the next section.Forcing
dracut1
Forcing
dracut2
Forcing
dracut3
Forcing
dracut4
Forcing
dracut5
Forcing
dracut6
Forcing
dracut7
Forcing
dracut8
-
The command
sudo dracut --omit lvm --forceleaves a thorn in my side. I am not the type of person to blindly type commands I have no comprehension of. I also know philosophy majors that would struggle to comprehend amanpage. I consult Shevek to break down the command, piece by piece.Rebuilding
initramfs1
Rebuilding
initramfs2
Rebuilding
initramfs3
Rebuilding
initramfs4
Rebuilding
initramfs5
-
I return to Sheveks new lab and proceed with his instructions from
dracut. However, I encounter yet antoher speed bump. None of the commands I'm required to use work. What's going on here?New Lab Process 1
New Lab Process 2
New Lab Process 3
New Lab Process 4
New Lab Process 5
New Lab Process 6
Minor Command Issues
-
Shevek comes up with a way around this, or so I think. He instrcuts me to call commands directly by their
PATH. I try and do this, but that doesn't even work. Something is seriously wrong here. Shevek keeps overlooking details. This lab only has experiential and exposure value. Nothing about it is working the way it's supposed to.Commands by
PATH1
Commands by
PATH2
Commands by
PATH3
Still Not Working, Shevek
-
Not to worry, Shevek has another solution that sure to at least bring my system back to it's original state AND he has amother method for simulating failure to
dracut. I could just use snapshot, but I would like to learn how to recover the system in such a situation. We disabled the LVM. It contains all the commands. How did Shevek not see this coming? Or is he deliberately doing this? I wonder. I follow his lead and boot from CD-ROM.System Rescue Via CDROM 1
System Rescue Via CDROM 2
System Rescue Via CDROM 3
System Rescue Via CDROM 4
System Rescue Via CDROM 5
System Rescue Via CDROM 6
System Rescue Via CDROM 7
System Rescue Via CDROM 8
System Rescue Via CDROM 9
System Rescue Via CDROM 10
-
Before I proceed with using
chrootin order to reapirinitramfs, I would like to better understand what it is exactly it does, and what it is used for. Shevek explainschrootexists for just such a purpose.chrootExplained 1
chroot Explained 2
chroot Explained 3
chroot Explained 4
chroot Explained 5
chroot Explained 6
-
I attempt Sheveks final lab with tremendous success.
dracutloads as required. I am then able to activate LVM manually to access the tools I need. I am then able tomount root, prepchroot,chrootand rebuildinitrafms. It took a long time to get here. I still have questions.initramfsRecovery 1
initramfsRecovery 2
initramfsRecovery 3
initramfsRecovery 4
initramfsRecovery 5
initramfsRecovery 6
initramfsRecovery 7
initramfsRecovery 8
initramfsRecovery 9
initramfsRecovery 10
initramfsRecovery 11
initramfsRecovery 12
initramfsRecovery 13
initramfsRecovery 14
initramfsRecovery 15
-
I'd love to say I know what I just did, but I simply don't understand a lot of it. I consult Shevek regarding what's going on with the
mountcommands. He explains why they are neccessary before we can employchroot.mountCommands Explained 1
mountCommands Explained 2
mountCommands Explained 3
mountCommands Explained 4
mountCommands Explained 5
mountCommands Explained 6
-
As I will be making a habit of doing to make certain I'm actually learning something, I repeat back to Shevek my new found understanding of to the objectives stated at the beginning of the lab. For a change, I am mostly right.
I still appreciate how Shevek refines what I've learned so it's more comprehensible.Objectives Learned 1
Objectives Learned 2
Objectives Learned 3
Objectives Learned 4
Objectives Learned 5
Conclusions
Corrupting initrafms is no simple task when an LVM is involved. After three tries, Shevek and I managed to get the behavior of dracut we were looking for. Renaming initramfs only resulted in the Kernel being unable to locate initrafms. This resulted in no emergency shell and required the use of a rescue Kernel to salvage the system. Next, we tried muting the LVM at boot. This, however, resulted in having tools that existed somewhere on disc, but were unreachable nonetheless. This much more severe fault required booting from CDROM. Lastly, the effective method employed to get the desired results was modifying GRUB at boot.
Shevek's Haiku
Tiny root in RAM
Drivers waiting for first breath
Kernel finds its way