diff --git a/static/usr/lib/core/remount-core-fs b/static/usr/lib/core/remount-core-fs new file mode 100755 index 00000000..ac5ac4aa --- /dev/null +++ b/static/usr/lib/core/remount-core-fs @@ -0,0 +1,19 @@ +#!/bin/bash + +FILESYSTEMS=( + /run/mnt/base + /run/mnt/data + /run/mnt/gadget + /run/mnt/kernel + /run/mnt/snapd + /run/mnt/ubuntu-boot + /run/mnt/ubuntu-save + /run/mnt/ubuntu-seed + /writable +) + +for fs in "${FILESYSTEMS[@]}"; do + if mountpoint -q "${fs}"; then + mount --make-private "${fs}" + fi +done diff --git a/static/usr/lib/systemd/system/local-fs.target.wants/remount-core-fs.service b/static/usr/lib/systemd/system/local-fs.target.wants/remount-core-fs.service new file mode 120000 index 00000000..6898efbb --- /dev/null +++ b/static/usr/lib/systemd/system/local-fs.target.wants/remount-core-fs.service @@ -0,0 +1 @@ +../remount-core-fs.service \ No newline at end of file diff --git a/static/usr/lib/systemd/system/remount-core-fs.service b/static/usr/lib/systemd/system/remount-core-fs.service new file mode 100644 index 00000000..ef20cdbf --- /dev/null +++ b/static/usr/lib/systemd/system/remount-core-fs.service @@ -0,0 +1,16 @@ +[Unit] +Description=Reset propagation of initial mount points +DefaultDependencies=no +Before=local-fs-pre.target +Before=local-fs.target +Before=shutdown.target +Wants=local-fs-pre.target +Conflicts=shutdown.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/lib/core/remount-core-fs + +[Install] +WantedBy=local-fs.target