That is not universal, for example mine has different code at those lines you quoted because I have added an entry via 40_custom. Have a look at the first six lines of the file. They indicate that mkconfig generates the file. So if you edit that bit out, it will be regenerated sooner or later. If you want to remove an entry, have a look in Yast Bootloader Tab = Options. But I don’t know much about Grub, so other advice might arrive here (I hope).
The advice to not edit the file, is because it is automatically generated, and is regenerated on various events (such as a kernel update).
Yes, you can remove options. But they will come back.
The real trick would be for you to write a suitable “sed” script. Then, when needed, you can do:
cd /boot/grub2
sed -f /path/to/sed/script grub.cfg > grub.cfg.new
cp grub.cfg grub.cfg.old
mv grub.cfg.new grub.cfg
That’s because you will have to do this edit frequently enough that you will want to automate it.
Personally – I put up with the lines that I don’t need. I occasionally edit “grub.cfg” (using “vi”) to make temporary changes. And, if I like the temporary changes, then I edit “/etc/default/grub” or “/etc/grub.d/40_custom” so that the changes I want will show up automatically.
On a box without Windows, I turn off “probe for foreign OSs” (or whatever the option is), so that less menu entries are generated.
I make all the files in /etc/grub.d/ non-executable except 00_header and 90_consistent. I then edit the entries in 90_consistent when I need to. It’s a bit like the grub legacy menu.lst.
I think most people here would disagree with me but I find it easier than wading through loads of lines when I’ve changed a kernel on one of the partitions. I find grub will often apply the wrong kernel entry to the wrong partition.
Are you absolutely certain that, in /etc/grub.d/ there’s absolutely only one definition which leads to the “menuentry” text “openSUSE”?
Or, have you defined such a “menuentry” which the automatic scripts ignore and blithely generate a 2nd (default) “openSUSE” “menuentry” text?
Maybe, given the current automation status, you should change your “openSUSE” “menuentry” text to something different: “my openSUSE” for example.
"All executable files in this directory are processed in shell expansion order.
00_: Reserved for 00_header.
10_: Native boot entries.
20_*: Third party apps (e.g. memtest86+).
The number namespace in-between is configurable by system installer and/or
administrator. For example, you can add an entry to boot another OS as
01_otheros, 11_otheros, etc, depending on the position you want it to occupy in
the menu; and then adjust the default setting via /etc/default/grub."
Durr!
Then I found nrickert’s post:
“If you want to remove an entry, have a look in Yast Bootloader Tab = Options. But I don’t know much about Grub, so other advice might arrive here (I hope)”.
OK! Without much faith, I called up Yast, selected “Boot Loader” & “Edit Boot Disk Order”. The existing choice was /dev/sda so I added /dev/sda11 (the partition for Leap42) underneath and, what do you know, I got what I wanted - Leap42 1st, **SuSE 13.2 **2nd.
I haven’t got round to it, but when I install Tumbleweed, I hope to make it 2nd & 13.2 3rd.
As you say, you have similar problem. Thus your post is NOT an additional remark to the problem here as mentioned in the title.
This is really not a good way to advertize your problem to those that browse the forums for new problems/questions. They will miss your request and thus you will miss potential helpers.
Please start a thread of your own with a title with keywords that will draw the attention of people that might be able to help you.
Oh yes, and please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.