Re: CopyBlocks= from initrd systemd-repart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, I've just found that this use case isn't supported.

"Copying from block device node is not permitted in --image=/--root= mode, refusing."

I guess I should use Format= and CopyFiles= instead.


On Fri, Aug 23, 2024 at 5:44 PM Renjaya Raga Zenta <ragazenta@xxxxxxxxx> wrote:
I use the following drop-in, but still error: "No such file or directory"

```
[Unit]
After=systemd-tmpfiles-setup-dev.service systemd-udevd.service
After=sysroot.mount sysboot.mount
ConditionDirectoryNotEmpty=|/sysroot/usr/lib/repart.d

[Service]
ExecStartPre=/lib/systemd/repart-pre
```

In repart-pre, I checked /dev/gpt-part-boot and /dev/gpt-part-root actually exist.


On Fri, Aug 23, 2024 at 4:45 PM Mikko Rapeli <mikko.rapeli@xxxxxxxxxx> wrote:
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.

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux