0

I had Ubuntu 14.04 running sweetly however when installing an IMG to an SD card for a raspberry pi like so:

dd bs=4M if=2014-06-20-wheezy-raspbian.img of=/dev/mmcblk0

My beloved Ubuntu now boots like so:

BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4) built-in shell (ash) Enter 'help' for a list of built-in commands. (initramfs)

Have I just made a major mistake and dd over the filesystem on the HDD ? Is there a fix ?

2 Answers 2

0

One of three things could be happening here (I'm not too familiar with Raspian):

The SD card is interfering with the boot sequence

It's possible that for some reason the boot process is picking up the partitions/files on the SD card and causing it to fail booting, try simply removing the SD card and reboot. I believe that should do the trick, if not you might have some trouble.

You fried your partition

If that command that you have above is the actual command you used, there shouldn't have been a problem. However, if you instead typed something along the lines of of=/dev/sdX# or of=/dev/sdX, then that would have friend the beginning of the partition number # or the beginning of the disk respectively.

If you did, in fact, somehow manage to fry your partition, then there's really not a lot you can do to recover the data aside from using a tool like testdisk (which may or may not work depending on whether all backup superblocks were wiped) or, worst case, scalpel to recover the files. Otherwise, simply reformat and try again.

dd can potentially be a very destructive program. It has no warnings that would tell you "Hey buddy, are you really sure you want to do this? It's probably a bad idea" -- it just goes. Therefore, you need to be sure that the command you type is the command you really want. For example, you might ensure that /dev/mmcblk is the correct device by first mounting the SD card (or a partition on it) and then finding the device listed in the mount command. However, from the command you typed it should have worked as expected...

There is an error in the boot sequence

I've seen this happen while creating custom ISOs and it tends to happen when the root filesystem can't be found (or it's corrupted). If you have a separate /home partition, then there still may be problem with with the root partition while your /home partition remained untouched.

As described here, remove the kernel options quiet and splash and append the kernel option debug while in GRUB (the bootloader). To do this, press E while you have a boot option selected. Once the line is edited, press Ctrl+X to boot.

This will write a /tmp/initramfs.debug file. After the system fails to boot, you can then use the httpd command to allow another computer to access the filesystem via a browser, or you can simply reboot with a LiveCD and examine the file. What you may be looking for is a line that says something similar to "Unable to find root partition."

It is also possible that the root filesystem is corrupt and needs to be fixed with a filesystem check. In order to do this, first boot from a LiveCD/USB.

  1. Open a console
  2. Find the partition in question using gparted-pkexec. If you suddenly have a big block of free space on your drive, it's very possible that the root partition got overwritten and may not be recoverable. If that's not the case, continue to step 3.
  3. e2fsck -p /dev/sdX# (where /dev/sdX# is the device and partition of your root filesystem (possibly /dev/sda4 or /dev/sda5, but you you'll want to verify that with gparted-pkexec from the LiveCD/USB)
8
  • Well i had encrypted the home partition so sda5 is fine and on boot up im still required authenticate it.
    – DevilCode
    Sep 5, 2014 at 15:40
  • I should add i put the computer in sleep mode all night and powered up fine the next day sleep. Was only when i shut down and restarted the issue occurred.
    – DevilCode
    Sep 5, 2014 at 15:51
  • Perhaps it was just a failed driver update? Perhaps it doesn't have anything to do with your 'dd' at all? Did you try selecting a different kernel at startup? A driver may have updated and failed to install for some reason possibly.
    – Chuck R
    Sep 6, 2014 at 3:56
  • thats my feeling but i don't know how to test it as none of the older kernals do any different.
    – DevilCode
    Sep 6, 2014 at 21:59
  • I updated my answer to include initramfs debugging as well as a FS check.
    – Chuck R
    Sep 7, 2014 at 5:03
0

Ok, the issue here is that you tried flashing it without mounting, make sure the path is /mnt/ or /media/, so you are sure you have mounted properly.

If I were you I would use a GUI for this sort of thing.

2
  • You don't need to mount when using dd. In fact, it's a Bad Idea™ that can lead to data corruption due to the fact that the FS doesn't see what's going on at the block level.
    – Chuck R
    Sep 5, 2014 at 13:16
  • I definitely unmounted it
    – DevilCode
    Sep 5, 2014 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.