after grub2 edit, i have every entry twice

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
winsucks

after grub2 edit, i have every entry twice

Post by winsucks »

hi i tried to edit grub2

i did

Code: Select all

sudo gedit /etc/grub.d/40_custom
sudo gedit /boot/grub/grub.cfg
i copied the menuentries to the 40_custom
then

Code: Select all

sudo update-grub
after restart i had the old entries at the top,
and the new i created under it,
so i have every entry twice.

how can i remove the old entries so that i only have the edited left?

thx
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
oobetimer

Re: after grub2 edit, i have every entry twice

Post by oobetimer »

How about if you remove those 40_custom entries?
StanTheMan

Re: after grub2 edit, i have every entry twice

Post by StanTheMan »

If you have your 40_custom menuentries in placed , then change the permissions of 20_linux-xen and 30_os-prober by removing the executive (x)

Terminal
cd /etc/grub.d
ls -l
sudo chmod a-x 20_linux-xen
sudo chmod a-x 30_os-prober

Now run
updatge-grub

The entries normally generated b 20 and 30 will not be generated , and all you will get is the entries in 40 .
scratch178
Level 1
Level 1
Posts: 34
Joined: Sat Sep 18, 2010 9:13 am

Re: after grub2 edit, i have every entry twice

Post by scratch178 »

it works 50 % windows isnt in the boot menu anymore but linux mint still is

Code: Select all

sudo chmod a-x 20_linux-xen
chmod: cannot access `20_linux-xen': No such file or directory
i think there is the problem
StanTheMan

Re: after grub2 edit, i have every entry twice

Post by StanTheMan »

Tey this - -
Terminal
cd /boot/grub
sudo gedit

Now this shouuld bring up a Root text editor/
Open file /grub.cfg

Fine the paragraph for menuentry Windows xxxxx
Copy that whole menuentry paragraph
Close
Open file /etc/grub.d/40_-custom

Paste the windows paragraph in whatever order you like .
Save the file
Do another sudo update-grub ,
Last edited by StanTheMan on Sat Sep 25, 2010 8:46 pm, edited 1 time in total.
StanTheMan

Re: after grub2 edit, i have every entry twice

Post by StanTheMan »

Dupe . Ignore.
gordon.cooke

Re: after grub2 edit, i have every entry twice

Post by gordon.cooke »

What exactly is it you are trying to edit in your grub2 menu??

Grub2 doesnt work like grub legacy in terms of updating. The update-grub command executes all the scripts in the /etc/grub.d/ folder and uses those scripts to tell it how to build the grub.cfg file. The 40_custom file executes last so that you can add anything you want. Note the key word is ADD. When the earlier scripts (like 30_OS-prober) are run they build their entries, then 40_custom executes and tacks on what you put in it. Thats why when you copied grub.cfg into 40_custom you get double entries. The first half is everything update-grub built form the scripts, and the second half is what you put there (since this came from grub.cfg it is all the same things update-grub had detected and built previously)

Update-grub uses any scripts in /etc/grub.d/ folder and only those scripts. Thats why when you make some not executable they aren't used and those entries aren't auto built. If you really want to turn those off look in the folder. In mint the file for detecting linux partitions is 10_linux

In theory you could use only 40_custom and disable everything else. But then it would NOT detect anything when you run update-grub and youd be manually changing 40_custom for any changes. At that point you might as well just edit grub.cfg and nt use update-grub. So I'll return to the question of what are you trying to do?
smokeymtn_ron
Level 3
Level 3
Posts: 192
Joined: Mon May 18, 2009 8:03 pm
Location: Southeast Asia

Re: after grub2 edit, i have every entry twice

Post by smokeymtn_ron »

I just redid my grub menu using this article and it worked out great. I'm not real smart with computers so I had to read it about 2 or 3 times till it made sense to me, but after that it was a piece of cake. :D (Chap., 5,6, and 7 should really help you out for what I think you want to do. Good Luck)

https://help.ubuntu.com/community/Grub2#/etc/grub.d/
scratch178
Level 1
Level 1
Posts: 34
Joined: Sat Sep 18, 2010 9:13 am

Re: after grub2 edit, i have every entry twice

Post by scratch178 »

i just did my configuration usind this method
http://www.youtube.com/watch?v=jbg-x-tv ... ion_466660

its working great. i just edited the grub.cfg.

thx
smokeymtn_ron
Level 3
Level 3
Posts: 192
Joined: Mon May 18, 2009 8:03 pm
Location: Southeast Asia

Re: after grub2 edit, i have every entry twice

Post by smokeymtn_ron »

scratch178 wrote:i just did my configuration usind this method
http://www.youtube.com/watch?v=jbg-x-tv ... ion_466660

its working great. i just edited the grub.cfg.

thx
The main menu file, /boot/grub/grub.cfg, is not meant to be edited, even by 'root'.
grub.cfg is overwritten anytime there is a update, a kernel is added/removed, or the user runs update-grub


The primary configuration file for changing menu display settings is /etc/default/grub.

Configuring GRUB 2
Configuration changes are normally made to /etc/default/grub and to the custom files located in /etc/grub.d. The /boot/grub/grub.cfg file should not be edited by the user; changes to this file are made by configuration scripts.
From:
https://help.ubuntu.com/community/Grub2#Configuring GRUB 2
Locked

Return to “Installation & Boot”