From 852816be709cab6f99022c7e3d62623fde47d158 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Wed, 2 Aug 2023 12:30:39 +0100 Subject: [PATCH] Avoid masking/unmasking the empty list of mount units (!116) After the previous commit "Stop masking the root file system mount unit", GParted now reports this error to the terminal on Debian 10 and 11: # gparted To few arguments. GParted 1.5.0-git configuration --enable-online-resize libparted 3.2 Debian installations, at least on PC hardware and using BIOS booting so they don't have a /boot/efi file system, only have a single file system, / (root). That is now excluded from masking so gparted shell wrapper runs systemctl without any mount units to mask. Hence the error. # systemctl --runtime mask --quiet -- Too few arguments. # echo $? 1 Fix this by only masking and unmasking units when the list of mounts is non-empty. Closes !116 - Systemd mount masking and udev rule location updates --- gparted.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gparted.in b/gparted.in index 5bcbd671..d35b4a8f 100755 --- a/gparted.in +++ b/gparted.in @@ -148,6 +148,7 @@ done # # Use systemctl to prevent automount by masking currently unmasked mount points # +MOUNTLIST='' if test "x$HAVE_SYSTEMCTL" = "xyes"; then MOUNTLIST=`systemctl show --all --property=Where,What,Id,LoadState '*.mount' | \ awk ' @@ -172,7 +173,9 @@ if test "x$HAVE_SYSTEMCTL" = "xyes"; then /^$/ { process_unit() } END { process_unit() } '` - systemctl --runtime mask --quiet -- $MOUNTLIST + if test "x$MOUNTLIST" != "x"; then + systemctl --runtime mask --quiet -- $MOUNTLIST + fi fi # @@ -234,7 +237,7 @@ done # # Use systemctl to unmask those mount points masked above # -if test "x$HAVE_SYSTEMCTL" = "xyes"; then +if test "x$HAVE_SYSTEMCTL" = "xyes" && test "x$MOUNTLIST" != "x"; then systemctl --runtime unmask --quiet -- $MOUNTLIST 2> /dev/null || \ { cd /run/systemd/system &&