From a95a44d7f1da2d7943da4da291ac6ca37b98587f Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 21 May 2021 16:48:05 +0200 Subject: [PATCH] fix: POC for a sane dracut chroot environment `bash` and various other utilities only work with a sane chroot environment. At least `bash` needs `/dev/fd` to function properly. Take this as a POC patch to make things work. --- src/pylorax/treebuilder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index d57370d3..3a5144af 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -328,14 +328,17 @@ class TreeBuilder(object): # Construct an initrd from the kernel name outfile = kernel.path.replace("vmlinuz-", "initrd-") + ".img" logger.info("rebuilding %s", outfile) - logger.info("dracut warnings about /proc are safe to ignore") if backup: initrd = joinpaths(self.vars.inroot, outfile) if os.path.exists(initrd): os.rename(initrd, initrd + backup) cmd = dracut + [outfile, kernel.version] + runcmd([ "mount", "-t", "proc", "-o", "nosuid,noexec,nodev", "proc", self.vars.inroot + "/proc" ]) + runcmd([ "mount", "-t", "devtmpfs", "-o", "mode=0755,noexec,nosuid,strictatime", "devtmpfs", self.vars.inroot + "/dev" ]) runcmd(cmd, root=self.vars.inroot) + runcmd([ "umount", self.vars.inroot + "/proc" ]) + runcmd([ "umount", self.vars.inroot + "/dev" ]) def build(self): templatefile = templatemap[self.vars.arch.basearch]