by default when combined with --scope, will be changed in a future
release to be enabled by default.
+ * "systemctl switch-root" is now restricted to initrd transtions only.
+ Transitions between real systems should be done with "systemctl soft-reboot"
+ instead.
+
Device Management:
* udev will now create symlinks to loopback block devices in the
idea, and specifically works around the fact the autofs ignores busy by mount
namespaces)
-* refuse using the switch-root operation without /etc/initrd-release. Now
- that we have a concept of userspace reboot, we can clearly say: switch-root
- is for transitioning from initrd to host (or initrd to next initrd), while
- userspace reboot is for switching host to next version of the host.
-
* mount most file systems with a restrictive uidmap. e.g. mount /usr/ with a
uidmap that blocks out anything outside 0…1000 (i.e. system users) and similar.
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
+#include "initrd-util.h"
#include "install.h"
#include "log.h"
#include "manager-dump.h"
}
/* Safety check */
- if (isempty(init)) {
- r = path_is_os_tree(root);
- if (r < 0)
- return sd_bus_error_set_errnof(error, r,
- "Failed to determine whether root path '%s' contains an OS tree: %m",
- root);
- if (r == 0)
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
- "Specified switch root path '%s' does not seem to be an OS tree. os-release file is missing.",
- root);
- } else {
+ if (!in_initrd())
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
+ "Not in initrd, refusing switch-root operation.");
+
+ r = path_is_os_tree(root);
+ if (r < 0)
+ return sd_bus_error_set_errnof(error, r,
+ "Failed to determine whether root path '%s' contains an OS tree: %m",
+ root);
+ if (r == 0)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
+ "Specified switch root path '%s' does not seem to be an OS tree. os-release file is missing.",
+ root);
+
+ if (!isempty(init)) {
if (!path_is_valid(init))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
"Path to init binary '%s' is not a valid path.", init);