[systemd-devel] CopyBlocks= from initrd systemd-repart

Mikko Rapeli mikko.rapeli at linaro.org
Fri Aug 23 09:45:32 UTC 2024


Hi,

On Fri, Aug 23, 2024 at 04:28:24PM +0700, Renjaya Raga Zenta wrote:
> Hi,
> 
> I want to duplicate partition 1 and partition 2 using systemd-repart.
> This is for SBC, I use mkosi to create the OS image.
> 
> By default, it needs 2 partitions
> 
> 1. Boot partition: FAT32 used by 1st stage bootloader
> 2. Root partition: EXT4
> 
> This works fine.
> 
> Then I want to create "recovery mode", it needs 4 partition
> 
> 1. Default Boot partition
> 2. Default Root partition
> 3. Secondary Boot partition
> 4. Secondary Root partition
> 
> Partition [3] should be copied from partition [1] and partition [4] should
> be copied from partition [2].
> 
> I've configured the systemd-repart to run in initrd, I've also configured
> udev rules to create symlink to device node:
> 
> 1. /dev/gpt-part-boot -> /dev/nvme0n1p1
> 2. /dev/gpt-part-root -> /dev/nvme0n1p2 (mounted on /sysroot,
> systemd-repart need this path because it's hardcoded in the source code)
> 
> But when I specify CopyBlocks=/dev/gpt-part-boot in the repart.d conf file,
> it failed with this error message:
> "Failed to open '/dev/gpt-part-boot': No such file or directory"

I've had a bit similar issues. I think systemd-repart or generator services
which run after it provide /dev/gpt-part*. Thus systemd-repart can't use
these yet. I think you need adjust systemd-repart dependencies to wait for
the device nodes from udev.

Cheers,

-Mikko

> The systemd-repart failed in initrd, but then it will run again after
> switch-root, and it works fine.
> 
> Any hints? I want the systemd-repart to run fine in initrd, not after
> switch-root.
> 
> Thank you.


More information about the systemd-devel mailing list