I'm trying to restore an ubuntu-lucid-disk-image with Clonezilla live 1.2.8-23. The disk-image contains a swap-partition on sda1 and the linux-root-partition on sda2, grub-legacy is installed in the system.
1. Problem: Ubuntu lucid normaly installs grub2. If one installs grub-legacy, the mod-files remain in /boot/grub. Thus the test "if " in line 2187 of /opt/drbl/sbin/ocs-functions doesn't give the right result in such a situation.
A solution would be to chroot into $hd_img and run "grub-install -v"
Manually deleting the mod-files before making the image was a work-around for this problem.
2. Problem: After restoring the disk-image clonezilla-live fails to restore the boot-code due to
"The file /tmp/hd_…/boot/grub/stage1 not read correctly
Failed to install grub!!!"
The only way to restore it on the command-line is (as far as I found out):
mount /dev/sda2 /mnt
mount -bind /proc /mnt/proc
mount -bind /dev /mnt/dev
mount -bind /sys /mnt/sys
chroot /mnt grub-install /dev/sda
Without chrooting I didn't find a way to get it work.
Why isn't the clonezilla-way working?
Since the "-g" option is taken by default for the beginner-level, it would be nice, if you could correct this.
Greetings,
Tobias
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
after much examination I found out, that the debian-base-distrobution has a bug concerning grub - restoring grub-legacy with the clonezilla-ubuntu-version works without any problem.
In order to show that even debian itself is buggy in this point, I downloaded debian-live-6.0.1-i386-rescue.iso from debian.org, booted it and tried the following process:
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> find /boot/grub/stage1
Error 15: File not found
grub> quit
root@debian:/home/user#
The same procedure fails with the clonezilla-debian-live-cd, only the ubuntu version works correctly.
It seems that the buggy version of "grub" exists quit a long time, even version 0.97-59 doesn't work (though the actual ubuntu-version is based on it).
Greetings,
Tobias
P.s. I use the legacy-version of grub, because I use the password-protection of it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"Thus the test "if " in line 2187 of /opt/drbl/sbin/ocs-functions doesn't give the right result in such a situation." -> Do you have any suggestion about this?
So you also meant that Debian failed to re-run grub-install for grub 1? Which GNU/Linxu distribution did you restore? Since every distribution might have its own patches for grub1, which might cause incompatibility…
Steven.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In order to detect the version of the installed grub my first idea was to chroot into the installed system and run "grub -version".
But now I think that it would be better to stay in the system of the clonezilla-live-cd, thus avoiding problems with the differences between the installed OS and the OS of the clonezilla-live-cd. Maybe a good way to detect the version of installed grub is to check the existence of menu.lst respectivly grub.cfg. If both files exist the newer one should give a good hint about the right version.
To avoid to chroot into the installed OS both versions of grub should be installed in the clonezilla-live-cd. A few ideas for that:
1) This could be achieved by mounting a second aufs-layer (another-union-file-system) on top of the live-cd, in which only grub2 is installed over grub1.
2) A different and maybe easier way to run both grub-version from the clonezilla-live-cd is to put all necessary deb-packages on the live-cd and install the needed version of grub with dpkg. Since the live-cd is writable (due to aufs) this installation should work. Maybe this way causes problems for the clonezilla-server-mode?
3) Wrapper-scripts which call the correct grub1-bins respectivly grub2-bins due to a system-variable, like
export grubversion=1
grub-install /dev/sda
and the content of grub-installs would look like:
if ; then
/usr/sbin/grub1-install $@
else
/usr/sbin/grub2-install $@
fi
So you also meant that Debian failed to re-run grub-install for grub 1?
Yes, even the debian-live-cd has a bug in grub1. You can test it with the following commands
All this is depending only on OS of the live-cd not on the installed OS on the harddisk.
The "grub-shell-find" of debian doesn't find anything, with the ubuntu version every works fine. Since grub-install is using the find-command, the grub-install-command fails.
I'm using grub1 because it has an easy way of protecting the boot-menu for the computers in my school (I'm a mathematics and physics teacher in an german gymnasium). grub2 the password-protection isn't in an usable state.
One last idea: In line 1916 of ocs-functions you could also use "chroot $mnt_pnt bash -version" or even "chroot $mnt_pnt sh -c 'echo test'"
Greetings
Tobias
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm trying to restore an ubuntu-lucid-disk-image with Clonezilla live 1.2.8-23. The disk-image contains a swap-partition on sda1 and the linux-root-partition on sda2, grub-legacy is installed in the system.
1. Problem: Ubuntu lucid normaly installs grub2. If one installs grub-legacy, the mod-files remain in /boot/grub. Thus the test "if " in line 2187 of /opt/drbl/sbin/ocs-functions doesn't give the right result in such a situation.
A solution would be to chroot into $hd_img and run "grub-install -v"
Manually deleting the mod-files before making the image was a work-around for this problem.
2. Problem: After restoring the disk-image clonezilla-live fails to restore the boot-code due to
"The file /tmp/hd_…/boot/grub/stage1 not read correctly
Failed to install grub!!!"
The only way to restore it on the command-line is (as far as I found out):
mount /dev/sda2 /mnt
mount -bind /proc /mnt/proc
mount -bind /dev /mnt/dev
mount -bind /sys /mnt/sys
chroot /mnt grub-install /dev/sda
Without chrooting I didn't find a way to get it work.
Why isn't the clonezilla-way working?
Since the "-g" option is taken by default for the beginner-level, it would be nice, if you could correct this.
Greetings,
Tobias
Happy Easter,
after much examination I found out, that the debian-base-distrobution has a bug concerning grub - restoring grub-legacy with the clonezilla-ubuntu-version works without any problem.
In order to show that even debian itself is buggy in this point, I downloaded debian-live-6.0.1-i386-rescue.iso from debian.org, booted it and tried the following process:
root@debian:/home/user# mount /dev/sda1 /mnt
root@debian:/home/user# ls /mnt/boot/grub/stage1
/mnt/boot/grub/stage1
root@debian:/home/user# grub-mkdevicemap -no-floppy -device-map=/tmp/device.map
root@debian:/home/user# grub -batch -no-floppy -device-map=/tmp/device.map <<EOF
root (hd0,0)
find /boot/grub/stage1
quit
EOF
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> find /boot/grub/stage1
Error 15: File not found
grub> quit
root@debian:/home/user#
The same procedure fails with the clonezilla-debian-live-cd, only the ubuntu version works correctly.
It seems that the buggy version of "grub" exists quit a long time, even version 0.97-59 doesn't work (though the actual ubuntu-version is based on it).
Greetings,
Tobias
P.s. I use the legacy-version of grub, because I use the password-protection of it.
"Thus the test "if " in line 2187 of /opt/drbl/sbin/ocs-functions doesn't give the right result in such a situation." -> Do you have any suggestion about this?
So you also meant that Debian failed to re-run grub-install for grub 1? Which GNU/Linxu distribution did you restore? Since every distribution might have its own patches for grub1, which might cause incompatibility…
Steven.
In order to detect the version of the installed grub my first idea was to chroot into the installed system and run "grub -version".
But now I think that it would be better to stay in the system of the clonezilla-live-cd, thus avoiding problems with the differences between the installed OS and the OS of the clonezilla-live-cd. Maybe a good way to detect the version of installed grub is to check the existence of menu.lst respectivly grub.cfg. If both files exist the newer one should give a good hint about the right version.
To avoid to chroot into the installed OS both versions of grub should be installed in the clonezilla-live-cd. A few ideas for that:
1) This could be achieved by mounting a second aufs-layer (another-union-file-system) on top of the live-cd, in which only grub2 is installed over grub1.
2) A different and maybe easier way to run both grub-version from the clonezilla-live-cd is to put all necessary deb-packages on the live-cd and install the needed version of grub with dpkg. Since the live-cd is writable (due to aufs) this installation should work. Maybe this way causes problems for the clonezilla-server-mode?
3) Wrapper-scripts which call the correct grub1-bins respectivly grub2-bins due to a system-variable, like
export grubversion=1
grub-install /dev/sda
and the content of grub-installs would look like:
if ; then
/usr/sbin/grub1-install $@
else
/usr/sbin/grub2-install $@
fi
Yes, even the debian-live-cd has a bug in grub1. You can test it with the following commands
# apt-get install grub-legacy
# grub
# find /vmlinuz
All this is depending only on OS of the live-cd not on the installed OS on the harddisk.
The "grub-shell-find" of debian doesn't find anything, with the ubuntu version every works fine. Since grub-install is using the find-command, the grub-install-command fails.
I'm using grub1 because it has an easy way of protecting the boot-menu for the computers in my school (I'm a mathematics and physics teacher in an german gymnasium). grub2 the password-protection isn't in an usable state.
One last idea: In line 1916 of ocs-functions you could also use "chroot $mnt_pnt bash -version" or even "chroot $mnt_pnt sh -c 'echo test'"
Greetings
Tobias
Thanks for all the suggestions. Here we will think about them and to see if this mechanism can be improved in the future release.
Steven.