From 41cda3bd2abec6dc2786e141b15b9d5ce238db86 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 19 Jul 2023 09:12:10 -0400 Subject: [PATCH] prepare-root: Drop code mounting `/proc` This must be done by the init process here; it was always dead code in the initramfs path. We keep the copy of this code in the now-forked -static.c. --- src/switchroot/ostree-prepare-root.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c index e9075a68..d0b58cc5 100644 --- a/src/switchroot/ostree-prepare-root.c +++ b/src/switchroot/ostree-prepare-root.c @@ -270,27 +270,15 @@ int main (int argc, char *argv[]) { char srcpath[PATH_MAX]; + struct stat stbuf; const char *root_arg = NULL; - bool we_mounted_proc = false; g_autoptr (GError) error = NULL; if (argc < 2) err (EXIT_FAILURE, "usage: ostree-prepare-root SYSROOT"); root_arg = argv[1]; - struct stat stbuf; - if (stat ("/proc/cmdline", &stbuf) < 0) - { - if (errno != ENOENT) - err (EXIT_FAILURE, "stat(\"/proc/cmdline\") failed"); - /* We need /proc mounted for /proc/cmdline and realpath (on musl) to - * work: */ - if (mount ("proc", "/proc", "proc", MS_SILENT, NULL) < 0) - err (EXIT_FAILURE, "failed to mount proc on /proc"); - we_mounted_proc = 1; - } - /* This is the final target where we should prepare the rootfs. The usual * case with systemd in the initramfs is that root_mountpoint = "/sysroot". * In the fastboot embedded case we're pid1 and will setup / ourself, and @@ -301,13 +289,6 @@ main (int argc, char *argv[]) err (EXIT_FAILURE, "realpath(\"%s\")", root_arg); char *deploy_path = resolve_deploy_path (root_mountpoint); - if (we_mounted_proc) - { - /* Leave the filesystem in the state that we found it: */ - if (umount ("/proc")) - err (EXIT_FAILURE, "failed to umount proc from /proc"); - } - /* Query the repository configuration - this is an operating system builder * choice. More info: https://github.com/ostreedev/ostree/pull/1767 */ -- 2.30.2