Reload systemd after modifying fstab
authorMichael Prokop <mika@grml.org>
Fri, 25 Nov 2022 07:50:08 +0000 (08:50 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 25 Nov 2022 07:50:50 +0000 (08:50 +0100)
Otherwise e.g. mount(1) might complain about:

| mount: (hint) your fstab has been modified, but systemd still uses
|       the old version; use `systemctl daemon-reload` to reload.

Thanks: Chris Hofstaedtler for the bug report
Closes: https://github.com/grml/grml-autoconfig/issues/12

scripts/grml-udev-rebuildfstab

index 40d8078..fc5e191 100755 (executable)
@@ -325,6 +325,12 @@ if [ -r "$MNTFILE" ] ; then
    cat $TMPFILE > $MNTFILE
 fi
 
+# ensure systemd uses recent fstab configuration
+if [ -d /run/systemd/system ]; then
+  logit 'Reloading systemd manager configuration to use current fstab'
+  systemctl daemon-reload
+fi
+
 bailout 0
 
 ## END OF FILE #################################################################