From bf88deb602304364d4e93329e2808b526c9774e0 Mon Sep 17 00:00:00 2001 From: David Escalona Date: Fri, 24 Mar 2023 12:29:05 +0100 Subject: [PATCH] mount_digiparts.sh: add unit running check for systemd devices For devices running 'systemd', the mount process is done through 'systemd-mount', which spawns a system unit. Trying to mount the partition again throws an error stating that a unit with the same name is already running. To avoid it, check if the unit is already spawned before mounting the partition and, if so, just restart the unit. Signed-off-by: David Escalona --- .../udev/udev-extraconf/mount_digiparts.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh b/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh index bf07cce48..6ee14c63a 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh @@ -53,6 +53,16 @@ fi if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then # systemd as init uses systemd-mount to mount block devices + + # Verify if unit is already launched, if so just restart it. + if systemctl | grep -q "mnt-${PARTNAME}.mount"; then + if ! systemctl restart "mnt-${PARTNAME}.mount"; then + logger -t udev "ERROR: Could not mount '${DEVNAME}'" + exit 1 + fi + exit 0 + fi + MOUNT="/usr/bin/systemd-mount" MOUNT_PARAMS="${MOUNT_PARAMS} --no-block"