Skip to content

Commit

Permalink
efibootmgr: provide explicit error message if run as non-root
Browse files Browse the repository at this point in the history
This should be less confusing for new users.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42213
  • Loading branch information
emaste committed Oct 15, 2023
1 parent 6ace923 commit c08ba4a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions usr.sbin/efibootmgr/efibootmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,11 @@ main(int argc, char *argv[])
/*
* find_dev can operate without any efi variables
*/
if (!efi_variables_supported() && !opts.find_dev)
errx(1, "efi variables not supported on this system. root? kldload efirt?");
if (!efi_variables_supported() && !opts.find_dev) {
if (errno == EACCES && geteuid() != 0)
errx(1, "must be run as root");
errx(1, "efi variables not supported on this system. kldload efirt?");
}

read_vars();

Expand Down

0 comments on commit c08ba4a

Please sign in to comment.