From patchwork Sun Jul 17 12:56:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 459A1CCA47B for ; Sun, 17 Jul 2022 12:57:15 +0000 (UTC) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mx.groups.io with SMTP id smtpd.web08.15572.1658062626091943937 for ; Sun, 17 Jul 2022 05:57:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QGZ+lqEq; spf=pass (domain: gmail.com, ip: 209.85.167.50, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f50.google.com with SMTP id z25so15220295lfr.2 for ; Sun, 17 Jul 2022 05:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fazLW+vUsBaZ+k8iTO38IqHw1z5/fDopIJ15qR++uaU=; b=QGZ+lqEqk5JSp24ggaU3i4Gz1C7zXFDnLmWNTs7j2bRY93fjGUwLThbNDwRf0PvPqB y5TjYwEa11YH5XUK9ZzXSMrH/0UJkxlYbYZM+cvBjXy4ZTaSjhz0v1OBpLdJP/haKRtA bunSM/4nOHigYV9ECl832ps15PSZdvs40sG+MVhhjpcCJjvlBLkNapG5H834+O5TDj3Q OBbGJA3OXO2KRJMivsOiFAV9BPgvOX9HTHE9nExQnuOoz8tITv/rXZ4aHveH5OdxejDd LJbmBhgl8FmKq21PaL2+Cxi5M+xxcLw/pA1xYbjS/Z4e4eR1HAzTkZy7Tp6MBlohK//P jXbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fazLW+vUsBaZ+k8iTO38IqHw1z5/fDopIJ15qR++uaU=; b=RPncMnO6KAWQlBGUuEOvHjk2a6/ZvH73HGWHXkeCv1slHPJ1FabtSSU6EpyeNQIDYt jrws55e/WzkK7jXeEff9auGmN08dF5+n86qfRo/xyZNirsS4eahA75Ws8qFTFl33xCwC LHvTKEp+xHLgua1mJ+iKKQfxGbfdFH5DVq+mR51FOSiqz8MinL7xG38QlcLrImEDDOP2 JNLzO7xBuy7e44w5Kg0tbzChQSCaVbFqiuG2GbyOGcYDwmOwwXjB0N7lvd8CehUdUXVX 2DBfhVs2h8FfjzLf4eLIxsPEWcmRNqnLPqBWB5PgrSoIZg1rpI4qN3PmjZbNxLeZ3xJq cA3A== X-Gm-Message-State: AJIora/iGj+xQU8ulHlwtELervACcP4BPbzeaDACvZIpM5wrPMb0ZsGX HHjTpp4QlExzZDCJhZLI3ICn7YK0iIU= X-Google-Smtp-Source: AGRyM1sJCbgi6VR/0YT4nqsgrZGp4RFRDrMmZgekGBX/KSSkAQldb0I8lXxg79oA7w7xDhG2UWVw6Q== X-Received: by 2002:a05:6512:3d8d:b0:489:de37:74c0 with SMTP id k13-20020a0565123d8d00b00489de3774c0mr12233906lfv.527.1658062623865; Sun, 17 Jul 2022 05:57:03 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:03 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Richard Purdie , Luca Ceresoli , Ming Liu Subject: [OE-core] [kirkstone] [PATCH 1/9] udev-extraconf/initrdscripts/parted: Rename mount.blacklist -> mount.ignorelist Date: Sun, 17 Jul 2022 14:56:40 +0200 Message-Id: <20220717125648.2942046-2-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:15 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168149 From: Richard Purdie Signed-off-by: Richard Purdie Signed-off-by: Luca Ceresoli Signed-off-by: Richard Purdie (cherry picked from commit 69e486ddb3059f80ba538e1f59c2ca8a8df0faf9) Signed-off-by: Ming Liu --- .../initrdscripts/files/init-install-efi-testfs.sh | 2 +- .../initrdscripts/files/init-install-efi.sh | 2 +- .../initrdscripts/files/init-install-testfs.sh | 2 +- meta/recipes-core/initrdscripts/files/init-install.sh | 2 +- .../{mount.blacklist => mount.ignorelist} | 0 meta/recipes-core/udev/udev-extraconf/mount.sh | 4 ++-- meta/recipes-core/udev/udev-extraconf_1.1.bb | 10 +++++----- meta/recipes-extended/parted/files/run-ptest | 6 +++--- 8 files changed, 14 insertions(+), 14 deletions(-) rename meta/recipes-core/udev/udev-extraconf/{mount.blacklist => mount.ignorelist} (100%) diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh index 1fcd29e54c..4bd6ace7b3 100644 --- a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh +++ b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh @@ -138,7 +138,7 @@ touch /ssd/etc/controllerimage if [ -d /ssd/etc/ ] ; then # We dont want udev to mount our root device while we're booting... if [ -d /ssd/etc/udev/ ] ; then - echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist + echo "/dev/${device}" >> /ssd/etc/udev/mount.ignorelist fi fi diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh index f667518b89..ffd3870199 100644 --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh @@ -229,7 +229,7 @@ if [ -d /tgt_root/etc/ ] ; then echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab # We dont want udev to mount our root device while we're booting... if [ -d /tgt_root/etc/udev/ ] ; then - echo "${device}" >> /tgt_root/etc/udev/mount.blacklist + echo "${device}" >> /tgt_root/etc/udev/mount.ignorelist fi fi diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh index 7b49001659..8ab74ddc5d 100644 --- a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh +++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh @@ -164,7 +164,7 @@ if [ -d /tgt_root/etc/ ] ; then echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab # We dont want udev to mount our root device while we're booting... if [ -d /tgt_root/etc/udev/ ] ; then - echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist + echo "/dev/${device}" >> /tgt_root/etc/udev/mount.ignorelist fi fi umount /tgt_root diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh index e71579631b..df33791ec7 100644 --- a/meta/recipes-core/initrdscripts/files/init-install.sh +++ b/meta/recipes-core/initrdscripts/files/init-install.sh @@ -261,7 +261,7 @@ if [ -d /tgt_root/etc/ ] ; then echo "$bootdev /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab # We dont want udev to mount our root device while we're booting... if [ -d /tgt_root/etc/udev/ ] ; then - echo "${device}" >> /tgt_root/etc/udev/mount.blacklist + echo "${device}" >> /tgt_root/etc/udev/mount.ignorelist fi fi umount /tgt_root diff --git a/meta/recipes-core/udev/udev-extraconf/mount.blacklist b/meta/recipes-core/udev/udev-extraconf/mount.ignorelist similarity index 100% rename from meta/recipes-core/udev/udev-extraconf/mount.blacklist rename to meta/recipes-core/udev/udev-extraconf/mount.ignorelist diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index b23731870e..5ba66e98e2 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -26,11 +26,11 @@ fi PMOUNT="/usr/bin/pmount" -for line in `grep -h -v ^# /etc/udev/mount.blacklist /etc/udev/mount.blacklist.d/*` +for line in `grep -h -v ^# /etc/udev/mount.ignorelist /etc/udev/mount.ignorelist.d/*` do if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ]; then - logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring" + logger "udev/mount.sh" "[$DEVNAME] is marked to ignore" exit 0 fi done diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb index 2ba35b0df6..7da04379c0 100644 --- a/meta/recipes-core/udev/udev-extraconf_1.1.bb +++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb @@ -1,13 +1,13 @@ SUMMARY = "Extra machine specific configuration files" HOMEPAGE = "https://wiki.gentoo.org/wiki/Eudev" -DESCRIPTION = "Extra machine specific configuration files for udev, specifically blacklist information." +DESCRIPTION = "Extra machine specific configuration files for udev, specifically information on devices to ignore." LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SRC_URI = " \ file://automount.rules \ file://mount.sh \ - file://mount.blacklist \ + file://mount.ignorelist \ file://autonet.rules \ file://network.sh \ file://localextra.rules \ @@ -23,8 +23,8 @@ do_install() { install -m 0644 ${WORKDIR}/autonet.rules ${D}${sysconfdir}/udev/rules.d/autonet.rules install -m 0644 ${WORKDIR}/localextra.rules ${D}${sysconfdir}/udev/rules.d/localextra.rules - install -d ${D}${sysconfdir}/udev/mount.blacklist.d - install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ + install -d ${D}${sysconfdir}/udev/mount.ignorelist.d + install -m 0644 ${WORKDIR}/mount.ignorelist ${D}${sysconfdir}/udev/ install -d ${D}${sysconfdir}/udev/scripts/ @@ -37,7 +37,7 @@ do_install() { FILES:${PN} = "${sysconfdir}/udev" RDEPENDS:${PN} = "udev" -CONFFILES:${PN} = "${sysconfdir}/udev/mount.blacklist" +CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" # to replace udev-extra-rules from meta-oe RPROVIDES:${PN} = "udev-extra-rules" diff --git a/meta/recipes-extended/parted/files/run-ptest b/meta/recipes-extended/parted/files/run-ptest index c3d6fca339..096078967f 100644 --- a/meta/recipes-extended/parted/files/run-ptest +++ b/meta/recipes-extended/parted/files/run-ptest @@ -1,7 +1,7 @@ #!/bin/sh -mkdir -p /etc/udev/mount.blacklist.d -echo /dev/sda1 >> /etc/udev/mount.blacklist.d/parted-tmp +mkdir -p /etc/udev/mount.ignorelist.d +echo /dev/sda1 >> /etc/udev/mount.ignorelist.d/parted-tmp rm -f tests/*.log make -C tests test-suite.log -rm /etc/udev/mount.blacklist.d/parted-tmp +rm /etc/udev/mount.ignorelist.d/parted-tmp From patchwork Sun Jul 17 12:56:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52976CCA485 for ; Sun, 17 Jul 2022 12:57:15 +0000 (UTC) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by mx.groups.io with SMTP id smtpd.web08.15573.1658062627861176877 for ; Sun, 17 Jul 2022 05:57:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gYyAURiw; spf=pass (domain: gmail.com, ip: 209.85.167.42, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f42.google.com with SMTP id n18so15221878lfq.1 for ; Sun, 17 Jul 2022 05:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TzHxw6UFRSajqbmNIrEA8MPjuLNxiX/LnsXdeSc3BYc=; b=gYyAURiwPKUWM1r5kIXsn6qr3Zc5Uz3eHKupuMTnesM6AT1R006hgzxc023khJCKcj A9ZxmCPKg32rUz2+2iA3fdyD2uyMUeXWMXAXf/mNysrUgc6/u/8G2vuLa7E+hWIxVrwU h0YgjMlBg+3Rv8Y+s+S6xjg0+CbfqfYg1Fr1wmM04tcMoeI2h4/NvxQuYdXt+5C4IToM M3HtBKvVoZ4JnJnCJzlcJtCCi2/dxmrTgJWAqpQtGminMOoFtdEcPD5qim+4j1mlHsHT tU+F09S+x0KsxCAOxZL9Qi9/e9MdBXSSU6DU8pUx3IgqPK+RLNRhxhPVU9urFEp7GTFv S23w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TzHxw6UFRSajqbmNIrEA8MPjuLNxiX/LnsXdeSc3BYc=; b=MZYf4w/41vnmaVoa0sNvbD1HjW75l1Wc9ty+k0+8dDJagW2E57EqDjP6au6r4HMpUK DR2icPA7miN2404CqkbhNAbaAgDuUtfCjyhrmhWwHlJly+Tqma+wDGsiGYkAIQI7EJcJ 7pTF1sScIHYuc+jd+AR76vGw4JjHJAD3Zk04LxIpxnIFJSKGZmKmVJQEZVbNgBXAjhOg Q86dHau0wSmKzMxygifir6vbtjCzNvAsbOaExV9s+EDhlUicZ6cpDZdFllHruoq4Z6+7 Ec3ZFX2Ej5XxIMZumDbpj+Po6EbxHchcAdifGmNWmoZ9v3ThQe5gGH/bgmeqXm9G7xIp WbAw== X-Gm-Message-State: AJIora8yKHXnCXsAzq7C7dxrOEvRw+BhIOAoncs2QjNo8JtgFtJKXQQo rftPfH04/1+gS581SFgDngMfAexcBXo= X-Google-Smtp-Source: AGRyM1v/lpj7h3lD/iMZ/+rNyySkvZ/KIUjD77sR9aKy2yZ3sstrIS8lsA/R5gjYoSJpzZtZm9yitg== X-Received: by 2002:a19:4f0c:0:b0:48a:1dcf:9b64 with SMTP id d12-20020a194f0c000000b0048a1dcf9b64mr7329069lfb.120.1658062625655; Sun, 17 Jul 2022 05:57:05 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:05 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Ming Liu , Luca Ceresoli , Richard Purdie Subject: [OE-core] [kirkstone] [PATCH 2/9] udev-extraconf: let automount base directory configurable Date: Sun, 17 Jul 2022 14:56:41 +0200 Message-Id: <20220717125648.2942046-3-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:15 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168150 From: Ming Liu Dont hard-code automount base directory to '/run/media', introduce a variable MOUNT_BASE to let it configurable, like in udisks2 the mount base is also configurable by setting option: --enable-fhs-media. Signed-off-by: Ming Liu Signed-off-by: Luca Ceresoli Signed-off-by: Richard Purdie (cherry picked from commit f077befd5f36ad88623aaf6a38b1a837ecb18650) Signed-off-by: Ming Liu --- .../recipes-core/udev/udev-extraconf/mount.sh | 25 ++++++++++--------- meta/recipes-core/udev/udev-extraconf_1.1.bb | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index 5ba66e98e2..c8b773bc07 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -6,6 +6,7 @@ BASE_INIT="`readlink -f "@base_sbindir@/init"`" INIT_SYSTEMD="@systemd_unitdir@/systemd" +MOUNT_BASE="@MOUNT_BASE@" if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then # systemd as init uses systemd-mount to mount block devices @@ -40,7 +41,7 @@ automount_systemd() { # Skip already mounted partitions if [ -f /run/systemd/transient/run-media-$name.mount ]; then - logger "mount.sh/automount" "/run/media/$name already mounted" + logger "mount.sh/automount" "$MOUNT_BASE/$name already mounted" return fi @@ -53,7 +54,7 @@ automount_systemd() { grep "^[[:space:]]*$tmp" /etc/fstab && return done - [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name" + [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" MOUNT="$MOUNT -o silent" @@ -70,12 +71,12 @@ automount_systemd() { ;; esac - if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name" + if ! $MOUNT --no-block -t auto $DEVNAME "$MOUNT_BASE/$name" then - #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!" - rm_dir "/run/media/$name" + #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"$MOUNT_BASE/$name\" failed!" + rm_dir "$MOUNT_BASE/$name" else - logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful" + logger "mount.sh/automount" "Auto-mount of [$MOUNT_BASE/$name] successful" touch "/tmp/.automount-$name" fi } @@ -93,7 +94,7 @@ automount() { # configured in fstab grep -q "^$DEVNAME " /proc/mounts && return - ! test -d "/run/media/$name" && mkdir -p "/run/media/$name" + ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name" # Silent util-linux's version of mounting auto if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; then @@ -113,12 +114,12 @@ automount() { ;; esac - if ! $MOUNT -t auto $DEVNAME "/run/media/$name" + if ! $MOUNT -t auto $DEVNAME "$MOUNT_BASE/$name" then - #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!" - rm_dir "/run/media/$name" + #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"$MOUNT_BASE/$name\" failed!" + rm_dir "$MOUNT_BASE/$name" else - logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful" + logger "mount.sh/automount" "Auto-mount of [$MOUNT_BASE/$name] successful" touch "/tmp/.automount-$name" fi } @@ -157,5 +158,5 @@ if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ # Remove empty directories from auto-mounter name="`basename "$DEVNAME"`" - test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name" + test -e "/tmp/.automount-$name" && rm_dir "$MOUNT_BASE/$name" fi diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb index 7da04379c0..2b908ac05b 100644 --- a/meta/recipes-core/udev/udev-extraconf_1.1.bb +++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb @@ -15,6 +15,7 @@ SRC_URI = " \ S = "${WORKDIR}" +MOUNT_BASE = "/run/media" do_install() { install -d ${D}${sysconfdir}/udev/rules.d @@ -31,6 +32,7 @@ do_install() { install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh + sed -i 's|@MOUNT_BASE@|${MOUNT_BASE}|g' ${D}${sysconfdir}/udev/scripts/mount.sh install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts } From patchwork Sun Jul 17 12:56:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 528FCCCA480 for ; Sun, 17 Jul 2022 12:57:15 +0000 (UTC) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by mx.groups.io with SMTP id smtpd.web11.15411.1658062629590235730 for ; Sun, 17 Jul 2022 05:57:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IicwBowh; spf=pass (domain: gmail.com, ip: 209.85.208.182, mailfrom: liu.ming50@gmail.com) Received: by mail-lj1-f182.google.com with SMTP id 19so10741087ljz.4 for ; Sun, 17 Jul 2022 05:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lvum3lG7JAzpUDVqbQaPAv+CzFm7fDPoP3bXIWMZDkY=; b=IicwBowhsKdSoEZ2DR+BsrofQqAbNzp2DOx9rJJvbFEAVI+zJGdVEacgztBcfK8z6J f/AslYALPDHv7quVindRl38F9R/yOlg1O0w0QB4xQ9ZfA0e86sJpj3kWEVibIpjY/Zd9 8dYI+BlESe4zOxp+sox5nhXHLPe3y32xGRSXQE+M4i0LHaeWXYVGU432Sz4KP/HSdKaS EM4/3H5dQMqmFwJPdfMk+rpB4U47gRLObPsDkOgFJB2PXV0OKwwVT6oTAoq3Z+Ih3f3H 8kG9HDskg4KySWPfaSftG+UKPQL4lrMoiVRME5D2MRWjEnQMzBBUlP9p/B0Rvc8b+eLJ WZmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lvum3lG7JAzpUDVqbQaPAv+CzFm7fDPoP3bXIWMZDkY=; b=FBxHw18Z9Kf4+grTK3xUWILL903z3FLZ7DU2sMBkGj4lb06htueHuXGCT/8Cuo3suy 0R/fcJ2HfrZtmYGX/8TmtlBuBgIO4H9/ljOtKUO832P8VzgtUuPKrNdAAG2blN495vIU HJ3Pw7ifJu/LpvbSd09SJEz3GYkmOdebeQKVxtvAHKMHM90LCWKgA+2D8M9DzMaUnh1e 7MIi+S2qP07oSDckNyKavNdk9nM/hTK9mDoc0YPE5QhHam4TiPpnQg2rFK8mKIwwR5jx mVY64k2coGG9+A7HEdx1DA2AIsd5aPxLF8yZC1wmTb7jZGz2OWVfXzkiPIKgsuQD3yIF 0zQw== X-Gm-Message-State: AJIora9X93VOPScen+JbxCv2JSwZx0TCHK85n2SCUnOilqgiQXs86rGP xl+dzXU4iTA9C0Mvn26Fbp9X4VT6cSY= X-Google-Smtp-Source: AGRyM1sUhmRiezOmMcEVwVRqMgZjgvkkvxpc7VrjykRlLg3EUUeaJ5+fOn3nuvlxF2JMKGDAICO5cQ== X-Received: by 2002:a2e:a9a6:0:b0:25d:6062:91af with SMTP id x38-20020a2ea9a6000000b0025d606291afmr10362081ljq.144.1658062627376; Sun, 17 Jul 2022 05:57:07 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:06 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Muhammad Hamza , "Arsalan H . Awan" , Muhammad Hamza , Luca Ceresoli , Ming Liu Subject: [OE-core] [kirkstone] [PATCH 3/9] udev-extraconf/mount.sh: add LABELs to mountpoints Date: Sun, 17 Jul 2022 14:56:42 +0200 Message-Id: <20220717125648.2942046-4-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:15 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168151 From: Muhammad Hamza This alters the mountpoints such that if a device has a LABEL or a PARTLABEL, it will be mounted at e.g.: /run/media/$LABEL- /run/media/$PARTLABEL- /run/media/rootfs-sda2 otherwise the device will be mounted at e.g.: /run/media/ /run/media/sda1 The appended with LABEL or PARTLABEL makes sure that the mountpoint is unique, therefore, avoids overlapping mounts. Signed-off-by: Arsalan H. Awan Signed-off-by: Muhammad Hamza Signed-off-by: Luca Ceresoli (cherry picked from commit a9a0a0967832445f1bcc65d58f95343d1b562e1b) Signed-off-by: Ming Liu --- meta/recipes-core/udev/udev-extraconf/mount.sh | 18 ++++++++++++++++++ meta/recipes-core/udev/udev-extraconf_1.1.bb | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index c8b773bc07..40910be8bd 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -54,6 +54,9 @@ automount_systemd() { grep "^[[:space:]]*$tmp" /etc/fstab && return done + # Get the unique name for mount point + get_label_name "${DEVNAME}" + [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" MOUNT="$MOUNT -o silent" @@ -94,6 +97,9 @@ automount() { # configured in fstab grep -q "^$DEVNAME " /proc/mounts && return + # Get the unique name for mount point + get_label_name "${DEVNAME}" + ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name" # Silent util-linux's version of mounting auto if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; @@ -134,6 +140,18 @@ rm_dir() { fi } +get_label_name() { + # Get the LABEL or PARTLABEL + LABEL=`/sbin/blkid | grep "$1:" | grep -o 'LABEL=".*"' | cut -d '"' -f2` + # If the $DEVNAME has a LABEL or a PARTLABEL + if [ -n "$LABEL" ]; then + # Set the mount location dir name to LABEL appended + # with $name e.g. label-sda. That would avoid overlapping + # mounts in case two devices have same LABEL + name="${LABEL}-${name}" + fi +} + # No ID_FS_TYPE for cdrom device, yet it should be mounted name="`basename "$DEVNAME"`" [ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media` diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb index 2b908ac05b..8213c1a930 100644 --- a/meta/recipes-core/udev/udev-extraconf_1.1.bb +++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb @@ -38,7 +38,7 @@ do_install() { } FILES:${PN} = "${sysconfdir}/udev" -RDEPENDS:${PN} = "udev" +RDEPENDS:${PN} = "udev util-linux-blkid" CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" # to replace udev-extra-rules from meta-oe From patchwork Sun Jul 17 12:56:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 449D6C43334 for ; Sun, 17 Jul 2022 12:57:15 +0000 (UTC) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by mx.groups.io with SMTP id smtpd.web08.15573.1658062627861176877 for ; Sun, 17 Jul 2022 05:57:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TVgJlE7M; spf=pass (domain: gmail.com, ip: 209.85.167.42, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f42.google.com with SMTP id n18so15222019lfq.1 for ; Sun, 17 Jul 2022 05:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o0jeXVmFSLCdna0HHTghQ38tuwxgXgLZhMih+C4XmFE=; b=TVgJlE7MYMxqaiE2x4fdJ9BKa9GuJOgnnq+QQ5gQN9pgs/7NsJlYQk0w/hvfsAlowf pmFnfPbNN+Bmccq/1vpuqKT8j21TROncQloCFEYvmAnIz7YIlQTdxPXhtiJTPGC2AuIs Tfxh1HedguR7Uz0DNGi2v+mGEZS0QMmnqFG85kq2E/fb3/nrFrONZdtv3dbrF9MXLFG6 HtP0hM0t7tK3LW1JQ/PFTxr6G2u1rspWi58fJYDDrlLfqN+XxjYS2IT0otqHYAwcAFXw Vq9Z6USmkLhRs0cUlQqR9dbR6dxFuSJ8Bgz3kCem+jRA63WuUJXEaahtoO6sEd+SGgbu nCsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o0jeXVmFSLCdna0HHTghQ38tuwxgXgLZhMih+C4XmFE=; b=bASVLOqBJ30W7T64r1IVauMQYFCUD7OruJvQgahoQ/9GUBGcMuD0jqK9a1UjwB55r6 eVG/t/A/VaudFN3ip+bew8a5MIH6b8JTDjfaHg4V76PkbX5v8agqpkoA1z04UzQQryr5 +7AqNryCLko9UPnciIgWErjsKupUmB9e8HEibFMhzzHj0JrUIdftQatWAVxdzBukLJHa vGCOf3zZA3JtwicAa9SBE9k0VSu9wKxOskNgU4znO3gePsAU256BertYrehG85P6C82U JSk1kT71nm8V57NpUGL9EwVKIcySVvRHY6qmKIJj/+XbsAdiEEpPzi23iM7B8JKT6VVN Fm0A== X-Gm-Message-State: AJIora8/YqZHBZjR7wSbKhnAzRBepKjR1TEHSn1b65nv7rn+mHbEG1Zv Yskc4UBLs82AYVfKEyEMsmAR60N/dbc= X-Google-Smtp-Source: AGRyM1sPkIeG1ke9o2aeUETAIe8wcqarWufY31pZ0EvpYjhJQYpLR6H+h9O3zC3ktYPNkNO+8ZutUQ== X-Received: by 2002:a05:6512:114e:b0:489:e8ef:1792 with SMTP id m14-20020a056512114e00b00489e8ef1792mr12067833lfg.446.1658062628978; Sun, 17 Jul 2022 05:57:08 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:08 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Muhammad Hamza , Awais Belal , Muhammad Hamza , Luca Ceresoli , Ming Liu Subject: [OE-core] [kirkstone] [PATCH 4/9] udev-extraconf/mount.sh: save mount name in our tmp filecache Date: Sun, 17 Jul 2022 14:56:43 +0200 Message-Id: <20220717125648.2942046-5-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:15 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168152 From: Muhammad Hamza Doing this will allow to fetch the exact name created by the auto-mounter during the remove action where depending on the scenario utilities such as the blkid might not be usable due to actual device not being present on the system. Signed-off-by: Awais Belal Signed-off-by: Muhammad Hamza Signed-off-by: Luca Ceresoli (cherry picked from commit 496b76f8775a620c1d449eb6f62a41656abf2a9b) Signed-off-by: Ming Liu --- meta/recipes-core/udev/udev-extraconf/mount.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index 40910be8bd..c4695ee27d 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -126,7 +126,10 @@ automount() { rm_dir "$MOUNT_BASE/$name" else logger "mount.sh/automount" "Auto-mount of [$MOUNT_BASE/$name] successful" - touch "/tmp/.automount-$name" + # The actual device might not be present in the remove event so blkid cannot + # be used to calculate what name was generated here. Simply save the mount + # name in our tmp file. + echo "$name" > "/tmp/.automount-$name" fi } From patchwork Sun Jul 17 12:56:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43C68C433EF for ; Sun, 17 Jul 2022 12:57:15 +0000 (UTC) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by mx.groups.io with SMTP id smtpd.web11.15412.1658062632885754167 for ; Sun, 17 Jul 2022 05:57:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jveMFbTY; spf=pass (domain: gmail.com, ip: 209.85.167.52, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f52.google.com with SMTP id a9so15173242lfk.11 for ; Sun, 17 Jul 2022 05:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DU4Fv6tn3HUeFpBmCHHZ68jLCopbV5ZUp+kqErHNHjQ=; b=jveMFbTYJaBiP25F9Ets3rSS0MyTiran1kfkYLs7CuqxZ4Ytj6UgHPfTORfJPlSZ30 XrFehTw16LtEFVStLkB0uxIrYqQOgSgA/hehfbxqnr2K/R+Kjj9CSP4EGYUbLh5hkElo Vj/QndEUCRFerQYtiwXt/FEDsySh5OhmEDdtW1JpF4/xu6VPEbJDyrVzFoD4y0ZbRVAY I3piaNS0TTYOGGRj3AftQHyiI6xPCyO1J7MSjyCTXdr0iBqAhJBY8tP3/BRmPi2pj9A3 EinsDTHD2a1HJplFmxdVws3VESx2QxEL00Fjq7ua3DMRYQ5SXk6ilPFg23O3iptjord0 mriQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DU4Fv6tn3HUeFpBmCHHZ68jLCopbV5ZUp+kqErHNHjQ=; b=sgSfMxy9NqYD8+aWCe/kDy15BuyZYOPkd8SKdaXJre+J4j33EWx7MmcbczyANPqRLJ dXI4Ed+aXz2lo9lMs+qVTN1lxj2v7e95D6/IJ/78bxtH+++jorOpuX7724Aoqb0f/+Ye YrHudRiSEGRtcsKss/fFoCYMJyr6DumTvx/FC8F4vdGWkiwFvrClhLhZPZeZOYVKIr5I nHKt5t2CpVhJpZHs9OYkmUScxlGwriuBL8WS19SfLK41pw8E5xWklrxWRN297ivTF/tp 5KrhYGVtXDqBDfGPL8mYqqkcV28vZaweNvGs2a5wr/1u717IjUeRqGZK79mTalgKfhTt Fm5Q== X-Gm-Message-State: AJIora8YX+cLEEoOHf1Zfb7HKNp2aQL+2YoY9YKiQFxmByWOixplxpN2 ioMf/H+r5F2ZdF0oWs28iBkjoc23iSc= X-Google-Smtp-Source: AGRyM1unGPd+mbih+Tc+7l99DmP7TUh0kY39MjihEBlrE8zJLw9JgpfhagVIBCCk4nnW2/zhD6tazA== X-Received: by 2002:ac2:5d46:0:b0:484:2613:814f with SMTP id w6-20020ac25d46000000b004842613814fmr12037414lfd.281.1658062630772; Sun, 17 Jul 2022 05:57:10 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:10 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Muhammad Hamza , Awais Belal , Muhammad Hamza , Luca Ceresoli , Ming Liu Subject: [OE-core] [kirkstone] [PATCH 5/9] udev-extraconf/mount.sh: only mount devices on hotplug Date: Sun, 17 Jul 2022 14:56:44 +0200 Message-Id: <20220717125648.2942046-6-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:15 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168153 From: Muhammad Hamza fdisk from util-linux (2.31.1) and above allows the user to manipulate an already mounted device. In order to achieve this functionality it issues a BLKRRPART (block device re-read part) ioctl and in response the kernel generates remove/change/add events if the device is not mounted (manually unmounted etc) which are caught and processed by udev. This causes our auto-mounter to remount everything because it does not keep track and things go out of control. Differentiating between types of remove events such as the one described above (generated by BLKRRPART) and one where the device is physically plugged out is only possible using the DEVPATH variable which is cleaned up only when the device is actually plugged-out. This fixes the above anomaly by only mounting a device in add event which is cleaned up properly (tmp cache deleted) in the remove event or is not present in the tmp cache while making use of the DEVPATH variable during the remove action. Signed-off-by: Awais Belal Signed-off-by: Muhammad Hamza Signed-off-by: Luca Ceresoli (cherry picked from commit 11a5e6c17535438ea1e7a8403ed260c8b3a22bc8) Signed-off-by: Ming Liu --- .../recipes-core/udev/udev-extraconf/mount.sh | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index c4695ee27d..537828e3e3 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -45,6 +45,13 @@ automount_systemd() { return fi + # Only go for auto-mounting when the device has been cleaned up in remove + # or has not been identified yet + if [ -e "/tmp/.automount-$name" ]; then + logger "mount.sh/automount" "[$MOUNT_BASE/$name] is already cached" + return + fi + # Skip the partition which are already in /etc/fstab grep "^[[:space:]]*$DEVNAME" /etc/fstab && return for n in LABEL PARTLABEL UUID PARTUUID; do @@ -100,6 +107,13 @@ automount() { # Get the unique name for mount point get_label_name "${DEVNAME}" + # Only go for auto-mounting when the device has been cleaned up in remove + # or has not been identified yet + if [ -e "/tmp/.automount-$name" ]; then + logger "mount.sh/automount" "[$MOUNT_BASE/$name] is already cached" + return + fi + ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name" # Silent util-linux's version of mounting auto if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; @@ -172,12 +186,18 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_t fi if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then - for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` - do - $UMOUNT $mnt - done - - # Remove empty directories from auto-mounter name="`basename "$DEVNAME"`" - test -e "/tmp/.automount-$name" && rm_dir "$MOUNT_BASE/$name" + tmpfile=`find /tmp | grep "\.automount-.*${name}$"` + if [ ! -e "/sys/$DEVPATH" -a -e "$tmpfile" ]; then + logger "mount.sh/remove" "cleaning up $DEVNAME, was mounted by the auto-mounter" + for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` + do + $UMOUNT $mnt + done + # Remove mount directory created by the auto-mounter + # and clean up our tmp cache file + mntdir=`cat "$tmpfile"` + rm_dir "$MOUNT_BASE/$mntdir" + rm "$tmpfile" + fi fi From patchwork Sun Jul 17 12:56:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BFBFC43334 for ; Sun, 17 Jul 2022 12:57:25 +0000 (UTC) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by mx.groups.io with SMTP id smtpd.web11.15413.1658062634644719731 for ; Sun, 17 Jul 2022 05:57:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PUWuykKw; spf=pass (domain: gmail.com, ip: 209.85.167.44, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f44.google.com with SMTP id u13so15205907lfn.5 for ; Sun, 17 Jul 2022 05:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YzxWEU+SXambC1HOawBB3qXjMr15PQqjLlwsEgJ0rAE=; b=PUWuykKwyOx3AC6bLosy1mWJ29Pq3gPXjm+WG/haJBVX/iJ6hC1xuJYmffqmChqKGI ZHsoWIKRGAmtx0XmdS68SApY7ODfXqe0D1JUN4aU/g57azNI5Vh6qfC9yYQHCiRFIPzV 7vqtgSk3StIMtzJcnMFDY5SIxyOCxTGbPKPec3NO8ryWjUICNvViSs8Gn6M7Ug61HZYp 6M8YArZrEaW+HDTLup8Ib1rxHRut0icJAo85KsY8bzGsCfdZ8jSF3QOsGhOycSgRDOCa IcMvhy0WwL28t3tTe0+9Mlz92K4QCPrvT9dUbdsKgvjXwHXHmcYOAsQ6nbP/2mFqr5qN NO8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YzxWEU+SXambC1HOawBB3qXjMr15PQqjLlwsEgJ0rAE=; b=iMZxO3XQZV+d8NBah/K9Dx3IbdI9Rq8GDiAJFbT+HIiU/QpGterjKXwKRrDlu20pDA drBdnd5hLXobkWUAxg6bGz6cvdD0yRj2KGvzxHVafjeEvMsjMmHCtmauNDBZubjm2ro5 vWeqg6qjh9MKmH9x+fcDdjrgZHA8euuehky0fgESkYLPc3Q3uyF+kKPmkm8i/WYeSkuW 81XWQt01+O/S7KYb8XBFdCqFNFrpHStwLo2v5Q5gMnBNp1qfqsWxLIVEjzrTZmq7B0Et jST8/A0BDGTKYv9zeiee1Dk/lsL2rycjEYRy7q2aDg/bdsdVyVDkgE+3Di+v9jcCkVCb e6Rw== X-Gm-Message-State: AJIora845ZQ3UvaGhVw6hXN3nuy9LXgKzf1UfzNhSsOoqqmdeoZQLqlc 2Dy2JFwSs3VjZSWxNBrzMxS6Sb10yLU= X-Google-Smtp-Source: AGRyM1vB/YDMKWfhxonNKbYHrIxP/WUzXLhNNpIBCLQKz1uzq8DSXPT9yHoXydnkEVffZW2AK9PMTw== X-Received: by 2002:a05:6512:3406:b0:489:deab:e516 with SMTP id i6-20020a056512340600b00489deabe516mr12125089lfr.609.1658062632487; Sun, 17 Jul 2022 05:57:12 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:11 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Muhammad Hamza , Awais Belal , Muhammad Hamza , Luca Ceresoli , Ming Liu Subject: [OE-core] [kirkstone] [PATCH 6/9] udev-extraconf: force systemd-udevd to use shared MountFlags Date: Sun, 17 Jul 2022 14:56:45 +0200 Message-Id: <20220717125648.2942046-7-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:25 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168154 From: Muhammad Hamza Automounting does not work cleanly in case systemd as well as udev rules are being used simultaneously and in most cases race conditions and unknown behavior can come up. In case we're running on top of systemd we need to make sure that systemd-udevd knows that udev is in play as well and mounting should be done using shared flags. Also as we're using mount from sources other than systemd-mount in current scripts this is the most manageable fix to automounting problems. Signed-off-by: Awais Belal Signed-off-by: Muhammad Hamza Signed-off-by: Luca Ceresoli (cherry picked from commit 1e770416b4c9a0468404fb64d55114d93e84763b) Signed-off-by: Ming Liu --- .../udev/udev-extraconf/systemd-udevd.service | 3 +++ meta/recipes-core/udev/udev-extraconf_1.1.bb | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-core/udev/udev-extraconf/systemd-udevd.service diff --git a/meta/recipes-core/udev/udev-extraconf/systemd-udevd.service b/meta/recipes-core/udev/udev-extraconf/systemd-udevd.service new file mode 100644 index 0000000000..a9b86eb6e4 --- /dev/null +++ b/meta/recipes-core/udev/udev-extraconf/systemd-udevd.service @@ -0,0 +1,3 @@ +.include @systemd_unitdir@/system/systemd-udevd.service +[Service] +MountFlags=shared diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb index 8213c1a930..ef6019259e 100644 --- a/meta/recipes-core/udev/udev-extraconf_1.1.bb +++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb @@ -11,6 +11,7 @@ SRC_URI = " \ file://autonet.rules \ file://network.sh \ file://localextra.rules \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://systemd-udevd.service', '', d)} \ " S = "${WORKDIR}" @@ -35,9 +36,15 @@ do_install() { sed -i 's|@MOUNT_BASE@|${MOUNT_BASE}|g' ${D}${sysconfdir}/udev/scripts/mount.sh install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/systemd/system + install ${WORKDIR}/systemd-udevd.service ${D}${sysconfdir}/systemd/system/systemd-udevd.service + sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/systemd/system/systemd-udevd.service + fi } -FILES:${PN} = "${sysconfdir}/udev" +FILES:${PN} = "${sysconfdir}/udev ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${sysconfdir}/systemd/system/systemd-udevd.service', '', d)}" RDEPENDS:${PN} = "udev util-linux-blkid" CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" From patchwork Sun Jul 17 12:56:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EC76CCA47B for ; Sun, 17 Jul 2022 12:57:25 +0000 (UTC) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by mx.groups.io with SMTP id smtpd.web08.15573.1658062627861176877 for ; Sun, 17 Jul 2022 05:57:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OI15QwZx; spf=pass (domain: gmail.com, ip: 209.85.167.42, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f42.google.com with SMTP id n18so15222194lfq.1 for ; Sun, 17 Jul 2022 05:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VKKfLOY5kO6EuNpq3jPN8+Sd2rGxYdiRDswRebGyL0Q=; b=OI15QwZxFxMdxEdN7ORBYROYsMzF7GGa17xVpSLBsgdZIauwkaIcks1bRXAEvZDTBo z+EZKTEFFZ6RqNi750w8QzUXb7s13DC457D4e3vDbcBfOqcWJ5SOhSgQ/i+WHBPN7Fn2 nAEs/106BqXG4JWSRZbVrqeXYnOwDdHze9kellrBK69ioBcF31qdeSFX5r+A5/lme7x7 bzTvqddb7BF00RwYIUwcMCYgJPhaNMI2OFY62Jl68F8HsXFwEgGz6lxMVaEvHNTjXZVj STHqlh8cm4uSugohd/XpsmZYyMpCGRKjKs2s5MS8bDdSxOgCGyh6X57IMgdeMXNABnAw ArGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VKKfLOY5kO6EuNpq3jPN8+Sd2rGxYdiRDswRebGyL0Q=; b=0Ke2eagp3Y0tX4cUjAR/PH/uEaLX7tOFu3C0y1WlDvoOas+/f+yjOGfUfhJygWjIOp BJoOn3lqjiDBVOKAHC8apqQZ6jzkNWcvW1gpEbqghrd6inrFMPPGU/4tV/QQZOovQru0 vrr2THkxHrxbcYpRi63g+Y1TC4wyQ3xwbhIbAO40zYPi1XyTAU4PR9ScdXvtLeT2nwDQ pUcCKMJfL5zFsDzMHSngKwmg8K96JMrVCeKuEGkkP4F1qbbUI53/98JJHxKG7tINTN3q dQUZZa/pmsRvW8BoeTgGJXVMqM/W4xCi+xF8289rxVH7LoOk5WaXOJ6jGlzpGIIIsUy9 znEg== X-Gm-Message-State: AJIora9IHe/Ee7Y90Lb8u6D3AtoHqM0kTYT2D5b4PByxif9sZ9AtF3HH OjPhV8dq6agABOBMBm58ahs1fn+weUc= X-Google-Smtp-Source: AGRyM1sHc6En74raBFkvXzzS1dgPywstRpJtthVm8732boLK9XkbXXwEIWKlzhmhhGD2iQlzLr4HsA== X-Received: by 2002:a05:6512:3f01:b0:46b:a5ba:3b89 with SMTP id y1-20020a0565123f0100b0046ba5ba3b89mr12411096lfa.28.1658062634128; Sun, 17 Jul 2022 05:57:14 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:13 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Muhammad Hamza , Ansar Rasool , Muhammad Hamza , Luca Ceresoli , Ming Liu Subject: [OE-core] [kirkstone] [PATCH 7/9] udev-extraconf/mount.sh: ignore lvm in automount Date: Sun, 17 Jul 2022 14:56:46 +0200 Message-Id: <20220717125648.2942046-8-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:25 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168155 From: Muhammad Hamza Failure message is shown in boot logs when trying to mount lvm as automounter does not handle cases where lvm is mounted. This simply skips lvm while automounting to avoid failure message in boot logs. Signed-off-by: Ansar Rasool Signed-off-by: Muhammad Hamza Signed-off-by: Luca Ceresoli (cherry picked from commit b1d18072ed9a8b0bca0f20f8e5deefa73ab6acbe) Signed-off-by: Ming Liu --- meta/recipes-core/udev/udev-extraconf/mount.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index 537828e3e3..8b6ce77741 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -76,6 +76,8 @@ automount_systemd() { ;; swap) return ;; + lvm*|LVM*) + return ;; # TODO *) ;; @@ -129,6 +131,8 @@ automount() { ;; swap) return ;; + lvm*|LVM*) + return ;; # TODO *) ;; From patchwork Sun Jul 17 12:56:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10264 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BF97C433EF for ; Sun, 17 Jul 2022 12:57:25 +0000 (UTC) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mx.groups.io with SMTP id smtpd.web08.15572.1658062626091943937 for ; Sun, 17 Jul 2022 05:57:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JMZ7UCQc; spf=pass (domain: gmail.com, ip: 209.85.167.50, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f50.google.com with SMTP id z25so15220722lfr.2 for ; Sun, 17 Jul 2022 05:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uPCJTbQYQvMsQKS0asAawhrOcbeWcdbys14ctf2RNDg=; b=JMZ7UCQc0m6N4ZcxcIqtqczNxV3hkQhAAZUQoeF03vAHJh00ZxuATu2Nyy9jbIWbwX AXSUSlH6Ki8mj2yaZWJlN5ofjcRH8qtk3cuSlO7r/TcgoUqfdijJ/AiRvdLIAB+TCZOE k9+0VPYfCaeNUnvmeg0UH6CXrYQpPHhk/a85ApUjX3iauum63mLUerDp4BVdENoZ/OsQ SvRDfqOwFsxhLtVq+yF02m7DOOPnrWzDHzI5TPCR6lmY1+i9XTHYP38/zffxPYXJRyMg Wanh8Xrq10zwaUcBKIga3TrTaBsPl1k6xLJrDa338Lb+USNYdS1IE1qz6bkoGF2yewhS eJ5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uPCJTbQYQvMsQKS0asAawhrOcbeWcdbys14ctf2RNDg=; b=M8C4KY+tSss2YuVj+JsxobM2r2SmtxwnHnir+ltKlfUfmhflGZfZIazl5lWJmDFp5Z yR3HZg0kadwhpm0USzaABXuio1WNHIAAKvOQvL58wOE6hkyew/eu5JNgKY6XWCxsyHcA 6+YGakCrf15M6Pl37tvx1ovBN9mCaHAlGVGDxRSbZaPphp19rIhCI16YE6783Y/9b8Ls nsVxrxvmGAjJlcmFcM5PybL+FzXsoihU+QIzvvAXFjjxbskcIm+SPMVRjsUeevHm7Zs4 Hqpe7nreDXeT2c2tnrDTq2fCRLwRPkBnRuGWtP4EgH+/N54R8q89pU1Hw7G9w8TtlPmL 5dVA== X-Gm-Message-State: AJIora+WhxDG6baDB05dlOtjYys2fyn2u+rAYPZT0MZ4hesOzJCXGTHU yKkaVIz6jvw2U9B4P62xOYYBmpdpE4M= X-Google-Smtp-Source: AGRyM1vojew51OGJQsxuV/j7mjaBUSzKQS9KtjProtH1jli3DKBqqZU9UIWNNoCiQ0JFiZ2FgG5fmQ== X-Received: by 2002:a05:6512:39cc:b0:48a:2c31:8feb with SMTP id k12-20020a05651239cc00b0048a2c318febmr4247364lfu.660.1658062635664; Sun, 17 Jul 2022 05:57:15 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:15 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Ming Liu , Richard Purdie Subject: [OE-core] [kirkstone] [PATCH 8/9] udev-extraconf: fix some systemd automount issues Date: Sun, 17 Jul 2022 14:56:47 +0200 Message-Id: <20220717125648.2942046-9-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:25 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168156 From: Ming Liu The '.include' syntax has been dropped from latest systemd releases, we need drop the systemd-udevd.service here, introduce a postinst function to add "MountFlags=shared" to systemd-udevd.service. Also lsblk binary is being called in mount.sh automount_systemd function, add it to RDEPENDS. Signed-off-by: Ming Liu Signed-off-by: Richard Purdie (cherry picked from commit 356520d60b9429c6f62124821e42468ff2b7b1d6) Signed-off-by: Ming Liu --- .../udev/udev-extraconf/systemd-udevd.service | 3 --- meta/recipes-core/udev/udev-extraconf_1.1.bb | 20 +++++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 meta/recipes-core/udev/udev-extraconf/systemd-udevd.service diff --git a/meta/recipes-core/udev/udev-extraconf/systemd-udevd.service b/meta/recipes-core/udev/udev-extraconf/systemd-udevd.service deleted file mode 100644 index a9b86eb6e4..0000000000 --- a/meta/recipes-core/udev/udev-extraconf/systemd-udevd.service +++ /dev/null @@ -1,3 +0,0 @@ -.include @systemd_unitdir@/system/systemd-udevd.service -[Service] -MountFlags=shared diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb index ef6019259e..30f1fe76d0 100644 --- a/meta/recipes-core/udev/udev-extraconf_1.1.bb +++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb @@ -11,7 +11,6 @@ SRC_URI = " \ file://autonet.rules \ file://network.sh \ file://localextra.rules \ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://systemd-udevd.service', '', d)} \ " S = "${WORKDIR}" @@ -36,16 +35,21 @@ do_install() { sed -i 's|@MOUNT_BASE@|${MOUNT_BASE}|g' ${D}${sysconfdir}/udev/scripts/mount.sh install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts +} + +pkg_postinst:${PN} () { + if [ -e $D${systemd_unitdir}/system/systemd-udevd.service ]; then + sed -i "/\[Service\]/aMountFlags=shared" $D${systemd_unitdir}/system/systemd-udevd.service + fi +} - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${sysconfdir}/systemd/system - install ${WORKDIR}/systemd-udevd.service ${D}${sysconfdir}/systemd/system/systemd-udevd.service - sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/systemd/system/systemd-udevd.service - fi +pkg_postrm:${PN} () { + if [ -e $D${systemd_unitdir}/system/systemd-udevd.service ]; then + sed -i "/MountFlags=shared/d" $D${systemd_unitdir}/system/systemd-udevd.service + fi } -FILES:${PN} = "${sysconfdir}/udev ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${sysconfdir}/systemd/system/systemd-udevd.service', '', d)}" -RDEPENDS:${PN} = "udev util-linux-blkid" +RDEPENDS:${PN} = "udev util-linux-blkid ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'util-linux-lsblk', '', d)}" CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" # to replace udev-extra-rules from meta-oe From patchwork Sun Jul 17 12:56:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 10267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 410A5CCA480 for ; Sun, 17 Jul 2022 12:57:25 +0000 (UTC) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mx.groups.io with SMTP id smtpd.web08.15572.1658062626091943937 for ; Sun, 17 Jul 2022 05:57:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ROSLUIXH; spf=pass (domain: gmail.com, ip: 209.85.167.50, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f50.google.com with SMTP id z25so15220787lfr.2 for ; Sun, 17 Jul 2022 05:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vwLbzCTRXdn9A1MmX4C3Aq8R7Yll596udAk7bSBd3/M=; b=ROSLUIXHd+K8/7SmtF8G9NV6HS/kWV0cLzl9c+4V/9ruJSiycy+kkG22QtzZbtpIfA TLKdAMWVZK/BqYWjw4yCYN0+I3lLMpbFH5hwKwR0cr5OM+EDK6xMgeD+tG8yS+ImyDxp 019umx2X9a6HbbwH+cSm5urOiugDOjsodAM3THsxURBJrcLcsgCJD8dXz38LmkSaEN9X 2aO5SEE4TT5zcPLFEdtstGNNfWaayrXGmzFE3T5rhoQUQPhT2Aog8jEzboMq8ttjlIJt LzcOWgh5kcp6/s5kBpl+tVJZJnLizKNaB+JLeckznN3ajzocEixzXYj/FAteM8DF9XOA Km8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vwLbzCTRXdn9A1MmX4C3Aq8R7Yll596udAk7bSBd3/M=; b=0CFy3ilYJTTEd2TrDPP8wYgqjmM/cEgYMG0hBt0clF1f17f238pcYGOPbQPQuOWKnr 8Z02Ezu8EOZOk+KH+qDzZ4m+4DDR1nKUFgNEFSNtD5WwYsRJm+6t7G20iPKjCUVnd1Eo yFrerj1g/3nZHqhpFD7/gLWg6goxNIJN2gytEav5G9vyQJTLf7HSr9o0j/+iB47Mnku1 pg+RGFe3KlcPwvYmtX1w/ue2yqd7CmStLwIk/sCzp6ITimLfiA9KYE/Y87+XVVlIrpAS EOzdsnQ3kWFTxEjw+kmGX8HF+mcm4QICMbfyCBc9Qnlj00qsvnHsh8l/GicHss5HkOUd fykw== X-Gm-Message-State: AJIora/25wGCxPWoMF3FMCAEYIdcUyjO7aB3XzLk1kgQMBVTKmeQObWt m0kWVPRatv3JdE7KeTcO49G8cV76fVs= X-Google-Smtp-Source: AGRyM1s6fA89w2XQ5RN9Kk15Zn8cdVK0YriD+Ixb5Wm6xYDOQHKy9LFr3AQqJKRmGR4xTBmUEl4gTw== X-Received: by 2002:a05:6512:23a3:b0:489:dd50:9b18 with SMTP id c35-20020a05651223a300b00489dd509b18mr12082247lfv.341.1658062637364; Sun, 17 Jul 2022 05:57:17 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id v11-20020a05651203ab00b00483e5f01698sm2023056lfp.65.2022.07.17.05.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:57:16 -0700 (PDT) From: liu.ming50@gmail.com To: openembedded-core@lists.openembedded.org Cc: steve@sakoman.com, Ming Liu , Alexandre Belloni , Richard Purdie Subject: [OE-core] [kirkstone] [PATCH 9/9] udev-extraconf:mount.sh: fix path mismatching issues Date: Sun, 17 Jul 2022 14:56:48 +0200 Message-Id: <20220717125648.2942046-10-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220717125648.2942046-1-liu.ming50@gmail.com> References: <20220717125648.2942046-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 17 Jul 2022 12:57:25 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/168157 From: Ming Liu Since commit f077befd5f36ad88623aaf6a38b1a837ecb18650: [ udev-extraconf: let automount base directory configurable ] the mount base directory was configurable, we need drop 'run-media' usage as well, change to figure it out from MOUNT_BASE. Also 'get_label_name' function needs to be called ealier in automount_systemd before checking '/tmp/.automount-$name', otherwise they would never match. (From OE-Core rev: c013b33162546fb5bd4bcc1daac75aa65d0be1a3) Signed-off-by: Ming Liu Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie (cherry picked from commit 7ed210054b3e253d5a67075bb9d4768d1661bef1) Signed-off-by: Ming Liu --- meta/recipes-core/udev/udev-extraconf/mount.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index 8b6ce77741..43acb3a7a0 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -40,11 +40,14 @@ automount_systemd() { name="`basename "$DEVNAME"`" # Skip already mounted partitions - if [ -f /run/systemd/transient/run-media-$name.mount ]; then + if [ -f /run/systemd/transient/$(echo $MOUNT_BASE | cut -d '/' -f 2- | sed 's#/#-#g')-*$name.mount ]; then logger "mount.sh/automount" "$MOUNT_BASE/$name already mounted" return fi + # Get the unique name for mount point + get_label_name "${DEVNAME}" + # Only go for auto-mounting when the device has been cleaned up in remove # or has not been identified yet if [ -e "/tmp/.automount-$name" ]; then @@ -61,9 +64,6 @@ automount_systemd() { grep "^[[:space:]]*$tmp" /etc/fstab && return done - # Get the unique name for mount point - get_label_name "${DEVNAME}" - [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" MOUNT="$MOUNT -o silent"