Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Fix grub2 on opensuse 12.2

  1. #1
    Join Date
    Sep 2012
    Location
    Nürnberg
    Posts
    23

    Default Fix grub2 on opensuse 12.2

    This was third time suse screws up the bootloader after system update.

    This is simple work around for this issue because suse can't fix it.

    If you have working grub2, make backup before you start Yast.

    Code:
    >sudo cp /boot/grub2/grub.conf /home/user/tmp
    Now run Yast update.
    After update copy grup.conf back

    Code:
    >sudo cp  /home/user/tmp/grub.conf /boot/grub2/
    >sudo cp  /home/user/tmp/grub.conf /boot/grub/
    
    >sudo chmod 444 /boot/grub/grub.conf
    >sudo chmod 444 /boot/grub2/grub.conf
    
    >sudo grub2-install /dev/sda
    If you have running grub bootloader on some other linux on the same computer.

    Copy grub.conf from other linux.

    Code:
    >sudo mount /dev/sdc5 /mnt
    
    >sudo cp /mnt/boot/grub2/grub.conf /home/user/tmp
    Now run Yast update.
    After update copy grup.conf back

    Code:
    >sudo cp  /home/user/tmp/grub.conf /boot/grub2/
    >sudo cp  /home/user/tmp/grub.conf /boot/grub/
    
    >sudo chmod 444 /boot/grub/grub.conf
    >sudo chmod 444 /boot/grub2/grub.conf
    
    >sudo grub2-install /dev/sda
    If you wonder why I tell you to copy grub.conf twice, the reason is that suse doesn't know from which one to boot - so to be sure, copy it to both.
    Last edited by jalomann; 21-Oct-2012 at 08:17. Reason: Added tags.

  2. #2
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,500
    Blog Entries
    48

    Question Re: Fix grub2 on opensuse 12.2

    So I do not have a grub.conf file, mine is called /boot/grub2/grub.cfg. You can cause a new config file to be created with the terminal command:

    Code:
    sudo /usr/sbin/grub2-mkconfig --output=/boot/grub2/grub.cfg
    Setting the permissions of 444 is very curious as it only gives ONLY read ability to EVERYBODY. Not sure what you can do to modify the file later, though I can say I have never tried such a combination before. Perhaps that would create the problem that you have? For anyone using Grub 2, I suggest you have a look at my bash script Grub2Cmd you can find here:

    GNU Grub2 Command Help/Config Editor - Version: 1.85 - Blogs - openSUSE Forums

    And to understand file/folder permissions have a look here:

    S.A.F.P. - SUSE Automated File Permissions - Version 1.0.4 - Blogs - openSUSE Forums

    I am happy that this procedure works for you, but I could not recommend it to others and it does not get to the heart of your problem as most users are not losing their Grub2 setup after a system update. Not that it could not happen, but it has not happened to me so far on several PC's.

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  3. #3
    Join Date
    Sep 2012
    Location
    Nürnberg
    Posts
    23

    Default Re: Fix grub2 on opensuse 12.2

    I set the same permissions as they are orininally.

    I can try your script as soon as I some time to play around. The actual problem is that grub2-mkconfig doesn't see other installed operating systems at all and removes them from boot options. This worked in one update in the mean time but now it is broken again.

    If I print out grub2-mkconfig to terminal, there is only opensuse 12.2 what I use as a test environment and my productive linux is still on the other partition.

  4. #4
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,500
    Blog Entries
    48

    Smile Re: Fix grub2 on opensuse 12.2

    Quote Originally Posted by jalomann View Post
    I set the same permissions as they are orininally.

    I can try your script as soon as I some time to play around. The actual problem is that grub2-mkconfig doesn't see other installed operating systems at all and removes them from boot options. This worked in one update in the mean time but now it is broken again.

    If I print out grub2-mkconfig to terminal, there is only opensuse 12.2 what I use as a test environment and my productive linux is still on the other partition.
    So I can only say that there is a problem, but I am not sure how your solution is working. The grub 2 script called /etc/grub.d/30_os-prober is supposed to detect other operating system on your PC. The script /etc/grub.d/10_linux detects all of the different kernel versions installed into openSUSE. The Grub 2 menu file is called /boot/grub2/grub.cfg and its permssions are set to 600, thats rw------- meaning that only root can read and write to this file. It can be changed, but when the grub.cfg file is updated by grub 2, it goes back to 600. My grub2cmd bash script asks for root permission before you can view or edit this file. Manual edits will be over written on the next kernel version update. Have a look at Grub2Cmd and perhaps it will help make sense of what you see.

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  5. #5

    Default Re: Fix grub2 on opensuse 12.2

    Quote Originally Posted by jalomann View Post
    The actual problem is that grub2-mkconfig doesn't see other installed operating systems at all and removes them from boot options.
    If you want to have static menu entries that are not recreated on grub-mkconfig, add them to either /etc/grub.d/40_custom (you need to re-run grub2-mkconfig) or to /boot/grub2/custom.cfg (included automatically during boot as long as you used grub2-mkconfig to create grub.cfg ).

    /boot/grub2/grub.conf
    Did you actually check whether your instructions work? As already mentioned grub.conf does not normally exist.

  6. #6

    Default Re: Fix grub2 on opensuse 12.2

    Quote Originally Posted by jalomann View Post
    I set the same permissions as they are orininally.

    I can try your script as soon as I some time to play around. The actual problem is that grub2-mkconfig doesn't see other installed operating systems at all and removes them from boot options. This worked in one update in the mean time but now it is broken again.
    Try updateGrub2. See this post: http://forums.opensuse.org/english/o...ml#post2497592 (and the script in post #7)

  7. #7
    Join Date
    Sep 2012
    Location
    Nürnberg
    Posts
    23

    Default Re: Fix grub2 on opensuse 12.2

    Thank you for support but I don't need links what file permissions are.
    I am at my day job sysadmin for +100 hosts.

    I can write my own scripts to fix grub like all you have done.
    My message is to suse development department that they should stop
    underestimating end users.

    If you look at
    /usr/lib/linux-boot-probes/mounted/40grub2
    you will notice that it writes to
    /boot/grub/grub.conf

    which is 100% sure _wrong_, because grub has it own script.

  8. #8

    Default Re: Fix grub2 on opensuse 12.2

    Quote Originally Posted by jalomann View Post
    If you look at
    /usr/lib/linux-boot-probes/mounted/40grub2
    you will notice that it writes to
    /boot/grub/grub.conf
    Code:
    bor@opensuse:~> fgrep grub.conf /usr/lib/linux-boot-probes/mounted/40grub2
    bor@opensuse:~>

  9. #9

    Default Re: Fix grub2 on opensuse 12.2

    Quote Originally Posted by jalomann View Post
    If you look at
    /usr/lib/linux-boot-probes/mounted/40grub2
    you will notice that it writes to
    /boot/grub/grub.conf
    which is 100% sure _wrong_, because grub has it own script.
    It is in 40grub, NOT in 40grub2.

    Code:
    grubconf=
    if [ -e "$mpoint/boot/grub/menu.lst" ]; then
            grubconf="menu.lst"
    elif [ -e "$mpoint/boot/grub/grub.conf" ]; then
            grubconf="grub.conf"
    fi
    
    if [ "$grubconf" ] && \
       ([ ! -e "$mpoint/boot/grub/grub.cfg" ] || \
        [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub/grub.cfg" ]); then
            debug "parsing $grubconf"
            parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/$grubconf"
    fi
    And it is 100% right, because "grub.conf" is the name used for Legacy Grub menu under Fedora, where other distros traditionally used "menu.lst" (before Fedora switched to Grub2).

  10. #10

    Default Re: Fix grub2 on opensuse 12.2

    And I've already seen another "grub.conf" somewhere serving another purpose, but I don't remember on which distro and with which Grub version. It wasn't the boot menu but a short script with some parameters to install Grub, as far as I remember.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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