2

I've taken a clone of a machine with the following partitions:

Device                   Type        Label
/dev/sda 
    /dev/sda1            Ext4        boot
    /dev/sda2            Linux LVM      
    /dev/system/         LV system     
    /dev/system/home     LV          home
    /dev/system/root     LV          root
    /dev/system/swap     LV          swap

These are referenced by label in

/etc/fstab:

LABEL=root     /        ext4
LABEL=boot     /boot    ext4
LABEL=home     /home    ext4
LABEL=swap     /swap    swap

and grub.cfg:

menuentry 'openSUSE, with linux <version>' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-<version>-simple-<UUID>' {
    insmod ext2
    set root='hd0,msdos1'
    linux /vmlinuz-<version> root=/dev/mapper/system-root resume=/dev/disk/by-label/swap <other options>
    initrd /initrd-<version>
}

I am trying to install this clone on another identical machine. The install succeeds, but I can't boot into the machine without doing the following in the grub prompt it dumps me into:

grub> set root=(hd0,1)
grub> linux /boot/vmlinuz-<version> root=/dev/sda1
grub> initrd /boot/initrd.img-<version>
grub> boot

I'd much prefer to get an image which does not require these steps, but I'm not sure where the problem lies (grub config, other system files, clonezilla). Things I have tried so far:

  • Edited /etc/defaults/grub and uncommented 'GRUB_DISABLE_LINUX_UUID=true'
  • Edited grub-mkconfig_lib to comment out the lines like search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid} to prevent them being added when grub.cfg is generated
  • (and re-generated grub.cfg)
  • Selected advanced clonezilla install and told it to re-install the MBR afterwards (option -j1. option -g auto "Reinstall grub in client disk MBR" was already selected by default)

Any other things I can try?

I did notice that /boot/grub2/device.map lists "sda1" for hd0, but the HD of the other machine is being detected as sda1 when I install the clone so I don't think this is likely to be the culprit.

(I wasn't sure if here or Superuser was the better fit for the question, I am happy for it to be migrated as appropriate.)

  • In my experience (limited to BIOS not LVM and partition clone not disk clone) when restoring image Clonezilla runs grub-install automatically fixing UUID and other. A little more info may help: What version of Clonezilla? Did you clone the disk or just the partition? Were there any errors on the restore, particularly in the grub-install part? – jc__ May 25 '17 at 14:20
  • Version of clonezilla: 20170220-yakkety. Cloned the entire disk, also tried both with the partimage and dd options when making the clone. Re-running the install now I did see a "couldn't find device uuid" mesage scroll past briefly before the partclone screen appeared, but couldn't get all the details in time. No errors were listed in the output once install had finished. – jam May 25 '17 at 14:56
  • I am working with a much older version, but this is the selections Ive used to get the grub-install called automatically: (device-image) (local_dev or where ever) (Beginner) (saveparts) (...). Then the reverse for restoring the image. (device-image) (local_dev or where ever) (Beginner) (restoreparts). – jc__ May 25 '17 at 15:12
  • Look at my answer here for a quick how to clone using Clonezilla in the Parted Magic live ISO. – jc__ May 25 '17 at 15:20
2

In the end, I resolved this by taking a partition clone of the original machine's boot partition and installing this on the other machines with "-j1" selected from the advanced options.

Slightly annoying to have the extra step, but at least restoring a clone of the boot partition only takes seconds.

0

The working procedure to fix this we have to manually install GRUB(2) after a failed installation/cloning, or disk corruption of the MBR.

Now, after restarting, let's fix the grub boot:

sh:grub>set pager=1 # for paging long command outputs; There must be no spaces on either side of the equals sign. 
grub> set root=(hd0,XY)
'grub> insmod /boot/grub/linux.mod # AFAIK, optional step
grub> linux /boot/vmlinuz-4.4.92-36-default root=/dev/sdaXY
grub> initrd /boot/initrd.img-4.4.92-36-default
grub> boot

After successfully booting into your Linux, let's make the repair permanent:

# update-grub
# grub-install /dev/sda #or what ever your system disk is

if you get the error update-grub command not found don't worry, it's simply a shell script that was created to make things easier. Acutally, it does:

set -e
exec grub2-mkconfig -o /boot/grub/grub.cfg "$@"

After running grub-install ... your system should be back to normal. I did this with a cloned OpenSuse Leap 42.2 using Clonezilla 2016-02-10 (migrated primary laptop disk to a bigger SSD).

Refs: How to Rescue a Non-booting GRUB 2 on Linux
Repairing a Broken GRUB 2 Boot-Loader on Ubuntu

Here is an alternative approach that works without booting into Linux:

$ sudo fdisk -l (From this you need to find the device name of your physical drive that won't boot, something like “/dev/sdxy″ - where x is the drive and y is the root partition. Since I was using a software RAID, root (/) was on md1)
$ sudo mount /dev/sdxy /mnt (Mount the root partition)
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /sys /mnt/sys
$ sudo chroot /mnt  (This will change the root of executables to your your drive that won't boot)
$ grub-mkconfig -o /boot/grub/grub.cfg (insure that there are NO error messages)
$ grub-install /dev/sdx (NOTE that this is the drive and not the partition. try grub-install --recheck /dev/sdxy if it fails)
Ctrl+D (to exit out of chroot)
$ sudo umount /mnt/dev
$ sudo umount /mnt/proc
$ sudo umount /mnt/sys
$ sudo umount /mnt

Ref: http://redsunsoft.com/2016/06/how-to-repair-a-server-stuck-at-the-grub-prompt/

0

TL;DR

On Ubuntu installed on GPT use BootRepair after you logged in system.


Had the same problem as @jam, but in my case I have:

  • Ubuntu 16.04, that I wanted to clone
  • source disk (HDD, 500 GB )
    • MBR
    • dual boot with windows
  • target disk (SSD, 256 GB )
    • GPT

So, I cloned only linux partitions (sda5 - for system, sda6 for /home) with Clonezilla, not the whole disk.

To make it possible, I installed clear ubuntu on SSD, create partitions as it was made on HDD and also added ESP (EFI System Partition). Then I overwrote this partitions with Clonezilla (HDD partitions to SSD). As a result, I got GRUB prompt.

Then I made

grub> set root=(hd0,gpt2)  # NOTICE: used gptX instead of simple number
grub> linux /boot/vmlinuz-<version> root=/dev/sda1
grub> initrd /boot/initrd.img-<version>
grub> boot

as @jam did and @wp78de suggested (and also it was said in his refs).

Then I made update-grub and stuck on grub-install with error

grub-install: error: will not proceed with blocklists

The reason was in GPT. There were some useful stuff in this thread, but the simplest approach was to use BootRepair. I don't know, if there were some special work performed by BootRepair, but i checked to reinstall GRUB and now everything works fine!

0

I had this exact same issue (Centos 7) with MBR boot - did not matter what i tried in terms of disks, partitions, versions of Clonezilla etc - in the end i purchased the PartedMagic ISO that was referenced earlier in the thread - and although it used CLonezilla - it obviously performed some magic at the end of the process as the cloned disks boot with no manual intervention.

Craig

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.