Opened 12 years ago

Closed 11 years ago

#159 closed defect (fixed)

stabgrub-me script needs mod for Ubuntu (/etc/grub.conf is a link to a full path name)

Reported by: cummings Owned by: bruno
Priority: normal Milestone: 2.2.4
Component: mondo Version: 2.2.2
Severity: normal Keywords:
Cc:

Description

In Ubuntu 6.10 -

$ ls -l /etc/grub.conf lrwxrwxrwx 1 root root 19 2007-04-13 15:12 /etc/grub.conf -> /boot/grub/menu.lst

I don't know how this patch will play with other distributions, but for Ubuntu it seems to work better this way -

*** stabgrub-me.orig    2007-04-15 11:07:28.000000000 -0500
--- stabgrub-me.new     2007-04-15 11:13:23.000000000 -0500
***************
*** 37,43 ****
                # which we need to resolve and prepend with /mnt/RESTORING because
                # we run this outside the chroot.
                if [ -L "$old_grubconf" ] ; then
!               old_grubconf=/mnt/RESTORING/etc/`readlink "$old_grubconf"`
                fi
                return 0
      elif [ -f "/mnt/cdrom/archives/CUCKOO" ] ; then
--- 37,43 ----
                # which we need to resolve and prepend with /mnt/RESTORING because
                # we run this outside the chroot.
                if [ -L "$old_grubconf" ] ; then
!               old_grubconf=/mnt/RESTORING`readlink "$old_grubconf"`
                fi
                return 0
      elif [ -f "/mnt/cdrom/archives/CUCKOO" ] ; then

Related problem is -

When mondorestore does 'vi /mnt/RESTORING/etc/grub.conf', busybox? doesn't follow link, so get empty file. (should I create a separate ticket for this?)

Change History (9)

comment:1 Changed 12 years ago by bruno

  • Status changed from new to assigned

I think busybox IS following links:

[root@victoria2 users]# ll /etc/grub.conf
lrwxrwxrwx 1 root root 19 jui 29  2005 /etc/grub.conf -> /boot/grub/menu.lst
[root@victoria2 users]# /usr/lib/mindi/rootfs/bin/busybox cat /etc/grub.conf
timeout 5
color black/cyan yellow/cyan
default 0

title desktop smp 2.6.17.14-mm-5
kernel (hd0,0)/boot/vmlinuz-2.6.17.14-mm-desktop-5mdvsmp BOOT_IMAGE=desktop_smp_2.6.17.14-mm-5 root=/dev/sda1 splash=silent vga=788
initrd (hd0,0)/boot/initrd-2.6.17.14-mm-desktop-5mdvsmp.img

title desktop smp 2.6.17.13-mm-3
kernel (hd0,0)/boot/vmlinuz-2.6.17.13-mm-desktop-3mdvsmp BOOT_IMAGE=desktop_2.6.17.13 root=/dev/sda1 splash=silent vga=788
initrd (hd0,0)/boot/initrd-2.6.17.13-mm-desktop-3mdvsmp.img

title floppy
root (fd0)
chainloader +1

title memtest-1.70
kernel (hd0,0)/boot/memtest-1.70.bin BOOT_IMAGE=memtest-1.70

the problem is that your patch will not work for some distros (Debian IIRC) due to that:

[root@victoria2 users]# mount -o bind / /mnt/RESTORING/
[root@victoria2 users]# ll /mnt/RESTORING/etc/grub.conf
lrwxrwxrwx 1 root root 19 jui 29  2005 /mnt/RESTORING/etc/grub.conf -> /boot/grub/menu.lst
[root@victoria2 users]# readlink  /mnt/RESTORING/etc/grub.conf
/boot/grub/menu.lst
[root@victoria2 users]# readlink -f /mnt/RESTORING/etc/grub.conf
/boot/grub/menu.lst
[root@victoria2 ~]# cd /mnt/RESTORING/
[root@victoria2 etc]# ln -sf fstab toto
[root@victoria2 users]# readlink -f /mnt/RESTORING/etc/toto
/mnt/RESTORING/etc/fstab
[root@victoria2 users]# readlink  /mnt/RESTORING/etc/toto
fstab

So I need to make a more precise check or use chroot.

comment:2 Changed 12 years ago by bruno

  • Milestone set to 2.2.4

rev [1448] should fix your readlink issue. Can you please check ?

comment:3 Changed 12 years ago by cummings

I'm working on checking the fix.

On the related problem - you are, of course :), right that busybox is following links, It escaped me before. But because the resolved link is relative to / and not /mnt/RESTORING something similar to your fix is needed in http://trac.mondorescue.org/browser/branches/2.2.4/mondo/src/mondorestore/mondo-rstr-tools.c#L1704 where

vi /mnt/RESTORING/etc/grub.conf

effectively turns into

vi /boot/grub/menu.lst

and that leads to a blank editor screen.

P.S. I do try to put myself in your place and think about how difficult it must be to find the wheat amidst the chaff in the stuff you get and to make changes that support all of the different distributions. Thanks for your efforts.

comment:4 Changed 12 years ago by cummings

I applied the patch 1448 and restored in qemu and now it installs grub and successfully boots. (Immediately before that I did also check that the problem was still present.)

Thanks, Bruno!

See above for one remaining issue. Would you like me to create a separate ticket?

Scott

comment:5 Changed 12 years ago by bruno

No we can continue here.

Your point is interesting :-) I wonder why the edition is not launched in the chroot then. It would make it easier (I need to add lots of code in C to check what is done in one shell/perl command).

So replacing

sprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor);

by {{{sprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); }}}

Same thing for grub.conf of course. Would you like to test that please ?

Also FYI I know build Ubuntu packages for 7.04 (on our ftp site). You may also want to have a look as I produce a pre-2.2.4 for a colleague there. Might be useful for you as well.

And thanks for your feedback and encouragemetns ;-) Much appreciated.

comment:6 Changed 12 years ago by bruno

I modified the code with the above idea in rev [1498] Time to test ;-)

comment:7 Changed 12 years ago by anonymous

  • Milestone 2.2.4 deleted

Milestone 2.2.4 deleted

comment:8 Changed 12 years ago by bruno

  • Milestone set to 2.2.4

Could you check that the official 2.2.4 effectively fixes that bug ? TIA.

comment:9 Changed 11 years ago by bruno

  • Resolution set to fixed
  • Status changed from assigned to closed

No feedback so considered closed.

Note: See TracTickets for help on using tickets.