How to Fix Ubuntu 12.04(beta) boot problem for Sony VAIO VPCZ114GX

Update 3/29/12 - Get the script to set this up automatically here (sha1sum: 8b8c5c6d08ea5cbc8c925d5a2f29420ae1c2986e) .

My willingness to try out the "beta" versions of FOSS/GNU/Linux software is only exceeded by my sense of adventure for fixing any computer startup problems that may result from installing those "bleeding edge" updates.

GNU/Linux is famous for being a "rock solid" operating system, but if you're trying out the "beta" versions, you shouldn't be surprised if you find yourself having to "roll up your sleeves" to get the system fixed.. or at least reverting back to the previous version to get around a bug. For me, I actually like "rolling up my sleeves" for GNU/Linux. Especially because I know a.) I will learn something new, and b.) I might get a chance to help others overcome a similar problem by speaking out about my findings.

Recently I upgraded my Sony VAIO VPCZ114GX to Ubuntu 12.04 GNU/Linux BETA version.. Having booted up to the Ubuntu 12.04 LiveCD, everything was running great, so I went ahead with the clean install on my separate root ( / ) partition.

But, after rebooting, instead of seeing my shiny new Ubuntu 12.04 BETA desktop - I was instead presented with the not-clickity-friendly "busybox" instead (see image below).  So here I was, stuck in initramfs.

One thing I really like about GNU/Linux, and particularly the more active distributions like Ubuntu, is that where there's a problem - there's usually a bug report already filed and either a fix in the works, or at least a workaround available.

Sure enough, after looking around (and with some clues from the "Sony VAIO Z series" Team on ) I found the Ubuntu Launchpad bug report related to this issue, entitled: " (fakeraid) root device not activated during boot ".

The great thing about having the bug reported is that usually the experts will come in and leave comments for what the workarounds to the problem are. I found just that at the bug posting.

Turns out, during the initial boot process with the initrd.img-, the "fakeraid" for this particular Sony VAIO doesn't get all the way setup and so the system fails to find the root ( / ) partition (think c:\ for windblows).  So instead of giving you any type of "blue", "grey" or other kind of "death" screen, instead the GNU/Linux system does something more useful. Upon failure to mount the root partition, the system reverts to the interactive "busybox" environment. The busybox provides you with a basic way to interact with the system with various commands and tools for troubleshooting.

Anyways, so from the busybox environment, you can finish the activation for the software RAID on the Sony VAIO VPCZ114GX by hand. Simply use the command below (also pictured below) (Thanks to Wouter van Der Graaf here ) .
dmraid -ay 

So now I was able to get my system booting. Right on. I Love this stuff!

Of course, one of the great things about GNU/Linux/FOSS is that it's open source. So anytime you feel like trying to figure out a problem for yourself, feel free! It's fully legal (and realitively easy because it's open source) for you to open up and look at files that make things work, and even fix them. And then, you can even legally share the fixed software with others if you want! What a great concept.

Feeling a bit adventerous, I set out to try to figure out why the system wasn't able to boot. Since the system boots using open source scripts, you can extract the initrd.img and troubleshoot the scripts that bootup the system. I'll lay out the steps I used to create a temporary fix for the problem below.

I actually went back and installed Ubuntu 11.10, so I could save the initrd.img-3.0.0-12-generic files to compare against the Ubuntu 12.04 initrd.img-3.2.0-18-generic files. Using the 'diff -r' command, I was able to find one simple difference between the sbin/dmraid-activate script in the Ubuntu 11.10 initrd.img version and the newer one. The 'dmraid -i -ay $1' command at line 75 was changed to 'dmraid -p -i -ay $1'. So when I removed the -p from that script, the system is now able to boot. The Ubuntu devs posted comments on the bug report that said the -p is supposed to now be there.. but there's a bug being worked and removing it lets the system boot properly while we await a real fix for the problem.

NOTICE! This is not an official fix! It's just a workaround that works for me. Also, initrd.img-3.2.0-18-generic will be replaced as it is updated. Eventually, the Ubuntu developers will fix the problem and then I'll get a system update, and it will be fixed. I just wanted to make this post so others may see how I fixed the problem for my Sony VAIO VPCZ114GX. Obviously, I cannot take any responsibility for anything you do to your own system, even if you do decide to use the instructions here.

So in order to change the original initrd.img.3.2.0-18-generic startup image, I extracted it into a directory, changed the dmraid-activate script(mentioned above), then repacakaged the initrd.img.3.2.0-18-generic for booting my computer.

Here are the steps I used to make this happen:

# Become root
sudo -s
# Make a backup copy of your current initrd.img-3.2.0-18-generic file:
cp /boot/initrd.img.3.2.0-18-generic /boot/initrd.img.3.2.0-18-generic.original
# Switch directory to your home (e.g., /home/shannon )
cd ~
# Copy the broken initrd.img.3.2.0-18-generic file to the current directory
cp /boot/initrd.img.3.2.0-18-generic .
# Make the new directory for extracted contents
mkdir initrd.img-3.2.0-18-generic_FILES
# change directories into the directory you created
cd initrd.img-3.0.0-12-generic_FILES
# Extract the contents of initrd.img-3.2.0-18-generic into the current directory
# This command is split into 2 lines. Second line is created by the "\" character 
gunzip -c -9 ../initrd.img-3.2.0-18-generic | \
cpio -i -d -H newc --no-absolute-filenames

At this point, I made a simple change to the extracted sbin/dmraid-activate script with vi:

vi sbin/dmraid-activate
/dmraid -p #hit Enter. This will find the txt "dmraid -p" in the file
Y # Type it (capitalized).. Y copies the line
P # Type it (capitalized).. P pastes the line
i # Type it.. for insert mode
Type "#" - (no quotes) #This will "comment out" the duplicate line
Hit the ESC key to exit insert mode
# Then, use the arrow keys to move your cursor to -p on the uncommented line
Type "3x" #This will delete the three characters "-p "
# You should end up with this:
        #dmraid -p -i -ay -Z "$1"
        dmraid -i -ay -Z "$1"
# If you think you made mistakes that affect multiple lines, 
# you can cancel your edits and quit by typing ":!q" (no quotes), then hit Enter 
ZZ # Type it.. this will save and close the file

With the edits out of the way, now it's time to repackage the initrd.img-3.2.0-18-generic file and copy it into your /boot directory so it can be used to start the computer. Here are the steps (assumes you are still root in your terminal):

# Run this from inside the initrd.img-3.2.0-18-generic_FILES directory (from above)
find . | cpio --create --format='newc' > ../initrdimg
cd ..
mv initrdimg initrd.img-3.2.0-18-genericmodded
gzip initrd.img-3.2.0-18-genericmodded 
mv initrd.img-3.2.0-18-genericmodded.gz initrd.img-3.2.0-18-genericmodded
# Caution: this commandd will overwrite your current initrd.img.3.2.0-18-generic,
# make sure you have backed it up as noted above
# (if you deleted it by accident, simply run 'sudo update-initramfs -u' (no quotes))
cp initrd.img-3.2.0-18-genericmodded /boot/initrd.img.3.2.0-18-generic
# Now make a backup copy of your modified file at /boot/initrd.img.3.2.0-18-genericmodded,
# so you can key it in if an update replaced your /boot/initrd.img.3.2.0-18-generic
cp initrd.img-3.2.0-18-genericmodded /boot/initrd.img.3.2.0-18-genericmodded
# If a system update knocks out this hack:
# To get to the grub screen, hold the Left SHIFT key on startup, 
# then hit "e" to edit the boot command
# replace /boot/initrd.img.3.2.0-18-genericmodded on the initrd line

That's it! Exit out of the terminal and reboot your machine. It should boot right past the busybox now.

Remember, the purpose of this post is to document what I learned about working with the initrd.img file. I don't intend for the steps in this post to be a permanent fix in any way. I've subscribed to the bug report above, so I'll see happens in terms of a fix. The bug is marked as importance:high - so that makes it all the more exciting to me.

Feel free to leave a constructive comment or question below, if you like.

Shannon VanWagner

Popular posts from this blog

How To Connect Ubuntu Linux to Cisco VPN with openconnect (anyconnect-capable alternative)

(updated) How To: Ubuntu 16.04 GNU / Linux - Netgear Wireless AC Adapter AC600 ( AC6100 ) Dual Band

How To Set Default Grub / kernel / boot option on Ubuntu GNU/Linux 14.04