How to stop update-grub from scanning all drives?

In file /etc/grub.d/30_os-prober the line

OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"

makes all drives spin (standby -> idle). Os-prober is a utility to find Linux installations at drives other then your boot drive. It is the os-prober that needs to be disabled.

  1. One way is to remove the package: apt-get --purge remove os-prober.
  2. Another way is to remove executable rights for os-prober. First find the location of os-prober using $ which os-prober. Output might look like: /usr/bin/os-prober. The remove the executable rights for all users for that file: # chmod a-x /usr/bin/os-prober
  3. Another way is to remove executable rights for 30_os-prober. Find the location of 30_os-prober using $ locate /30_os-prober. Output might look like: /etc/grub.d/30_os-prober. The remove the executable rights for all users for that file: # chmod a-x /etc/grub.d/30_os-prober
  4. Yet another way is to skip the execution of /etc/grub.d/30_os-prober. For example by making the GRUB_DISABLE_OS_PROBER=true option work in our grub version 1.98. This can be done by inserting in file /etc/grub.d/30_os-prober the code below the line set -e:

...

if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
  exit 0
fi

For those wondering if it's really worth the effort, yes it is. Perhaps not for energy saving but today I encountered a problem with update-grub as it wanted to probe for both /dev/sda (my harddisk) and /dev/sdc (a USB-stick). Without the latter inserted into my laptop, update-grub would hang, even though there is actually no OS on my USB-stick installed nor did I ever boot from this stick. As the USB-stick recently broke, I needed a way for update-grub to continue (alive) without it. Fortuately, GRUB_DISABLE_OS_PROBER=true just did the trick. :)


(Is this really worth the time and effort to fix?)

As you mentioned, the probing is probably happening when grub-mkconfig calls grub-probe. You could modify grub-mkconfig by simply hardcoding the result of the grub-probe calls. It is used to fill GRUB_DEVICE, GRUB_DEVICE_UUID, GRUB_DEVICE_BOOT, GRUB_DEVICE_BOOT_UUID, and GRUB_FS.

Tags:

Debian

Grub