From 20d5eb99c11ea166e39ac11a558afe23221d6f59 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 14 Dec 2018 13:54:07 +0100 Subject: [PATCH] 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. --- mkosi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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") -- 2.47.2