[SOLVED] Prevent grub-pc from linking to other OSs.

If none of the more specific forums is the right place to ask
Post Reply
Message
Author
User avatar
edbarx
Posts: 5410
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E

[SOLVED] Prevent grub-pc from linking to other OSs.

#1 Post by edbarx »

I want to prevent grub-pc from automatically creating links to other operating systems on my laptop. Whenever there is a kernel update, grub.cfg ends with links pointing at my Windows 7 installation - I want to get rid of those links. At the moment I am doing that by manually editing the grub.cfg file and it has always worked that way. I tried to force grub-pc to avoid creating links to Windows by renaming the relevant scripts in /etc/grub.d

Code: Select all

edbarx@edbarx-pc2:/etc/grub.d$ ls
00_header  05_debian_theme  10_linux  20_linux_xen  _30_os-prober  _30_otheros  40_custom  41_custom  README
As you can see I added an underscore to the files that I don't want to be executed.

I think this can be solved by changing the file permissions of the unwanted scripts making them impossible to execute.

Code: Select all

edbarx@edbarx-pc2:/etc/grub.d$ ls -l
total 52
-rwxr-xr-x 1 root root 6433 Aug  7 18:10 00_header
-rwxr-xr-x 1 root root 1474 Jul 16 18:46 05_debian_theme
-rwxr-xr-x 1 root root 4252 Aug  7 18:10 10_linux
-rwxr-xr-x 1 root root 4893 Aug  7 18:10 20_linux_xen
-rwxr-xr-x 1 root root 5789 Aug  7 18:10 _30_os-prober
-rwxr-xr-x 1 root root  475 Sep 12 09:37 _30_otheros
-rwxr-xr-x 1 root root  214 Aug  7 18:10 40_custom
-rwxr-xr-x 1 root root   95 Aug  7 18:10 41_custom
-rw-r--r-- 1 root root  483 Aug  7 18:10 README
As can be seen, all of the scripts are executable.

Any better ideas?
Thanks.
Last edited by edbarx on 2010-10-29 20:29, edited 1 time in total.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

smallchange
Posts: 1740
Joined: 2009-05-04 15:56

Re: Prevent grub-pc from linking to other OSs.

#2 Post by smallchange »

Maybe

Code: Select all

aptitude purge os-prober

confuseling
Posts: 2143
Joined: 2009-10-21 01:03

Re: Prevent grub-pc from linking to other OSs.

#3 Post by confuseling »

edbarx wrote:...
I think this can be solved by changing the file permissions of the unwanted scripts making them impossible to execute.
...
I did that once, and it worked - I'm pretty sure it's the 'preferred method'. For more fine grained control, I suppose you just comment out the bits you don't want.

I don't think you can purge os-prober, as far as I'm aware it's just a script, which is presumably part of the grub 2 package.
The Forum's search box is terrible. Use site specific search, e.g.
https://www.google.com/search?q=site%3A ... terms+here

smallchange
Posts: 1740
Joined: 2009-05-04 15:56

Re: Prevent grub-pc from linking to other OSs.

#4 Post by smallchange »

@confuseling
It is so easy to run

Code: Select all

dpkg -l | grep os-prober
and find that os-prober is a package that I fail to understand why you would write what you did.

User avatar
edbarx
Posts: 5410
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E

Re: Prevent grub-pc from linking to other OSs.

#5 Post by edbarx »

Code: Select all

root@edbarx-pc2:/home/edbarx# dpkg -l | grep os-prober
root@edbarx-pc2:/home/edbarx# 
I searched for os-prober but it doesn't seem to be installed.

Code: Select all

root@edbarx-pc2:/home/edbarx# apt-get remove --purge os-prober
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package os-prober is not installed, so not removed
The following package was automatically installed and is no longer required:
  libglpng
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
I think the remaining option is to change the file permission for the scripts in /etc/grub.d.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

User avatar
nadir
Posts: 5964
Joined: 2009-10-05 22:06
Location: away

Re: Prevent grub-pc from linking to other OSs.

#6 Post by nadir »

You could try to add an
exit 0
at the top of the scripts. First the shebang, then exit 0.
It is more easy to restore than to reset the ownerships (at least for me).
I had a look at 30-os-prober and it does use "exit 0" in case some things are given/not-given, and it does that at the very beginning. So in my eyes such a test looks reasonable.

As far i can tell the only scripts of interest should be 30-os-prober and 40/41-custom. If you ain't got os-prober installed.... well: voodoo (more serious: some bad documented behaviour).

Also consider that:
You can turn off the entries from 30-os-prober by adding a line to /etc/defaults/grub:

GRUB_DISABLE_OS_PROBER="true"
http://www.linuxplanet.com/linuxplanet/print/6991/
That seems like the most proper way.

If you ain't got os-prober installed i wouldn't have got much hope that it helps.

I for one would probably copy the grub.cfg and move it back in place in case i need to.
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.

StanTheMan
Posts: 114
Joined: 2009-03-04 18:02
Location: British Columbia

Re: Prevent grub-pc from linking to other OSs.

#7 Post by StanTheMan »

The boot list that appears comes from the file /boot/grub/grub.cfg . This file is not editable , but it is created when you run the command ' updae-grub ' This command goes to these files - - /etc/default/grub , and some files in /etc/grub.d . In the last folder there is a file ' 40_custom ' which is normally empty. But you can copy menuentry paragraphs from /boot/grub/grub.cfg .
Now you can remove the menuentry paragraphs that you don't need , from40_custom, and save this file.
Finally you remove the execue flag from the files 10_linux , 20_memtest86+ , 30_os-prober. Now you run ' uupdate-grub ' again. This time the files that you un-execed will not act, but the remaining file 40_custom will create a new grub.cfg and give you a new display bootlist. The wording in 40_custom for the names of the listed OS s can be re-spelled if you wish and saved. Always finish with an ' update-grub -.

milomak
Posts: 2085
Joined: 2009-06-09 22:20

Re: Prevent grub-pc from linking to other OSs.

#8 Post by milomak »

are you running a lenny version of grub2?

as a matter of interest what does apt-cache policy os-prober grub2 show?
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: Lenovo ideapad Y700-15ISK - Sid, Win10, Solus
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

confuseling
Posts: 2143
Joined: 2009-10-21 01:03

Re: Prevent grub-pc from linking to other OSs.

#9 Post by confuseling »

smallchange wrote:@confuseling
It is so easy to run

Code: Select all

dpkg -l | grep os-prober
and find that os-prober is a package that I fail to understand why you would write what you did.
Simple, really, I was fairly sure of it. I guess sometimes people on the interwebs are fairly sure of things which turn out not to be true. Whodathunkit?

:shock:
The Forum's search box is terrible. Use site specific search, e.g.
https://www.google.com/search?q=site%3A ... terms+here

User avatar
edbarx
Posts: 5410
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E

Re: Prevent grub-pc from linking to other OSs.

#10 Post by edbarx »

Thanks for all your replies.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

User avatar
edbarx
Posts: 5410
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E

Re: Prevent grub-pc from linking to other OSs.

#11 Post by edbarx »

This is how I prevented grub-pc from linking to other OSs:

I changed the file permissions of the unwanted scripts in /etc/grub.d. This is how they are now:

Code: Select all

edbarx@edbarx-pc2:~$ ls -l /etc/grub.d
total 56
-rwxr-xr-x 1 root root 6433 Aug  7 18:10 00_header
-rwxr-xr-x 1 root root 1474 Jul 16 18:46 05_debian_theme
-rwxr-xr-x 1 root root 4252 Aug  7 18:10 10_linux
-rwxr-xr-x 1 root root 4893 Aug  7 18:10 20_linux_xen
-rw-r--r-- 1 root root 5789 Aug  7 18:10 _30_os-prober
-rw-r--r-- 1 root root  475 Sep 12 09:37 _30_otheros
-rw-r--r-- 1 root root  214 Aug  7 18:10 40_custom
-rw-r--r-- 1 root root   95 Aug  7 18:10 41_custom
-rw-r--r-- 1 root root   97 Oct 26 10:07 old-permissions.readme
-rw-r--r-- 1 root root  483 Aug  7 18:10 README
The original permissions of 30_os-prober, 30_otheros, 40_custom and 41_custom were rwxr-xr-x. I changed them to rw-r--r--. The solution was indicated in README.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

User avatar
MeanDean
Posts: 3953
Joined: 2007-09-01 01:14

Re: [SOLVED] Prevent grub-pc from linking to other OSs.

#12 Post by MeanDean »

I wonder what will happen if the grub package is upgraded?

Post Reply