osbuild / osbuild

Build-Pipelines for Operating System Artifacts

Home Page:https://www.osbuild.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

osbuild devices have inaccurate information in mountinfo inside bwrap

dustymabe opened this issue · comments

For CoreOS teams we are working on an OSBuild stage to be able to run bootupd to install/manage the bootloader(s) for systems. We are running into an issue:

symptom:

Running something like grub2-install on a path yields a cryptic error message:

/usr/sbin/grub2-install: error: failed to get canonical path of `/run/osbuild/osbuild-dev-bcfztg00/loop2'

The original command that was run was something like:

Failed to run "/usr/sbin/grub2-install" "--target" "i386-pc" "--boot-directory" "/run/osbuild/mounts/boot" "--modules" "mdra id1x part_gpt" "/dev/loop0"

problem:

I ran strace on the process and it turns out grub2-install is trying to find the source for the underlying boot mount by consulting /proc/self/mountinfo:

[pid    26] openat(AT_FDCWD, "/proc/self/mountinfo", O_RDONLY) = 3
[pid    26] newfstatat(3, "", {st_mode=S_IFREG|0444, st_size=0, ...}, AT_EMPTY_PATH) = 0
[pid    26] read(3, "460 522 0:50 / /dev rw,nosuid,relatime master:346 - tmpfs none rw,seclabel,inode64\n461 460 0:57 / /dev/shm rw,nosuid,nodev,relatime - tmpfs tmpfs rw,seclabel,mode=755,
[pid    26] read(3, "ursiveprot\n470 467 0:27 / /sys/fs/pstore ro,nosuid,nodev,noexec,relatime master:8 - pstore pstore rw,seclabel\n471 467 0:28 / /sys/fs/bpf ro,nosuid,nodev,noexec,relati
[pid    26] read(3, "rw,user_id=0,group_id=0,allow_other\n480 478 0:30 /root/var/osbuild/store/stage/uuid-9500fc0174dd4fe7a119eabaccc41ad6/data/tree /run/osbuild/tree rw,nosuid,nodev,relati
[pid    26] read(3, "ascii,shortname=mixed,errors=remount-ro\n485 482 0:50 / /run/osbuild/mounts/ostree/deploy/fedora-coreos/deploy/4b56bd7b23a7ff35170ed4d7ca08210305d11ede9bda8daf0b48a8a92
[pid    26] read(3, "ev,noexec,relatime - proc proc rw\n490 487 0:58 /bus /run/osbuild/mounts/ostree/deploy/fedora-coreos/deploy/4b56bd7b23a7ff35170ed4d7ca08210305d11ede9bda8daf0b48a8a92887
[pid    26] read(3, "un/osbuild/mounts/ostree/deploy/fedora-coreos/deploy/4b56bd7b23a7ff35170ed4d7ca08210305d11ede9bda8daf0b48a8a928873ab8.0/sys/fs/cgroup ro,nosuid,nodev,noexec,relatime ma
[pid    26] read(3, "/sys/fs/selinux ro,nosuid,nodev,noexec,relatime master:11 - selinuxfs selinuxfs rw\n537 536 0:20 / /run/osbuild/mounts/ostree/deploy/fedora-coreos/deploy/4b56bd7b23a7ff
[pid    26] read(3, "/stages/org.osbuild.bootupd /run/osbuild/bin/org.osbuild.bootupd ro,nosuid,nodev,relatime master:340 - fuse.sshfs :/var/b/shared rw,user_id=0,group_id=0,allow_other\n54
[pid    26] read(3, "ze=3237628k,nr_inodes=819200,mode=755,inode64\n546 478 0:25 /osbuild/api-x1t_7yhj/remoteloop /run/osbuild/api/remoteloop rw,nosuid,nodev master:13 - tmpfs tmpfs rw,secl
[pid    26] read(3, "rors=remount-ro\n", 1024) = 16
[pid    26] read(3, "", 1024)           = 0
[pid    26] munmap(0x7fa2eda4a000, 266240) = 0
[pid    26] close(3)                    = 0
[pid    26] readlink("/run", 0x7fff76f51a60, 1023) = -1 EINVAL (Invalid argument)
[pid    26] readlink("/run/osbuild", 0x7fff76f51a60, 1023) = -1 EINVAL (Invalid argument)
[pid    26] readlink("/run/osbuild/osbuild-dev-bcfztg00", 0x7fff76f51a60, 1023) = -1 ENOENT (No such file or directory)
[pid    26] write(2, "/usr/sbin/grub2-install: error:", 31) = 31

which has this information for the mount in question:

bash-5.2# cat /proc/self/mountinfo  | grep loop2
483 482 7:2 / /run/osbuild/mounts/boot rw,nosuid,nodev,relatime master:375 - ext4 /run/osbuild/osbuild-dev-bcfztg00/loop2 rw,seclabel
550 522 7:2 / /boot rw,nosuid,nodev,relatime master:375 - ext4 /run/osbuild/osbuild-dev-bcfztg00/loop2 rw,seclabel

proposed fixes in #1493