How to update grub (legacy) in opensuse?

Hey guys, new to the opensuse forum. Last time I used opensuse was probably around 2006 or 2007. So it has been a while. I will download the .iso every once in a while and run it in a VM to see what is new. I like where it is going.

Anyway, I was hoping that someone might be able to guide me in the right direction about a question that I have.

Is it possible, in opensuse, to update grub via the cli (command line interface (command terminal)) so that other OSes are added to the menu.list and/or the menu.list is refreshed?

In other distros, for example debian/ubuntu/mint/etc., I can run:


sudo update-grub

for grub legacy (lets just call this grub from here on out) and


sudo update-grub2

for grub2. This will then refresh grub/grub2 boot menu to show anyother OSes detected, i.e. Windows XP/Vista/7, Ubuntu, Mint, etc.

I have done it numerous times from within other distros, but never from within opensuse. My concern is that, if I remember correctly, opensuse doesn’t use the ‘sudo’ command for super-user root access. It uses the ‘su’ command for that. Again, correct me if I am wrong.

So, I would like to know, if I were to run:


su update-grub

from within a terminal while in opensuse, will it update the menu.list just as doing it in other distros does? Is that the correct command to do what I am looking for?

Thanks for your patience and help, I appreciate it! lol!

-Ojosazul

We normaly use YaST > System > Bootloader to make changes to the Grub configuration (I assume you mean that and not really updating Grub).

When you do not use (or want to use) this in a GUI, there is the ncurls interface of YaST. In a terminal (as root) type:

yast

and you will see the same items as in the GUI, but usable via tab and arrow keys.

And as the most basic way of editing /boot/grub/menu.lst use vi.

@hcvv - thanks for your response. I appreciate it. :slight_smile:

Interesting. That is right, I had forgot about YaST.

What I mean by updating grub is for example:

I have 2 HDD. On one I install Windows (XP/Vista/7, doesn’t matter). Then I take out the first one. I connect the second one and install Linux (openSUSE, Ubuntu, Mint, Arch, etc.) It will install GRUB as the bootloader to that HDD, being that it is the only HDD.

Then I re-connect the 1st HDD (1st - Windows; 2nd - Linux Distro). If I turn on the machine, it will boot into the primary drive (master for PATA & primary selected drive via BIOS for SATA) and corresponding OS. Yet I won’t have an option to boot the other OS. Now, on my system, and on many others, during POST we can press, for example, the F8 key to have a drive selection menu show up. Depending on which drive I select, the corresponding OS to that drive will then be selected and boot. But I don’t want to have to press F8 every time.

So, in the past, I make sure that the HDD with Linux installed on it is the primary drive (master or 1st via bios), that way it will boot first every time. Then once I am in to linux, I will open up a terminal and input the following command:


sudo update-grub

or


sudo update-grub2

This will then cause grub to scan all connected drives for any known OSes and add them to the menu.list or grub.cfg. Then at the next power-on of my machine, the grub boot menu will show both the installed linux and windows, plus any other OSes that it found.

I just did this actually yesterday and the day before yesterday with three drives: 1st - Win7 Pro x64; 2nd - Mint 8 x64 (now mint 9 x64); and 3rd - Ubuntu 10.04 x64. It worked perfectly.

That is what I mean by update grub: add other OSes to the boot menu automatically w/out having to manually enter them into the menu.list file (that is a pain!)

Will YaSt do this for me via the GUI and/or terminal?


And in case you are wondering why I did it like that, it is because this way, each OS has it’s own bootloader present on the same drive. It isn’t dependent upon another drive being present just so that it can boot. I can take out a drive and still have access to the other drive’s OSes. If something is broken, for example, if I remove the ubuntu drive then connect it at a later time to a different SATA slot, All I have to do is update Mint 9’s boot menu and it will detect the “new” ubuntu being present and remove the “old” ubuntu’s entry in the boot menu. It has saved me from many problems.

That’s why. lol!

-Ojosazul

Will YaSt do this for me via the GUI and/or terminal?
Yes the sequence is Yast –> system –> bootloader –> Other button –> propose new configuration.

In case of problems, first run this command to store the old Grub config file (menu.lst):

sudo cp /boot/grub/menu.lst /boot/grub/yikes.lst

I searched for update-grub on Google. It seems to be Debian.
I can not find it in the normal openSUSE repos and never heard about it in these openSUSE Forums.
It being a script (as I understand from my quick search) you could copy it from a Debian system, but I would use it with care. YaST may not like it, but as long as you are managing everything yourself (with update-grub) and do not use YaST for this item, I guess you are safe.

EDIT: and as swerdna points out, YaST is cleverer then I knew of. One learns a new trick every day.

Awesome!!! Thanks guys for the help. That was exactly what I was looking for.

That is nice that YaST can do it via a GUI. Makes things a little easier.

I appreciate your help.

-Ojosazul

One other quick question somewhat related to my op.

Does openSUSE, via the terminal, use ‘sudo’ or ‘su’ to gain super-user/root access? I always thought that it was ‘su’. :question:

Take care.

-Ojosazul

Either will work. sudo is only good for one process su changes users until you exit the session.

Also you should use su -
there is a difference in the enviroment if you leave the minus sign off. It read the man su for more info

WHAT DOES —>OTHER BUTTON –> PROPOSE NEW CONFIGURATION MEAN?
There is no such button.
If your going to post instructions post the correct steps !

On Fri, 23 Oct 2015 05:46:02 +0000, RBLOCK wrote:

> swerdna;2184109 Wrote:
>> Yes the sequence is Yast → system → bootloader → Other button →
>> propose new configuration.
>>
>> In case of problems, first run this command to store the old Grub
>> config file (menu.lst):>
> Code:
> --------------------
> > > sudo cp /boot/grub/menu.lst /boot/grub/yikes.lst
> --------------------
>> >
>> >
>
> WHAT DOES —>OTHER BUTTON → PROPOSE NEW CONFIGURATION MEAN?
> There is no such button.
> If your going to post instructions post the correct steps !

You might want to check the age of this thread - you’re responding to a
post that is > 5 years old.

While it’s possible that the user interface at this point hasn’t changed
in 5 years, my money is on that it has.

If you’re having a problem, you might start a new thread and discuss the
problem you have with a current version of openSUSE.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

This should be used with the correct procedures regardless, if someone is looking on the web.

We don’t know what version of opensuse that you are using.

Support for legacy grub was removed from Yast for opensuse 13.2, though it should still be there for 13.1.

As far as I know, the command “update-bootloader” (run it as root) will update grub legacy if that is the installed bootloader.

On Sat, 24 Oct 2015 01:46:01 +0000, RBLOCK wrote:

> This should be used with the correct procedures regardless, if someone
> is looking on the web.

I think you’re misunderstanding the purpose of a forum - there are tens
of thousands of user-to-user messages here, if not hundreds of thousands.

The purpose isn’t to keep every thread up to date with the latest
information. That’s not how forums work.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C