From 0e12abc16d456e1ae33678f3f22cf05c7343c300 Mon Sep 17 00:00:00 2001 From: Shengjing Zhu Date: Wed, 22 Jan 2020 12:11:29 +0800 Subject: [PATCH] Fix mount squashfs on kernel 5.4 kernel 5.4 failed to mount squashfs [764311.251432] squashfs: Unknown parameter 'discard' --- mkosi | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mkosi b/mkosi index f0d51204f..7ce62befe 100755 --- a/mkosi +++ b/mkosi @@ -941,18 +941,22 @@ def prepare_srv(args: CommandLineArguments, dev: Optional[str], cached: bool) -> def mount_loop(args: CommandLineArguments, dev: str, where: str, read_only: bool = False) -> None: os.makedirs(where, 0o755, True) - options = "-odiscard" + options = [] + if not args.output_format.is_squashfs(): + options.append("discard") if args.compress and args.output_format == OutputFormat.gpt_btrfs: if isinstance(args.compress, bool): - options += ",compress" + options.append("compress") else: - options += f",compress={args.compress}" + options.append(f",compress={args.compress}") if read_only: - options += ",ro" + options.append("ro") + + options_arg = "-o" + ",".join(options) if options else "" - run(["mount", "-n", dev, where, options], check=True) + run(["mount", "-n", dev, where, options_arg], check=True) def mount_bind(what: str, where: str) -> None: -- 2.47.2