From: Daan De Meyer Date: Tue, 11 Feb 2025 10:14:09 +0000 (+0100) Subject: Make various tools more quiet X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3493%2Fhead;p=thirdparty%2Fmkosi.git Make various tools more quiet Let's reduce the noise when booting a vm with mkosi vm by silencing the output of some tools used during setup that isn't useful. --- diff --git a/mkosi/qemu.py b/mkosi/qemu.py index 367972b08..6dd9f38a3 100644 --- a/mkosi/qemu.py +++ b/mkosi/qemu.py @@ -361,6 +361,7 @@ def start_virtiofsd( "--no-announce-submounts", "--sandbox=chroot", f"--inode-file-handles={'prefer' if os.getuid() == 0 and not uidmap else 'never'}", + "--log-level=error", ] # fmt: skip if selinux: @@ -687,8 +688,7 @@ def generate_scratch_fs(config: Config) -> Iterator[Path]: fs = config.distribution.filesystem() extra = config.environment.get(f"SYSTEMD_REPART_MKFS_OPTIONS_{fs.upper()}", "") run( - [f"mkfs.{fs}", "-L", "scratch", *extra.split(), workdir(Path(scratch.name))], - stdout=subprocess.DEVNULL, + [f"mkfs.{fs}", "-L", "scratch", "-q", *extra.split(), workdir(Path(scratch.name))], sandbox=config.sandbox(options=["--bind", scratch.name, workdir(Path(scratch.name))]), ) yield Path(scratch.name) diff --git a/mkosi/tree.py b/mkosi/tree.py index 1bc5e6d83..c97dfe551 100644 --- a/mkosi/tree.py +++ b/mkosi/tree.py @@ -51,7 +51,7 @@ def make_tree( if use_subvolumes != ConfigFeature.disabled: result = run( - ["btrfs", "subvolume", "create", workdir(path, sandbox)], + ["btrfs", "--quiet", "subvolume", "create", workdir(path, sandbox)], sandbox=sandbox(options=["--bind", path.parent, workdir(path.parent, sandbox)]), check=use_subvolumes == ConfigFeature.enabled, ).returncode @@ -147,7 +147,7 @@ def copy_tree( dst.rmdir() result = run( - ["btrfs", "subvolume", "snapshot", workdir(src, sandbox), workdir(dst, sandbox)], + ["btrfs", "--quiet", "subvolume", "snapshot", workdir(src, sandbox), workdir(dst, sandbox)], check=use_subvolumes == ConfigFeature.enabled, sandbox=sandbox(options=options), ).returncode @@ -169,7 +169,7 @@ def rmtree(*paths: Path, sandbox: SandboxProtocol = nosandbox) -> None: # Silence and ignore failures since when not running as root, this will fail with a permission error # unless the btrfs filesystem is mounted with user_subvol_rm_allowed. run( - ["btrfs", "subvolume", "delete", *(workdir(p, sandbox) for p in subvolumes)], + ["btrfs", "--quiet", "subvolume", "delete", *(workdir(p, sandbox) for p in subvolumes)], check=False, sandbox=sandbox( options=flatten(("--bind", p.parent, workdir(p.parent, sandbox)) for p in subvolumes),