Find the answer to your Linux question:
Results 1 to 8 of 8
I used to multi-boot XP+Linux w/o problem. This time I 1st installed CentOS and it works, then installed Ubuntu and now it is always boot to Ubuntu(sda6). Ubuntu's /boot(sda5) has ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    13

    two linux one disk, 1st one cannot boot any more


    I used to multi-boot XP+Linux w/o problem. This time I 1st installed CentOS and it works, then installed Ubuntu and now it is always boot to Ubuntu(sda6). Ubuntu's /boot(sda5) has grub folder yet no menu.lst.
    I mounted sda1 and added Ubuntu in sda1's grub/menu/st to make Ubuntu bootable, or else I cannot boot the PC. After remove comments of "hiddenmenu" it shows only Ubuntu menu.
    Not sure what I did on MBR and how to restore previous bootable centOS.

    sda1/grub/menu.lst (logical link to grub.conf)
    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE: You have a /boot partition. This means that
    # all kernel and initrd paths are relative to /boot/, eg.
    # root (hd0,0)
    # kernel /vmlinuz-version ro root=/dev/sda3
    # initrd /initrd-version.img
    #boot=/dev/sda
    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (2.6.18-92.1.13.el5xen)
    root (hd0,0)
    kernel /xen.gz-2.6.18-92.1.13.el5
    module /vmlinuz-2.6.18-92.1.13.el5xen ro root=LABEL=/12 xencons=tty6 rhgb quiet
    module /initrd-2.6.18-92.1.13.el5xen.img
    title CentOS (2.6.18-92.1.13.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-92.1.13.el5 ro root=LABEL=/12 rhgb quiet
    initrd /initrd-2.6.18-92.1.13.el5.img
    title CentOS (2.6.18-92.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-92.el5 ro root=LABEL=/12 rhgb quiet
    initrd /initrd-2.6.18-92.el5.img
    title Ubuntu (2.6.32-21)
    root (hd0,5)
    kernel /vmlinuz-2.6.32-22-generic-pae ro root=/dev/sda6
    initrd /initrd-2.6.32-22-generic-pae.img

    Ubuntu boot df:
    jdai@j54008:/boot$ df
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/sda6 100790004 16865420 78804672 18% /
    none 4126088 284 4125804 1% /dev
    none 4130292 260 4130032 1% /dev/shm
    none 4130292 92 4130200 1% /var/run
    none 4130292 0 4130292 0% /var/lock
    none 4130292 0 4130292 0% /lib/init/rw
    none 100790004 16865420 78804672 18% /var/lib/ureadahead/debugfs
    /dev/sda5 124427 21313 96690 19% /boot
    /dev/sda1 505604 28805 450695 7% /mnt/sda1

    partitions:
    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 65 522081 83 Linux
    /dev/sda2 66 319 2040255 82 Linux swap / Solaris
    /dev/sda3 320 13067 102398310 83 Linux
    /dev/sda4 13068 60801 383423324+ 5 Extended
    /dev/sda5 13068 13083 128488+ 83 Linux
    /dev/sda6 13084 25831 102398278+ 83 Linux
    /dev/sda7 25832 60801 280896493+ 83 Linux

    sda1=CentOS /boot, sda2=common swap, sda3=CentOS, sda5=Ubuntu /boot, sda6=Ubuntu, sda7=common data

    thanks for help, may be my MBR wrong, how do I fix it?

  2. #2
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    I'm not sure which version of Ubuntu you are running but the latest versions use GRUB2, whereas I'm pretty sure that CentOS still uses GRUB Legacy. The problem with this is that the two won't work together, so my guess is that you'll need to either install one version of GRUB or the other, and use it with both distributions.
    oz

  3. #3
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    If you use Ubuntu 9.10 or newer, you use Grub2.
    AFAIK, CentOS still uses Grub Legacy.
    You removed the hash mark (#) from before the hiddenmenu entry in the CentOS menu.lst which means you will not see this menu on boot.
    You installed Ubuntu last and probably its Grub2 to the master boot record? That's the default unless you changed it. I expect the menu you are seeing on boot is from the Ubuntu Grub2.
    Grub2 does not have a menu.lst file or a grub.conf file. There is a /boot/grub/grub.cfg file.
    I can't think of any reason to have two boot partitions?
    I'm not familiar with Grub2 but here's a link to a tutorial. There are sections in it which explain booting with both Grub2 and Grub Legacy:

    GRUB 2 bootloader - Full tutorial

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Apr 2010
    Posts
    13
    I run ubuntu 10.04 LTS and centOS 5.2, thanks for clarify.
    if I don't remove # before the line I seems see no menu at all. The menu is from ubuntu.
    I can't remember whether I overwrited centos grub, but its config is still there.
    I don't know whether I can use one /boot for two linuxes when I installed them. After that I see kernel files and believe I can.
    yes no menu.lst or gurb.conf, ubuntu .cfg is a script a bit complex
    any simple solution? Can I reinstall older version of ubuntu that uses grub? which one?

  6. #5
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    if I don't remove # before the line I seems see no menu at all. The menu is from ubuntu.
    The menu you posted earlier was the CentOSmenu.lst (which as it says in the file, is just a link to the grub.conf) By removing the hash mark from the left of the word hiddenmenu, that line (hiddenmenu) is read and the CentOS menu is not displayed.

    I can't remember whether I overwrited centos grub, but its config is still there.
    If you are now only seeing the Ubuntu Grub menu and are only able to boot Ubuntu, I expect your have Grub2 from Ubuntu in the master boot record. You will need to add an entry for CentOS to your Ubuntu Grub menu.

    You can boot a Grub2 from Grub Legacy but my understanding is that it is easier to do the reverse?? I have not used Grub2 as it is still beta software so the only thing I can suggest is that you read the tutorial in the link I posted yesterday. It is very detailed with examples.

    Good Luck!

  7. #6
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Quote Originally Posted by lastguy View Post
    yes no menu.lst or gurb.conf, ubuntu .cfg is a script a bit complex
    any simple solution? Can I reinstall older version of ubuntu that uses grub? which one?
    The Ubuntu folks have posted some nice articles for working with both versions of GRUB that might help you get the version you decide to keep configured and working properly:

    https://help.ubuntu.com/community/GrubHowto

    https://help.ubuntu.com/community/Grub2

    I've been running GRUB2 for a couple of years now and it's worked well, except that now and then the developers change the way things work since it is still beta, and that means some troubleshooting is required to get it to boot again. GRUB Legacy might still be the safest bet for you.
    oz

  8. #7
    Just Joined!
    Join Date
    Apr 2010
    Posts
    13

    too hard to mix grub/grub2

    1.$sudo update-grub
    Generating grub.cfg ...
    Found linux image: /boot/vmlinuz-2.6.32-22-generic-pae
    Found initrd image: /boot/initrd.img-2.6.32-22-generic-pae
    Found memtest86+ image: /memtest86+.bin
    Found CentOS release 5.2 (Final) on /dev/sda3
    done
    But, no entry is added in /boot/grub/grub.cfg

    2.add following in /etc/grub/d/40_custom:
    # the 'exec tail' line above.
    menuentry 'CentOS 5.2, with Linux 2.6.18-92.1.13.el5xen try' --class centos --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd0,1)'
    search --no-floppy --fs-uuid --set a8a2a736-4024-4ac8-9918-3a2216b18274
    linux /vmlinuz-2.6.18-92.1.13.el5xen root=/dev/sda1 xencons=tty6 rhgb ro quiet splash
    initrd /initrd-2.6.18-92.1.13.el5xen.img
    }
    menuentry 'Grub 1 Bootloader' {
    insmod ext3
    set root=(hd0,1)
    search --no-floppy --fs-uuid --set a8a2a736-4024-4ac8-9918-3a2216b18274
    chainloader +1
    }
    And update-grub the entries are added, but boot gives errors like:
    invalid magic number, you need to load kernel first, no matter search line is there or not. UUID is for sure correct.
    Add UUID in Grub 1 Bootloader it says file not found

  9. #8
    Just Joined!
    Join Date
    Apr 2010
    Posts
    13

    two linux with mixed grub/grub2 works eventually

    My appreciates for all helps here! I summarize the steps, may be useful for others:
    1. I partitioned for CentOS5.2 and Ubuntu10.04 when I have not known I can use single /boot. I installed CentOS and it works, then Ubuntu with its own /boot. I can't boot then installed grub on MBR using Ubuntu live DVD.
    2. then I can't boot CentOS. Ozar and yancek tells me Ubuntu 9.10+ uses grub2!!! and /dev/sda1 is now hd(0,1) rather then hd(0,0) in grub. Tried various options, found "search" or "UUID" doesn't work for CentOS booting, I need to use CentOS' /boot/grub/menu.list lines that uses "root=LABEL=", what I did:

    $sudo gedit /etc/grub.d/40_custom to add:
    menuentry 'CentOS 5.2, with Linux 2.6.18-92.1.13' --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd0,1)'
    linux /vmlinuz-2.6.18-92.1.13.el5 root=LABEL=/12 rhgb ro quiet splash
    initrd /initrd-2.6.18-92.1.13.el5.img
    }
    above filenames are pulled from /mnt/sda1/grub/menu.lst or CentOS' grub.conf

    $sudo update-grub
    $sudo cat /boot/grub/grub.cfg to verify your addition
    $sudo reboot

    thanks again Ozar and Yancek!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •