PDA

View Full Version : [SOLVED] After cloning failed drive, Ubuntu won't boot



Andy_Mummau
February 5th, 2014, 02:40 AM
I have Ubuntu Server 12.04 installed on a 80 GB HDD using an LVM setup. I am only vaguely familiar with Linux/Ubuntu and am trying to learn how to fix things and not just reinstall.
I am very familiar with fixing things on the Windows side but am not quite sure what the equivalents are in Ubuntu.

The original hard drive failed the short test, so I cloned it using clonezilla to another identical drive. Ubuntu wouldn't boot, but I attributed that to a broken filesystem. After figuring out how to run a filesystem check on an LVM (http://blog.dynamichosting.biz/2011/12/05/running-a-filesystem-check-on-lvms/), I cleared up most of the errors at boot. Fsck comes clean on all partitions when run. Now the computer boots to the following point in the attached image. Everything I found online just says to run fsck again, to no avail.

Is this an issue with Grub due to the clone or something else?

Thanks much!

http://i62.tinypic.com/1zq8od2.jpg

brokenhachi
February 5th, 2014, 02:50 AM
you need to update the UUID manually in /boot/grub/grub.cfg and /etc/fstab because they are still listing as the previous drives (since it is a clone).

this should help: http://askubuntu.com/questions/171446/how-to-fix-the-uuid-in-grub-after-restore-from-another-machine

Andy_Mummau
February 5th, 2014, 03:45 AM
Maybe I'm missing something here, but it would seem from my grub.cfg file that the UUIDs are already switched?

Grub File:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

insmod lvm
insmod part_msdos
insmod ext2
set root='(MummauNet-root)'
search --no-floppy --fs-uuid --set=root 0aaac328-7c03-4f13-b042-ed39b725c0e6
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 57656973-2189-400b-a600-4534cf42a7ba
set locale_dir=($root)/grub/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=2
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
if [ "${1}" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "${linux_gfx_mode}" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 3.5.0-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 57656973-2189-400b-a600-4534cf42a7ba
linux /vmlinuz-3.5.0-23-generic root=/dev/mapper/MummauNet-root ro
initrd /initrd.img-3.5.0-23-generic
}
menuentry 'Ubuntu, with Linux 3.5.0-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 57656973-2189-400b-a600-4534cf42a7ba
echo 'Loading Linux 3.5.0-23-generic ...'
linux /vmlinuz-3.5.0-23-generic root=/dev/mapper/MummauNet-root ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-3.5.0-23-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 57656973-2189-400b-a600-4534cf42a7ba
linux16 /memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 57656973-2189-400b-a600-4534cf42a7ba
linux16 /memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

Drive UUIDs:
(The last entry is the flash drive; anything with sda/MummauNet LVM should be the hard drive)
http://i60.tinypic.com/30nc383.png

brokenhachi
February 5th, 2014, 06:59 PM
Did you already reinstall grub after cloning, or run update-grub?

can you mount the drives under partedmagic and
cat /mountpoint/etc/fstab

Andy_Mummau
February 5th, 2014, 07:27 PM
When I cloned the drive using CloneZilla, it gave me the option to copy the bootloader (Grub) and update it. I have not run an other Grub-related commands, though.

I wasn't able to run the cat command because the /etc folder doesn't exist. The only two partitions I can access are shown below and mounted in PartedMagic: sda1, where grub is, and sda5, which contains the LVM with a Root and Swap partitions.

Here is fdisk -l:
http://i57.tinypic.com/9u849i.png

Screenshot of sda1 (with hidden files shown):
http://i57.tinypic.com/cubro.png

Screenshot of the LVM root (with hidden files shown):
http://i60.tinypic.com/wpnrr.png

Thanks for all your help thus far!

brokenhachi
February 5th, 2014, 08:11 PM
can you do this?
find /mnt -name fstab and then
cat FSTAB_LOCATION once you find it.

Andy_Mummau
February 5th, 2014, 08:48 PM
I think we made some progress!

Here it is:
http://i57.tinypic.com/nxu7ud.png

brokenhachi
February 5th, 2014, 09:14 PM
can you change the UUID for /boot to
UUID=57656973-2189-400b-a600-4534cf42a7ba and try to reboot?

Andy_Mummau
February 5th, 2014, 11:18 PM
I changed the UUID, but still no luck.

On the plus side, I got rid of the error at boot from trying to mount the /proc on /root/proc error by creating a folder named "proc" in the root of the LVM.

Here's where things stand now:
http://i58.tinypic.com/2affn1l.jpg

brokenhachi
February 6th, 2014, 02:18 AM
can you do:
ls -la /dev/mapper I'm confused why it says...
target filesystem doesnt have requested /sbin/init

I think this line is something wrong:
linux /vmlinuz-3.5.0-23-generic root=/dev/mapper/MummauNet-root ro Seems like the /sbin dir is missing from that dev. Is the /mnt/lvm/root that you screenshot above the same as /dev/mapper/MummauNet-root? If so, it is definitely missing a lot of dirs..

can you mount the entire lvm, and then:
find /mnt -name sbin

I'm also confused why fstab is not an /etc directory. Do you have /etc anywhere on the lvm?

Andy_Mummau
February 6th, 2014, 03:10 AM
can you do:
ls -la /dev/mapper I'm confused why it says...
target filesystem doesnt have requested /sbin/init
NOTE: This is before mounting the LVM.
http://i58.tinypic.com/11t06s7.png


I think this line is something wrong:
linux /vmlinuz-3.5.0-23-generic root=/dev/mapper/MummauNet-root ro Seems like the /sbin dir is missing from that dev. Is the /mnt/lvm/root that you screenshot above the same as /dev/mapper/MummauNet-root? If so, it is definitely missing a lot of dirs..

When I mount either of those paths, they both have the same contents. The lost+found folder has almost 2.5 GB worth of files in it. I know from the Windows side that after running chkdsk it leaves a found.000 folder with the corrupted files. If there is a lot of them, Windows may not run, and I'm assuming the same is true for linux.


can you mount the entire lvm, and then:
find /mnt -name sbin
I'm also confused why fstab is not an /etc directory. Do you have /etc anywhere on the lvm?

I can't mount the entire LVM, only the root or swap partitions.
http://i58.tinypic.com/2n0r9jm.png

Sbin doesn't exist and etc only in the sys folder.

http://i57.tinypic.com/2cn89km.png

Is the install basically corrupted because its missing so many files? That must have been one really bad hard drive!

brokenhachi
February 6th, 2014, 05:54 AM
yes i think the clone did not work correctly as the files seem to not be there.. you need to have init to start the rest of the boot process.

Actually it seems that clonezilla with lvm is sketchy, and they said lvm1 is not supported. Do you still have the original drives? if so, you can try dd to copy by sectors to the new drives. I dont think it has to do with the filesystem being corrupt, but more that clonezilla couldn't recognize the devs in the lvm correctly during block by block copy.

Maybe someone with more lvm or clonezilla experience can chime in, as I'm not a master of either :( Anyways I think you cannot boot the filesystem in the current state..

Andy_Mummau
February 7th, 2014, 03:29 AM
yes i think the clone did not work correctly as the files seem to not be there.. you need to have init to start the rest of the boot process.

Actually it seems that clonezilla with lvm is sketchy, and they said lvm1 is not supported. Do you still have the original drives? if so, you can try dd to copy by sectors to the new drives. I dont think it has to do with the filesystem being corrupt, but more that clonezilla couldn't recognize the devs in the lvm correctly during block by block copy.

Maybe someone with more lvm or clonezilla experience can chime in, as I'm not a master of either :( Anyways I think you cannot boot the filesystem in the current state..

I still have the original drive and am trying to clone with dd. I can't mount the LVM on the bad drive (too corrupted), so I'm not sure if all the files are there.

I'll update the thread with the results.

Andy_Mummau
February 7th, 2014, 10:40 PM
Things are getting better!

I ran a clone using dd and then ran fsck on all the partitions. Ubuntu Server now boots to the login screen and I can login.

It seems some pieces are still damaged. MySQL won't run. The largest issue is not being able to upgrade. I cannot run any commands involving the apt-get command.

For example:

andy@MummauNet:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-headers-generic-lts-quantal linux-image-generic-lts-quantal mysql-client-5.5 mysql-server-5.5
mysql-server-core-5.5
The following packages will be upgraded:
accountsservice apt apt-transport-https apt-utils base-files bc bind9-host curl dmsetup dnsutils gnupg gpgv
grub-common grub-pc grub-pc-bin grub2-common initramfs-tools initramfs-tools-bin iproute landscape-common
language-pack-en language-pack-en-base libaccountsservice0 libapache2-mod-php5 libapt-inst1.4
libapt-pkg4.12 libbind9-80 libcurl3 libcurl3-gnutls libdevmapper-event1.02.1 libdevmapper1.02.1 libdns81
libdrm-intel1 libdrm-nouveau1a libdrm-radeon1 libdrm2 libisc83 libisccc80 libisccfg82 libjpeg-turbo8
liblwres80 libmysqlclient18 libssl-dev libssl-doc libssl1.0.0 libwbclient0 linux-firmware
linux-generic-lts-quantal linux-libc-dev lvm2 mysql-client-core-5.5 mysql-common mysql-server openssl perl
perl-base perl-modules php-pear php5-cli php5-common php5-curl php5-dev php5-gd php5-intl php5-mysql
python-apt python-apt-common rsyslog samba-common samba-common-bin smbclient
71 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Need to get 0 B/78.9 MB of archives.
After this operation, 1,024 B disk space will be freed.
Do you want to continue [Y/n]? y
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 70%dpkg: unrecoverable fatal error, aborting:
files list file for package 'bash' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)



Any suggestions? Thanks for all your help!

brokenhachi
February 8th, 2014, 12:39 AM
Great! Then i think the problem was a bad clone with clonezilla.

as for the new problem please look here: http://ubuntuforums.org/showthread.php?t=1319791

Andy_Mummau
February 9th, 2014, 12:41 AM
Well everything is back in order now and booting normally!

I used the script you linked to fix the apt-get problems.

I still had some issues with MySQL and ended up completely removing it and reinstalling it.

Thanks for your help! I certainly learned a lot about Linux/Ubuntu!

brokenhachi
February 11th, 2014, 06:45 PM
Great! glad its all working :D Thanks for sticking with me while I tried to help!