git: 0b0e479d052e - stable/13 - efibootmgr: provide explicit error message if run as non-root
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Jan 2024 01:28:36 UTC
The branch stable/13 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=0b0e479d052e4018a90b1ca98f7bcffb8ffd817d
commit 0b0e479d052e4018a90b1ca98f7bcffb8ffd817d
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-10-15 17:21:52 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-01-11 01:28:27 +0000
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)
(cherry picked from commit 01641167c9660e98122c3f6174878d534a83b57e)
---
usr.sbin/efibootmgr/efibootmgr.c | 7 +++++--
1 file 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();