A sleazy trick to capture debugging output from an initramfs
July 22, 2012
Suppose, not entirely hypothetically, that something in your system's initramfs is failing or that you just want to capture some debugging output or state information in general. The traditional way to do this when console output isn't good enough is to just dump the output into a file and read the file later, but this has a problem in the initramfs world; the file you write out will be in the initramfs, which means that it will quietly disappear when boot process is finished and the initramfs goes away.
So we need two things. We need to preserve the initramfs or at least the bit of it that we care about, and then we need some way to get access to it. There is probably an official way to do this, but here is my sleazy trick.
We can preserve a file from the initramfs by starting a process in the initramfs (and then having it stay running) that has a file descriptor for the file. For example (on Ubuntu 12.04):
(I believe that even something like '
There are undoubtedly clever ways to preserve the initramfs or get
access to it, but once you have a preserved file descriptor there's a
simpler brute force way. Simply look at
Written on 22 July 2012.
* * *
Atom feeds are available; see the bottom of most pages.