Merge pull request #24799 from poettering/initrd-ftw
use "initrd" rather than "initial RAM disk" or "initramfs" to refernce the concept
This commit is contained in:
+8
-7
@@ -281,13 +281,14 @@ static int device_coldplug(Unit *u) {
|
||||
* other units, or (b) generated when uevents are received.
|
||||
*
|
||||
* - On switch-root, the udev database may be cleared, except for devices with sticky bit, i.e.
|
||||
* OPTIONS="db_persist". Hence, almost no devices are enumerated in the step 2. However, in general,
|
||||
* we have several serialized devices. So, DEVICE_FOUND_UDEV bit in the deserialized_found must be
|
||||
* ignored, as udev rules in initramfs and the main system are often different. If the deserialized
|
||||
* state is DEVICE_PLUGGED, we need to downgrade it to DEVICE_TENTATIVE. Unlike the other starting
|
||||
* mode, MANAGER_IS_SWITCHING_ROOT() is true when device_coldplug() and device_catchup() are called.
|
||||
* Hence, let's conditionalize the operations by using the flag. After switch-root, systemd-udevd
|
||||
* will (re-)process all devices, and the Device.found and Device.state will be adjusted.
|
||||
* OPTIONS="db_persist". Hence, almost no devices are enumerated in the step 2. However, in
|
||||
* general, we have several serialized devices. So, DEVICE_FOUND_UDEV bit in the deserialized_found
|
||||
* must be ignored, as udev rules in initrd and the main system are often different. If the
|
||||
* deserialized state is DEVICE_PLUGGED, we need to downgrade it to DEVICE_TENTATIVE. Unlike the
|
||||
* other starting mode, MANAGER_IS_SWITCHING_ROOT() is true when device_coldplug() and
|
||||
* device_catchup() are called. Hence, let's conditionalize the operations by using the
|
||||
* flag. After switch-root, systemd-udevd will (re-)process all devices, and the Device.found and
|
||||
* Device.state will be adjusted.
|
||||
*
|
||||
* - On reload or reexecute, we can trust enumerated_found, deserialized_found, and deserialized_state.
|
||||
* Of course, deserialized parameters may be outdated, but the unit state can be adjusted later by
|
||||
|
||||
+3
-3
@@ -1660,7 +1660,7 @@ static void initialize_coredump(bool skip_setup) {
|
||||
|
||||
/* But at the same time, turn off the core_pattern logic by default, so that no coredumps are stored
|
||||
* until the systemd-coredump tool is enabled via sysctl. However it can be changed via the kernel
|
||||
* command line later so core dumps can still be generated during early startup and in initramfs. */
|
||||
* command line later so core dumps can still be generated during early startup and in initrd. */
|
||||
if (!skip_setup)
|
||||
disable_coredumps();
|
||||
#endif
|
||||
@@ -1858,7 +1858,7 @@ static int do_reexecute(
|
||||
args[i++] = argv[j];
|
||||
assert(i <= args_size);
|
||||
|
||||
/* Re-enable any blocked signals, especially important if we switch from initial ramdisk to init=... */
|
||||
/* Re-enable any blocked signals, especially important if we switch from initrd to init=... */
|
||||
(void) reset_all_signal_handlers();
|
||||
(void) reset_signal_mask();
|
||||
(void) rlimit_nofile_safe();
|
||||
@@ -2052,7 +2052,7 @@ static void log_execution_mode(bool *ret_first_boot) {
|
||||
|
||||
if (in_initrd()) {
|
||||
*ret_first_boot = false;
|
||||
log_info("Running in initial RAM disk.");
|
||||
log_info("Running in initrd.");
|
||||
} else {
|
||||
int r;
|
||||
_cleanup_free_ char *id_text = NULL;
|
||||
|
||||
@@ -114,7 +114,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
|
||||
|
||||
arg_dest = ASSERT_PTR(dest);
|
||||
|
||||
/* Don't even consider resuming outside of initramfs. */
|
||||
/* Don't even consider resuming outside of initrd. */
|
||||
if (!in_initrd()) {
|
||||
log_debug("Not running in an initrd, quitting.");
|
||||
return 0;
|
||||
|
||||
@@ -706,8 +706,8 @@ static void context_determine_hostname_source(Context *c) {
|
||||
|
||||
/* If the hostname was not set by us, try to figure out where it came from. If we set it to
|
||||
* the default hostname, the file will tell us. We compare the string because it is possible
|
||||
* that the hostname was set by an older version that had a different fallback, in the
|
||||
* initramfs or before we reexecuted. */
|
||||
* that the hostname was set by an older version that had a different fallback, in the initrd
|
||||
* or before we reexecuted. */
|
||||
|
||||
r = read_one_line_file("/run/systemd/default-hostname", &fallback);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
|
||||
@@ -897,10 +897,8 @@ int device_update_db(sd_device *device) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/*
|
||||
* set 'sticky' bit to indicate that we should not clean the
|
||||
* database when we transition from initramfs to the real root
|
||||
*/
|
||||
/* set 'sticky' bit to indicate that we should not clean the database when we transition from initrd
|
||||
* to the real root */
|
||||
if (fchmod(fileno(f), device->db_persist ? 01644 : 0644) < 0) {
|
||||
r = -errno;
|
||||
goto fail;
|
||||
|
||||
@@ -1270,10 +1270,9 @@ int setup_pivot_root(const char *directory, const char *pivot_root_new, const ch
|
||||
* This requires a temporary directory, pivot_tmp, which is
|
||||
* not a child of either.
|
||||
*
|
||||
* This is typically used for OSTree-style containers, where
|
||||
* the root partition contains several sysroots which could be
|
||||
* run. Normally, one would be chosen by the bootloader and
|
||||
* pivoted to / by initramfs.
|
||||
* This is typically used for OSTree-style containers, where the root partition contains several
|
||||
* sysroots which could be run. Normally, one would be chosen by the bootloader and pivoted to / by
|
||||
* initrd.
|
||||
*
|
||||
* For example, for an OSTree deployment, pivot_root_new
|
||||
* would be: /ostree/deploy/$os/deploy/$checksum. Note that this
|
||||
|
||||
@@ -330,11 +330,9 @@ TEST(environment_gathering) {
|
||||
assert_se(chmod(name2, 0755) == 0);
|
||||
assert_se(chmod(name3, 0755) == 0);
|
||||
|
||||
/* When booting in containers or without initramfs there might not be
|
||||
* any PATH in the environment and if there is no PATH /bin/sh built-in
|
||||
* PATH may leak and override systemd's DEFAULT_PATH which is not
|
||||
* good. Force our own PATH in environment, to prevent expansion of sh
|
||||
* built-in $PATH */
|
||||
/* When booting in containers or without initrd there might not be any PATH in the environment and if
|
||||
* there is no PATH /bin/sh built-in PATH may leak and override systemd's DEFAULT_PATH which is not
|
||||
* good. Force our own PATH in environment, to prevent expansion of sh built-in $PATH */
|
||||
old = getenv("PATH");
|
||||
r = setenv("PATH", "no-sh-built-in-path", 1);
|
||||
assert_se(r >= 0);
|
||||
|
||||
Reference in New Issue
Block a user