Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My wubi files were corrupted and i had to re-install ubuntu (through wubi) again. Before i un-installed the old ubuntu i saved the old root.disk in external drive.After i installed i tried to boot ubuntu (12.04 LTS), to make sure it works.Everything works fine. But when i copy the old root.disk in ubuntu/disks folder and boot to ubuntu it takes me to Grub shell/command line.After browsing online i came across this soulution

  set root=(hd0,1)
  loopback (loop0) /ubuntu/disks/root.disk
  set root=(loop0)
  linux /boot/vmlinuz root=/dev/sda1 loop=/ubuntu/disks/root.disk ro
  initrd /initrd.img
  boot

Line number 4 doesn't work, doesnt seem like there is file vmlinuz-... Can somebody please give me step by step commands to boot into ubuntu. My machine is window 7.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

Assuming the root.disk you copied wasn't corrupted... you can boot it as follows:

search -s -f -n /ubuntu/disks/root.disk
probe --set=diskuuid -u $root
loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)
linux /vmlinuz root=UUID=$diskuuid loop=/ubuntu/disks/root.disk ro quiet splash
initrd /initrd.img
boot

After booting, make sure you run sudo update-grub

Wubi corruption is most common on the NTFS file system (requires running chkdsk /f from Windows), followed by corruption of the internal ext3/4 filesystem. Since you managed to copy your root.disk you may have internal corruption, in which case running fsck root.disk might fix it. But this depends on when you made your backup (i.e. before or after you encountered the problem).

To fsck the root.disk you can boot an Ubuntu DVD/USB, Select Try Ubuntu, then mount the partition that contains the root.disk and then fsck it as follows (this example assumes the root.disk is on /dev/sda1):

sudo mount /dev/sda1 /mnt
sudo fsck -fyv /mnt/ubuntu/disks/root.disk

(flags are force, yes to fix automatically, verbose)

Note: fsck used in this way does make changes and there's no guarantee it will fix everything without data loss. If recovery is critical it's possible to use photorec (which comes bundled when you install testdisk i.e. sudo apt-get install testdisk). Photorec is read-only (non-destructive) and can recover raw files. The downside is that the recovered files are not named, and it recovers everything e.g. deleted files as well - so there is some manual effort to find the ones you are after. It does provide the ability to target specific file types though. See here for more info: Recover deleted data with rm -rf?

share|improve this answer
    
Ok I am going to try it today. Please bare with me i had other issues on windows side.What is the line probe --set=diskuuid .... for? –  sparks Dec 3 '13 at 16:11
    
@sparks probe --set=diskuuid gets the UUID of the partition that the root.disk resides on. Previously you'd have needed either the UUID of the partition number (/dev/sdXY) to boot and this isn't always obvious. –  bcbc Dec 3 '13 at 17:12
    
When I do linux /vmlinuz root=UUID=$diskuuid .... I get error file not found –  sparks Dec 4 '13 at 2:11
    
@sparks I'd try mounting the root.disk from a liveCD to attempt data recovery and then fscking it. It seems likely that it's corrupted. –  bcbc Dec 4 '13 at 5:50
    
Oh ok thanks, but I don't have a live cd though. –  sparks Dec 4 '13 at 7:09
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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