On Tue, 28 Jul 2020 at 11:11, Lennart Poettering <mzerqung@0pointer.de> wrote:
[..]
> Why is it still automonter hardcoded into the kernel even if it is
> completely useless on a typical single workstation?

binfmt_misc is mounted with that by default.

And systemd will mount the ESP and the boot loader partition with the
automounter by default, so that it's only mounted on access and
quickly unmounted again afterwards, to ensure it stays in a clean
state whenever possible. (This logic is turned off if these mounts are
explicitly listed in fstab tough, unfortunately fedora does that).

So .. someone knows why it cannot be mounted on "mount -a" when entry for binfmt_misc would be in fstab or even over .mount unit?

$ rpm -ql systemd | grep proc-sys; echo; systemctl status proc-sys-fs-binfmt_misc.mount proc-sys-fs-binfmt_misc.mount/usr/lib/systemd/system/proc-sys-fs-binfmt_misc.automount
/usr/lib/systemd/system/proc-sys-fs-binfmt_misc.mount
/usr/lib/systemd/system/sysinit.target.wants/proc-sys-fs-binfmt_misc.automount

● proc-sys-fs-binfmt_misc.mount - Arbitrary Executable File Formats File System
     Loaded: loaded (/proc/self/mountinfo; disabled; vendor preset: disabled)
     Active: active (mounted) since Thu 2020-07-23 18:36:17 BST; 4 days ago
TriggeredBy: ● proc-sys-fs-binfmt_misc.automount
      Where: /proc/sys/fs/binfmt_misc
       What: binfmt_misc
       Docs: https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
             https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
      Tasks: 0 (limit: 154244)
     Memory: 188.0K
        CPU: 12ms
     CGroup: /system.slice/proc-sys-fs-binfmt_misc.mount

● proc-sys-fs-binfmt_misc.mount - Arbitrary Executable File Formats File System
     Loaded: loaded (/proc/self/mountinfo; disabled; vendor preset: disabled)
     Active: active (mounted) since Thu 2020-07-23 18:36:17 BST; 4 days ago
TriggeredBy: ● proc-sys-fs-binfmt_misc.automount
      Where: /proc/sys/fs/binfmt_misc
       What: binfmt_misc
       Docs: https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
             https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
      Tasks: 0 (limit: 154244)
     Memory: 188.0K
        CPU: 12ms
     CGroup: /system.slice/proc-sys-fs-binfmt_misc.mount

Probably .. because as you see there are two units for binfmt_misc.
One is just a static/regular .mount unit and the second one which is using autofs.
IMO using automounter to mount sysfs, procfs and binfmt_misc is really OVERKILL.
If the regular unit works flawlessly it looks like systemd could be compiled without autofs.

For example mqueue is mounted over .mount unit

$  cat /usr/lib/systemd/system/dev-mqueue.mount | grep -v \#
[Unit]
Description=POSIX Message Queue File System
Documentation=man:mq_overview(7)
Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
DefaultDependencies=no
Before=sysinit.target
ConditionPathExists=/proc/sys/fs/mqueue
ConditionCapability=CAP_SYS_ADMIN

[Mount]
What=mqueue
Where=/dev/mqueue
Type=mqueue
Options=nosuid,nodev,noexec

Looks like all other pseudo filesystems are mounted over .mount units with probably one exception ..  binfmt_misc.
Probably .. because as I've pointed there are two units for that fs.

$ rpm -ql systemd | grep \\.mount$
/usr/lib/systemd/system/dev-hugepages.mount
/usr/lib/systemd/system/dev-mqueue.mount
/usr/lib/systemd/system/local-fs.target.wants/tmp.mount
/usr/lib/systemd/system/proc-sys-fs-binfmt_misc.mount
/usr/lib/systemd/system/sys-fs-fuse-connections.mount
/usr/lib/systemd/system/sys-kernel-config.mount
/usr/lib/systemd/system/sys-kernel-debug.mount
/usr/lib/systemd/system/sys-kernel-tracing.mount
/usr/lib/systemd/system/sysinit.target.wants/dev-hugepages.mount
/usr/lib/systemd/system/sysinit.target.wants/dev-mqueue.mount
/usr/lib/systemd/system/sysinit.target.wants/sys-fs-fuse-connections.mount
/usr/lib/systemd/system/sysinit.target.wants/sys-kernel-config.mount
/usr/lib/systemd/system/sysinit.target.wants/sys-kernel-debug.mount
/usr/lib/systemd/system/sysinit.target.wants/sys-kernel-tracing.mount
/usr/lib/systemd/system/tmp.mount

kloczek
-- 
Tomasz Kłoczko |  LinkedIn: http://lnkd.in/FXPWxH