<div dir="ltr"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 5, 2023 at 11:09 AM Lennart Poettering <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mo, 05.06.23 10:41, Valentin David (<a href="mailto:valentin.david@canonical.com" target="_blank">valentin.david@canonical.com</a>) wrote:<br>
<br>
> On Mon, Jun 5, 2023 at 9:56 AM Lennart Poettering <<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>><br>
> wrote:<br>
><br>
> > On So, 04.06.23 14:25, Valentin David (<a href="mailto:valentin.david@canonical.com" target="_blank">valentin.david@canonical.com</a>)<br>
> > wrote:<br>
> ><br>
> > > I have been trying to create a root partition from initrd with<br>
> > > systemd-repart. The repart.d file for this partition is as follow:<br>
> > ><br>
> > > [Partition]<br>
> > > Type=root<br>
> > > Label=root<br>
> > > Encrypt=tpm2<br>
> > > Format=ext4<br>
> > > FactoryReset=yes<br>
> > ><br>
> > > I am just using systemd-repart.service in initrd, without modification<br>
> > > (that is, it finds the disk from /sysusr/usr). Even though this is<br>
> > working,<br>
> > > the problem I have is that it takes a very long time for the partition to<br>
> > > be created. Looking at the logs, it spends most of time in the<br>
> > > reencryption.<br>
> ><br>
> > reencryption? We don't do any reencrytion really. i.e. we do not<br>
> > actually support anything like "cryptsetup reencrypt" at all. All we<br>
> > do is the equivalent of "cryptsetup luksFormat". Are you suggesting<br>
> > that repart is slower at formatting a block device via LUKS than<br>
> > invoking cryptsetup directly would be? I'd find that very surprising...<br>
> ><br>
><br>
> This is what it looks like in src/partition/repart.c. Function<br>
> partition_encrypt calls sym_crypt_reencrypt_init_by_passphrase and<br>
> then sym_crypt_reencrypt.<br>
> And make_filesystem is called before partition_encrypt. So it must<br>
> reencrypt since mkfs was called before.<br>
<br>
Oh, fuck, yeah, Daan added that.<br>
<br>
This is a bug really.<br></blockquote><div><br></div><div><div>I will open an issue on github then.</div></div><br></div></div></div>