On Thu, Nov 22, 2018 at 8:57 PM Eberhard Stoll <[email protected]> wrote: > > It could be that they remain mounted within another mount namespace. You > > don't have any weird udev rules which call `mount`, do you? > > > > If you have a recent util-linux, run `sudo lsns -t mnt` to see live > > namespaces. For each non-kernel process ID in the list, run something > > like `findmnt -F /proc/$PID/mountinfo` (or `cat` the file). If you > > don't, then `grep mmcblk1 /proc/*/mountinfo` should do the job as well. > > Yes, i found a udev rule which should mount any usb drive which is > plugged in. This is also true for my emmc device: > > # Media automounting > SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" > SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" > SUBSYSTEM=="block", ACTION=="change", ENV{DISK_MEDIA_CHANGE}=="1" > RUN+="/etc/udev/scripts/mount.sh" > > And systemd-udevd is running in an own namespace: > root@t1000-multi:~# lsns -t mnt > NS TYPE NPROCS PID USER COMMAND > 4026531840 mnt 88 1 root /sbin/init > 4026531861 mnt 1 18 root kdevtmpfs > 4026532470 mnt 1 125 root > /lib/systemd/systemd-udevd > 4026532483 mnt 1 194 systemd-timesync > /lib/systemd/systemd-timesyncd > 4026532484 mnt 1 212 systemd-network > /lib/systemd/systemd-networkd > 4026532502 mnt 1 262 systemd-resolve > /lib/systemd/systemd-resolved > > I wonder what is the preferred way to automount removable media > especially in embedded devices? > > Is using 'MountFlags=shared' for systemd-udevd a common solution? > should i prefer systemd automounting? > With systemd automount i have to declare all devices statically. This > could be a disadvantage. >
You can use the `systemd-mount` tool if your version comes with it. That will create a transient .mount unit in systemd via IPC, so it will be unaffected by namespacing. Otherwise, no need to bother with MountFlags=, just remove the existing PrivateMounts=yes option which isolates udev to begin with. -- Mantas Mikulėnas
_______________________________________________ systemd-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/systemd-devel
