Bug#798083: systemd: Systemd assumes that ESP is mounted in /boot
Goffredo Baroncelli
kreijack at gmail.com
Sat Sep 5 11:55:11 BST 2015
Package: systemd
Version: 225-1
Severity: normal
Tags: patch
systemd assumes that the ESP partition is mounted on /boot. Instead debian
seems to suggest to mount it on /boot/efi/.
(systemd) bootctl relies on this assumption. The user could override this
default via the --path switch, but this is annoing.
The patch below adds a check: if the /boot/efi/EFI directory exists, bootctl
assumes that the ESP is mounted on /boot/efi, otherwise /boot.
Anyway the user can still override the default using the --path switch.
I proposed the patch upstream [1] but it was rejected becuase the systemd
developers want to support only mounting ESP on /boot.
BR
G.Baroncelli
[1] https://github.com/systemd/systemd/pull/1124
diff --git a/man/bootctl.xml b/man/bootctl.xml
index 63ad939..0a96aae 100644
--- a/man/bootctl.xml
+++ b/man/bootctl.xml
@@ -102,7 +102,7 @@
<xi:include href="standard-options.xml" xpointer="version" />
<varlistentry>
<term><option>--path</option></term>
- <listitem><para>Path to the EFI system partition. The default is /boot.</para></listitem>
+ <listitem><para>Path to the EFI system partition. By default bootctl uses /boot/efi (if ESP is mounted here) or /boot.</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index ac1711b..319994e 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -936,7 +936,7 @@ static int help(void) {
return 0;
}
-static const char *arg_path = "/boot";
+static const char *arg_path = NULL;
static bool arg_touch_variables = true;
static int parse_argv(int argc, char *argv[]) {
@@ -996,6 +996,18 @@ static void read_loader_efi_var(const char *name, char **var) {
log_warning_errno(r, "Failed to read EFI variable %s: %m", name);
}
+static void init_arg_path(void) {
+ struct stat st;
+
+ if (stat("/boot/efi/EFI", &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR) {
+ /* Suse, debian, ubuntu, gentoo, fedora */
+ arg_path = "/boot/efi";
+ } else {
+ /* arch */
+ arg_path = "/boot";
+ }
+}
+
static int bootctl_main(int argc, char*argv[]) {
enum action {
ACTION_STATUS,
@@ -1036,6 +1048,9 @@ static int bootctl_main(int argc, char*argv[]) {
if (geteuid() != 0)
return log_error_errno(EPERM, "Need to be root.");
+ if (arg_path == NULL)
+ init_arg_path();
+
r = verify_esp(arg_path, &part, &pstart, &psize, &uuid);
if (r == -ENODEV && !arg_path)
log_notice("You might want to use --path= to indicate the path to your ESP, in case it is not mounted on /boot.");
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.2.0 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages systemd depends on:
ii adduser 3.113+nmu3
ii libacl1 2.2.52-2
ii libapparmor1 2.9.2-3
ii libaudit1 1:2.4.4-1
ii libblkid1 2.26.2-9
ii libc6 2.19-19
ii libcap2 1:2.24-11
ii libcap2-bin 1:2.24-11
ii libcryptsetup4 2:1.6.6-5
ii libgcrypt20 1.6.3-2
ii libkmod2 21-1
ii liblzma5 5.1.1alpha+20120614-2.1
ii libmount1 2.26.2-9
ii libpam0g 1.1.8-3.1
ii libseccomp2 2.2.3-2
ii libselinux1 2.3-2+b1
ii libsystemd0 225-1
ii mount 2.26.2-9
ii sysv-rc 2.88dsf-59.2
ii udev 225-1
ii util-linux 2.26.2-9
Versions of packages systemd recommends:
ii dbus 1.8.20-1
ii libpam-systemd 225-1
Versions of packages systemd suggests:
ii systemd-container 225-1
pn systemd-ui <none>
-- Configuration Files:
/etc/systemd/journald.conf changed [not included]
-- no debconf information
More information about the Pkg-systemd-maintainers
mailing list