From d7377710869cd14dddf8ab30b6b44620c51b48dd Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 24 Sep 2019 18:14:34 +0000 Subject: [PATCH] mount: Skip LABEL=root filesystems Part of supporting overriding the rootfs. We don't want to try to mount this, as it will already have been taken care of by the initramfs. Similarly for unmount. --- internal/exec/stages/mount/mount.go | 5 +++++ internal/exec/stages/umount/umount.go | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/internal/exec/stages/mount/mount.go b/internal/exec/stages/mount/mount.go index 3dd4a4bd6..b95b821f2 100644 --- a/internal/exec/stages/mount/mount.go +++ b/internal/exec/stages/mount/mount.go @@ -102,6 +102,11 @@ func (s stage) mountFs(fs types.Filesystem) error { return nil } + // This one is mounted by sysroot.mount in the initramfs already. + if *fs.Label == "root" { + return nil + } + // mount paths shouldn't include symlinks or other non-directories so we can use filepath.Join() // instead of s.JoinPath(). Check that the resulting path is composed of only directories. path := filepath.Join(s.DestDir, *fs.Path) diff --git a/internal/exec/stages/umount/umount.go b/internal/exec/stages/umount/umount.go index a0d3c7555..b7865d140 100644 --- a/internal/exec/stages/umount/umount.go +++ b/internal/exec/stages/umount/umount.go @@ -81,6 +81,12 @@ func (s stage) umountFs(fs types.Filesystem) error { if fs.Format != nil && *fs.Format == "swap" { return nil } + + // This one is mounted by sysroot.mount in the initramfs already. + if *fs.Label == "root" { + return nil + } + path, err := s.JoinPath(*fs.Path) if err != nil { return err