* [PATCH 0/3] udev-extraconf: Fix the automount malfunction when the systemd is used
@ 2018-10-22 11:58 Kevin Hao
2018-10-22 11:58 ` [PATCH 1/3] udev-extraconf: Use the canonical file name of systemd Kevin Hao
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kevin Hao @ 2018-10-22 11:58 UTC (permalink / raw)
To: openembedded-core
When we use the systemd as the init manager, the automount function
doesn't work at all. This patch series fixes this issue. The patch 2&3
have been posted by Hongzhi one month ago [1], but they aren't merged
yet. I have rebased them on the latest oe-core and also fix the author
info since it is me to scratch these patches originally. :-)
Kevin Hao (3):
udev-extraconf: Use the canonical file name of systemd
udev-extraconf: Fix the recursively dependency for the systemd-mount
udev-extraconf: Skip the entry in /etc/fstab when using the
systemd-mount
meta/recipes-core/udev/udev-extraconf/mount.sh | 36 +++++++++++++++++---------
1 file changed, 24 insertions(+), 12 deletions(-)
[1] http://lists.openembedded.org/pipermail/openembedded-core/2018-September/155724.html
Thanks,
Kevin
--
2.14.4
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/3] udev-extraconf: Use the canonical file name of systemd
2018-10-22 11:58 [PATCH 0/3] udev-extraconf: Fix the automount malfunction when the systemd is used Kevin Hao
@ 2018-10-22 11:58 ` Kevin Hao
2018-10-22 11:58 ` [PATCH 2/3] udev-extraconf: Fix the recursively dependency for the systemd-mount Kevin Hao
2018-10-22 11:58 ` [PATCH 3/3] udev-extraconf: Skip the entry in /etc/fstab when using " Kevin Hao
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Hao @ 2018-10-22 11:58 UTC (permalink / raw)
To: openembedded-core
The new version of systemd has changed the symbolic link between
/sbin/init and /lib/systemd/systemd to relative. So the output of
the command 'readlink /sbin/init' become:
../lib/systemd/systemd
Then it causes the following check of "/lib/systemd/systemd" to return
false. Fix this issue by using the canonical file name of the systemd.
Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 067d4e2a16fb..34ef98a6a882 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,7 +4,7 @@
#
# Attempt to mount any added block devices and umount any removed devices
-BASE_INIT="`readlink "@base_sbindir@/init"`"
+BASE_INIT="`readlink -f "@base_sbindir@/init"`"
INIT_SYSTEMD="@systemd_unitdir@/systemd"
if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
--
2.14.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] udev-extraconf: Fix the recursively dependency for the systemd-mount
2018-10-22 11:58 [PATCH 0/3] udev-extraconf: Fix the automount malfunction when the systemd is used Kevin Hao
2018-10-22 11:58 ` [PATCH 1/3] udev-extraconf: Use the canonical file name of systemd Kevin Hao
@ 2018-10-22 11:58 ` Kevin Hao
2018-10-22 11:58 ` [PATCH 3/3] udev-extraconf: Skip the entry in /etc/fstab when using " Kevin Hao
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Hao @ 2018-10-22 11:58 UTC (permalink / raw)
To: openembedded-core
The commit 4ca9402c3720 ("udev-extraconf: Add systemd-mount to
udev-extraconf/mount.sh") uses the systemd-mount to mount the new added
disk partitions if systemd is used. But it forgot to move the codes
which tries to mount the partition by using the configuration in
/etc/fstab to the non-systemd function. And it will cause the
systemd-mount try to mount the partition synchronously and trigger a
recursively dependency like the following:
dev-sda1.device -> run-media-sda1.mount -> dev-sda1.device
Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
---
| 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
--git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 34ef98a6a882..afb368dd6737 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -66,6 +66,16 @@ automount_systemd() {
automount() {
name="`basename "$DEVNAME"`"
+ if [ -x "$PMOUNT" ]; then
+ $PMOUNT $DEVNAME 2> /dev/null
+ elif [ -x $MOUNT ]; then
+ $MOUNT $DEVNAME 2> /dev/null
+ fi
+
+ # If the device isn't mounted at this point, it isn't
+ # configured in fstab
+ grep -q "^$DEVNAME " /proc/mounts && return
+
! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
# Silent util-linux's version of mounting auto
if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
@@ -109,20 +119,13 @@ name="`basename "$DEVNAME"`"
[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then
- if [ -x "$PMOUNT" ]; then
- $PMOUNT $DEVNAME 2> /dev/null
- elif [ -x $MOUNT ]; then
- $MOUNT $DEVNAME 2> /dev/null
- fi
-
- # If the device isn't mounted at this point, it isn't
- # configured in fstab (note the root filesystem can show up as
- # /dev/root in /proc/mounts, so check the device number too)
+ # Note the root filesystem can show up as /dev/root in /proc/mounts,
+ # so check the device number too
if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
if [ "`basename $MOUNT`" = "systemd-mount" ];then
- grep -q "^$DEVNAME " /proc/mounts || automount_systemd
+ automount_systemd
else
- grep -q "^$DEVNAME " /proc/mounts || automount
+ automount
fi
fi
fi
--
2.14.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] udev-extraconf: Skip the entry in /etc/fstab when using the systemd-mount
2018-10-22 11:58 [PATCH 0/3] udev-extraconf: Fix the automount malfunction when the systemd is used Kevin Hao
2018-10-22 11:58 ` [PATCH 1/3] udev-extraconf: Use the canonical file name of systemd Kevin Hao
2018-10-22 11:58 ` [PATCH 2/3] udev-extraconf: Fix the recursively dependency for the systemd-mount Kevin Hao
@ 2018-10-22 11:58 ` Kevin Hao
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Hao @ 2018-10-22 11:58 UTC (permalink / raw)
To: openembedded-core
When using systemd, the systemd-fstab-generator would parse the
/etc/fstab and create the corresponding unit dynamically. So we don't
need to handle the ADD action for the partitions in /etc/fstab.
Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
---
| 9 +++++++++
1 file changed, 9 insertions(+)
--git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index afb368dd6737..3ee67b13183a 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -38,6 +38,15 @@ done
automount_systemd() {
name="`basename "$DEVNAME"`"
+ # Skip the partition which are already in /etc/fstab
+ grep "^[[:space:]]*$DEVNAME" /etc/fstab && return
+ for n in LABEL PARTLABEL UUID PARTUUID; do
+ tmp="$(lsblk -o $n $DEVNAME | sed -e '1d')"
+ test -z "$tmp" && continue
+ tmp="$n=$tmp"
+ grep "^[[:space:]]*$tmp" /etc/fstab && return
+ done
+
[ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
MOUNT="$MOUNT -o silent"
--
2.14.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-22 12:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-22 11:58 [PATCH 0/3] udev-extraconf: Fix the automount malfunction when the systemd is used Kevin Hao
2018-10-22 11:58 ` [PATCH 1/3] udev-extraconf: Use the canonical file name of systemd Kevin Hao
2018-10-22 11:58 ` [PATCH 2/3] udev-extraconf: Fix the recursively dependency for the systemd-mount Kevin Hao
2018-10-22 11:58 ` [PATCH 3/3] udev-extraconf: Skip the entry in /etc/fstab when using " Kevin Hao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox