From: Zbigniew Jędrzejewski-Szmek Date: Fri, 14 Dec 2018 12:54:07 +0000 (+0100) Subject: Do not allow dd to create the output file X-Git-Tag: v6~123^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F307%2Fhead;p=thirdparty%2Fmkosi.git Do not allow dd to create the output file Something went wrong on my machine and /dev/loop8p2 was not present, even though loop8 and loop8p1 were. (I think the loopback device was mounted somewhere and the kernel wouldn't reread the partition table.) Since we are running as root, we can easily create a new file in /dev. Let's avoid this. --- diff --git a/mkosi b/mkosi index fdb900b01..bb1d152f2 100755 --- a/mkosi +++ b/mkosi @@ -2490,8 +2490,9 @@ def insert_partition(args: CommandLineArguments, else: dev = None + path = dev if dev is not None else partition(loopdev, partno) try: - run(["dd", "if=" + blob.name, "of=" + (dev if dev is not None else partition(loopdev, partno))], check=True) + run(['dd', f'if={blob.name}', f'of={path}', 'conv=nocreat'], check=True) finally: luks_close(dev, "Closing LUKS root partition")