Hi, right now when running grub-probe and the disk cannot be opened the error message can be misleading, it always says "disk not found" but in some case the disk may exist but the user has no permissions to open it, see https://savannah.gnu.org/bugs/?42409
The message can be improved by propagating informations about the cause of the failure from the bottom layers. Please take a look at the patches in this series, I marked them RFC because I am new to grub code and I am not sure that all the error paths set a meaningful message, but I wanted some code to base the discussion on. Patch 1/2 aims to prevent overriding the error messages from the disk->open() methods called in grub_disk_open(). Patch 2/2 exposes to the user the —now more informative— message from grub_disk_open(). Before these changes I was getting this output when running grub-probe with insufficient permissions: $ LANG=C ./grub-probe / ./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. After the patches the reason of the failure is clearer: $ LANG=C ./grub-probe / ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so falling back to partition device /dev/sda1. ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so falling back to partition device /dev/sda1. ./grub-probe: warning: cannot open `/dev/sda': Permission denied, so falling back to partition device /dev/sda1. ./grub-probe: error: cannot open `/dev/sda1': Permission denied. As I said, this is the final effect I am aiming for but I am not 100% sure my solution is complete. Thanks, Antonio Antonio Ospite (2): * grub-core/kern/disk.c: don't override grub_errmsg when grub_disk_open fails * util/getroot.c: improve error message when a disk cannot be opened grub-core/kern/disk.c | 3 +-- util/getroot.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) -- Antonio Ospite http://ao2.it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel