diff options
author | Ed Maste <emaste@FreeBSD.org> | 2023-10-15 17:21:52 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2024-01-11 01:23:56 +0000 |
commit | 01641167c9660e98122c3f6174878d534a83b57e (patch) | |
tree | 98ef8774f3d9b00f54a14fdf4aee568a26958154 | |
parent | a4925f0f8cf76c32140d7c2077aa9628de20630f (diff) | |
download | src-01641167c9660e98122c3f6174878d534a83b57e.tar.gz src-01641167c9660e98122c3f6174878d534a83b57e.zip |
efibootmgr: provide explicit error message if run as non-root
This should be less confusing for new users.
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42213
(cherry picked from commit c08ba4a588d517e3c5fe00cee0927294d2490993)
-rw-r--r-- | usr.sbin/efibootmgr/efibootmgr.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c index b0d023e3539c..8dcf9876486d 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -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(); |