bugGNU GRUB - Bugs: bug #42409, grub-probe produces misleading...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #42409: grub-probe produces misleading errors and wrong info if user doesn't have permission to access drive

Submitter:  Alain Kalker <ackalker>
Submitted:  Fri 23 May 2014 03:08:13 PM UTC
   
 
Category:  Disk & Partition Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release:  other
Release:  Reproducibility:  Every Time
Planned Release:  2.03+

Tue 23 Aug 2016 10:34:50 AM UTC, comment #3: 
Antonio Ospite <ao2>
Wed 10 Aug 2016 04:41:55 PM UTC, comment #2: 

Sure, if you have patch by all means do it. Please send it to grub-devel, and reference bug number in commit message.

Andrei Borzenkov <arvidjaar>
Group Member
Wed 10 Aug 2016 01:39:18 PM UTC, comment #1: 

Hi,

I agree with Alain that the error message should be improved.

I ran into this issue when using systemd-nspawn which by default restricts access to the devices in the container, here is an example:


$ sudo systemd-nspawn -q --directory "/media/ao2/USB_rootfs" --bind /dev grub-probe /
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sdf2.
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sdf2.
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sdf2.
grub-probe: error: disk `hostdisk//dev/sdf2' not found.
/


the message says that the disk does not exist but it does, and in my case the error is that it cannot be opened:


open("/dev/sdf", O_RDONLY)              = -1 EPERM (Operation not permitted)


So if grub would just tell "Operation not permitted" it would be easier for the user to understand what is going on.

Should we send a patch?

Thanks,
   Antonio

Antonio Ospite <ao2>
Fri 23 May 2014 03:08:13 PM UTC, original submission:  

System details:
OS: Arch Linux x86_64
Grub: 2.02.beta2 installed on a GPT disk with protective MBR
Boot: using BIOS
GPT partition /dev//boot:

Using grub-probe on this setup works fine when running it with sudo:

$ sudo grub-probe --target=partmap /
gpt
$ sudo grub-probe --target=drive /
(hostdisk//dev/sda,gpt1)

However, running grub-probe as a user without read access to /dev/sda*, produces misleading errors, and ultimately gives incorrect information:

$ grub-probe --target=partmap /
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-probe: error: disk `hostdisk//dev/sda1' not found.
$ grub-probe --target=drive /
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-probe: warning: disk does not exist, so falling back to partition device /dev/sda1.
(hostdisk//dev/sda1)

Running the above commands under strace (filtering on open, stat, execve events, see attached files) shows that grub-probe running as unprivileged user encounters permission errors (EACCES) but doesn't report these to the user.

The errors which grub-probe does report are misleading: the disk does exist, but the current user simply has no permission to access it.
Also the final info is incorrect, as it doesn't identify the partition as being a GPT partition.

Both these issues can lead users trying to diagnose problems to look in the wrong place, or worse, apply the wrong fixes.
Note that in some environments such as SELinux, even running grub-probe under sudo, one might not have permission to access some devices!

From reading several reports on the net about grub-probe reporting "warning: disk does not exist", I think that grub-probe not reporting permssion problems may lie at the heart of at least some of these reports.

Please consider fixing grub-probe to report permission errors directly to the user.

Alain Kalker <ackalker>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arvidjaar (Posted a comment)
  • -email is unavailable- added by ao2 (Posted a comment)
  • -email is unavailable- added by phcoder (Updated the item)
  • -email is unavailable- added by ackalker (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-03-05 phcoder Planned Release2.02 2.03+
    2016-03-02 phcoder Planned ReleaseNone 2.02
    2014-05-23 ackalker Attached File- Added strace-grub-probe-target-partmap-verbose.log, #31424
        Attached File- Added strace-grub-probe-target-drive-verbose.log, #31425

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code