Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

update-grub: how to avoid scanning all devices

807 views
Skip to first unread message

Steve Keller

unread,
Dec 15, 2017, 7:40:06 AM12/15/17
to
When calling update-grub, it scans all devices for operating systems
to put into the GRUB config. It even mounts all block devices to do
the scan. I'd like to avoid this and let it scan only a number of
configured directories, in my case only /boot. Scanning all devices
is annoying because

* all disks that are normally idle and that have spun down (e.g. my
backup drives) have to spin up. This wears off my disks
unnecessarily and also causes long delays.

* update-grub finds a number of operating systems that I don't want in
the GRUB config, e.g. on logical volumes for virtual machines,
backup images of old machines, etc.

I haven't found anything on this topic in the documentation.

Steve

Brian

unread,
Dec 15, 2017, 7:50:04 AM12/15/17
to
Purge os-prober.

--
Brian.

Pascal Hambourg

unread,
Dec 15, 2017, 7:50:04 AM12/15/17
to
Le 15/12/2017 à 13:18, Steve Keller a écrit :
> When calling update-grub, it scans all devices for operating systems
> to put into the GRUB config. It even mounts all block devices to do
> the scan. I'd like to avoid this and let it scan only a number of
> configured directories, in my case only /boot.

This is due to os-prober invoked by update-grub. To avoid it, you can either
- remove the os-prober package
- or add GRUB_DISABLE_OS_PROBER=true in /etc/default/grub.

Richard Owlett

unread,
Dec 15, 2017, 8:50:05 AM12/15/17
to
I have 2 similar problems which wouldn't be solved by disabling os-prober.

The common characteristic is wishing to probe all operating systems
residing on on a specific physical device. I multi-boot. There may be an
OS on any number of mounted devices (flash drives etc) which I do not
wish to probe.

I also install Debian to a USB flash drive (intended to be multi-boot)
for an unrelated machine. When I install the grub adds all OS from the
"host" machine. This may be more an installer issue than a pure grub
issue. Manually editing grub.cfg "solves" the initial problem. And yes,
I know why that's not a recommended practice ;)

Pascal Hambourg

unread,
Dec 15, 2017, 10:40:04 AM12/15/17
to
Le 15/12/2017 à 14:42, Richard Owlett a écrit :
>
> I have 2 similar problems which wouldn't be solved by disabling os-prober.
>
> The common characteristic is wishing to probe all operating systems
> residing on on a specific physical device. I multi-boot. There may be an
> OS on any number of mounted devices (flash drives etc) which I do not
> wish to probe.

I do not know any way to tell os-prober to limit the set of probed
devices. I guess you could edit /etc/grub.d/30_os-prober to filter out
unwanted devices from os-prober output with grep or so.

> I also install Debian to a USB flash drive (intended to be multi-boot)
> for an unrelated machine. When I install the grub adds all OS from the
> "host" machine.
By default, os-prober is installed and used by GRUB. So, after the
installation you must boot the new system, disable os-prober or filter
out its output as above and re-run update-grub.

Brian

unread,
Dec 15, 2017, 11:50:05 AM12/15/17
to
On Fri 15 Dec 2017 at 16:31:54 +0100, Pascal Hambourg wrote:

> Le 15/12/2017 à 14:42, Richard Owlett a écrit :
> >
> > I have 2 similar problems which wouldn't be solved by disabling os-prober.
> >
> > The common characteristic is wishing to probe all operating systems
> > residing on on a specific physical device. I multi-boot. There may be an
> > OS on any number of mounted devices (flash drives etc) which I do not
> > wish to probe.
>
> I do not know any way to tell os-prober to limit the set of probed devices.
> I guess you could edit /etc/grub.d/30_os-prober to filter out unwanted
> devices from os-prober output with grep or so.

GRUB_OS_PROBER_SKIP_LIST? It's mentioned in /etc/grub.d/30_os-prober
and /usr/sbin/grub-mkconfig.

--
Brian.

Pascal Hambourg

unread,
Dec 15, 2017, 12:00:06 PM12/15/17
to
Yes, it is described in
<https://www.gnu.org/software/grub/manual/grub/grub.html>.

‘GRUB_OS_PROBER_SKIP_LIST’

List of space-separated FS UUIDs of filesystems to be ignored from
os-prober output. For efi chainloaders it’s <UUID>@<EFI FILE>

But it allows to exclude only known filesystems.

Brian

unread,
Dec 15, 2017, 12:20:06 PM12/15/17
to
Known filesystems include ext4?

--
Brian.

Pascal Hambourg

unread,
Dec 15, 2017, 2:40:05 PM12/15/17
to
Filesystem instances, not filesystem types.
You can skip filesystems if you know their UUIDs. But e.g. an unreported
filesystem on a removable device won't be skipped.

Brian

unread,
Dec 15, 2017, 5:50:04 PM12/15/17
to
No removable device devices here. A machine with four ext4 partitions;
nothing extraordinary.

root@stretch:~# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.9.0-4-686-pae
Found initrd image: /boot/initrd.img-4.9.0-4-686-pae
Found Debian GNU/Linux 8 (jessie) on /dev/sda1
Found Debian GNU/Linux buster/sid on /dev/sdb5
Found Debian GNU/Linux buster/sid on /dev/sdb6
done

What should I expect with

GRUB_OS_PROBER_SKIP_LIST="UUID_of_sdb6"

in /etc/default/grub?

--
Brian.

Steve Keller

unread,
Jan 3, 2018, 12:10:06 PM1/3/18
to
On 15 Dec 2017 at 13:42, Brian <ad...@cityscape.co.uk> wrote:

> Purge os-prober.

Thanks, that's exactly what I was looking for.

Steve
0 new messages