diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-06-03 19:40:01 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-06-08 16:04:38 +0200 |
commit | 755021d43448011ef169f20ec3a08d4e92c824af (patch) | |
tree | 5f658617f0c170b971e5bde5fa0a8521fd8329e9 /src/core/unit.h | |
parent | cbd4a8df5fb3d69d77451fdb8d177e02e09460d5 (diff) | |
download | systemd-755021d43448011ef169f20ec3a08d4e92c824af.tar.gz |
core: do not serialize mounts and automounts for switch-root
When e.g. tmp.mount is present in the initrd, and we serialize it, switch root,
and deserialize, the new systemd is confused because it thinks /tmp is mounted.
In general, it doesn't make sense to serialize anything that refers to paths in
the old root file system.
This fixes two errors for me:
1. tmp.mount was not mounted properly before local-fs.target. It would be
mounted as some point (I guess when we re-read /proc/self/mountinfo for some
other reason). In effect systemd-tmpfiles-setup.service would see one fs, and
some other units started later a different one. In particular gdm.service would
fail because the pre-created /tmp/.X11-unix with proper permissions would not
exist at time it was started.
2. # systemd[1]: proc-sys-fs-binfmt_misc.automount: Got hangup/error on autofs pipe from kernel. Likely our automount point has been unmounted by someone or something else?
# systemd[1]: proc-sys-fs-binfmt_misc.automount: Failed with result 'unmounted'.
# systemd[1]: Mounting proc-sys-fs-binfmt_misc.mount...
# systemd[1]: Mounted proc-sys-fs-binfmt_misc.mount.
# systemd[1]: Starting systemd-binfmt.service...
# systemd[1]: Finished systemd-binfmt.service.
# systemd[1]: proc-sys-fs-binfmt_misc.automount: Path /proc/sys/fs/binfmt_misc is already a mount point, refusing start.
# systemd[1]: Failed to set up automount proc-sys-fs-binfmt_misc.automount.
# systemd[1]: proc-sys-fs-binfmt_misc.automount: Path /proc/sys/fs/binfmt_misc is already a mount point, refusing start.
# systemd[1]: Failed to set up automount proc-sys-fs-binfmt_misc.automount.
# systemd[1]: proc-sys-fs-binfmt_misc.automount: Path /proc/sys/fs/binfmt_misc is already a mount point, refusing start.
# systemd[1]: Failed to set up automount proc-sys-fs-binfmt_misc.automount.
# systemd[1]: Stopping systemd-binfmt.service...
# systemd[1]: systemd-binfmt.service: Deactivated successfully.
# systemd[1]: Stopped systemd-binfmt.service.
I couldn't understand the error here, but in retrospect the first line is entirely
correct: "someone or something else" was the old systemd unmounting the old root.
Diffstat (limited to 'src/core/unit.h')
-rw-r--r-- | src/core/unit.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/unit.h b/src/core/unit.h index dddb419613..8818392731 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -668,6 +668,9 @@ typedef struct UnitVTable { /* True if units of this type shall be startable only once and then never again */ bool once_only; + /* Do not serialize this unit when preparing for root switch */ + bool exclude_from_switch_root_serialization; + /* True if queued jobs of this type should be GC'ed if no other job needs them anymore */ bool gc_jobs; |