<div dir="ltr">> gpt-auto is not enough. I will want to set up pretty complex things<br><div>
like dm/crypto/etc.</div><div><br></div><div>Note that gpt-auto-generator will detect if the partition is a LUKS partition or has dm-verity, and will set up a `/dev/mapper/root` device automatically.</div><div>But I don't think more complex devicemapper setups are supported like dm-raid are supported.<br></div><div><span class="gmail-im"></span></div><div><span class="gmail-im"></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 20, 2020 at 1:58 PM Tobias Hunger <<a href="mailto:tobias.hunger@gmail.com">tobias.hunger@gmail.com</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">Hi Lennart,<br>
<br>
On Wed, May 20, 2020 at 12:01 PM Lennart Poettering<br>
<<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>> wrote:<br>
> On Mi, 20.05.20 00:12, Tobias Hunger (<a href="mailto:tobias.hunger@gmail.com" target="_blank">tobias.hunger@gmail.com</a>) wrote:<br>
> > The one thing that is frustrating is to get a machine image generated<br>
> > by my build server onto a new piece of hardware. So I wanted to see<br>
> > how far I can get with systemd-repart and co. to get this initial<br>
> > deployment to new hardware more automated after booting with the<br>
> > machine image from an USB stick.<br>
><br>
> So I eventually want to cover three usecases with systemd-repart:<br>
><br>
> 1. building OS images<br>
> 2. installing an OS from an installer medium onto a host medium<br>
> 3. adapting an OS images to the medium it has been dd'ed to on first<br>
>    boot<br>
><br>
> I think the 3rd usecase we already cover quite OK.<br>
<br>
Yeap.<br>
<br>
> To deliver the others, I want to add Encrypt= and Format= as<br>
> mentioned. To cover the 2nd usecase I then also want to provide<br>
> CopyBlocks= and CopyFiles=.<br>
<br>
I assume CopyBlocks= will just dd and so does not need a formatted partition?<br>
<br>
CopyFiles= obviously does.<br>
<br>
> The former would stream data into a<br>
> partition that is created on the block level. Primary usecase would be<br>
> to copy a partition 1:1 from the installer medium onto the host<br>
> medium. The latter would copy in a file tree on the fs level.<br>
<br>
What about things like create subvolumes on BTRFS? systemd-tmpfiles<br>
does support that.<br>
<br>
> Image builder tools such as "mkosi" could make use of this to be<br>
> simplified a bit: an invocation of "systemd-repart" will set up the<br>
> basic partition layout and file systems. "systemd-dissect --mount"<br>
> would then mount this, before dnf/apt/… are run. "bootctl --image=…"<br>
> would then install the boot loader (that switch doesn't exist yet, but<br>
> is on the todo list, too).<br>
<br>
Yes, I am considering to move my image generation over to<br>
systemd-repart as well.<br>
<br>
> This sounds for the perfect usecase for systemd-repart.<br>
><br>
> > With your extended systemd-repart: How can I reference these newly<br>
> > created filesystems in /etc/fstab?<br>
><br>
> Well, my thinking was to mostly rely on the "gpt-auto" logic,<br>
> i.e. that simply because they carry correct gpt type uuids systemd<br>
> would discover and find them.<br>
<br>
gpt-auto is not enough. I will want to set up pretty complex things<br>
like dm/crypto/etc.<br>
<br>
> > So how can I reliably reference filesystems newly created by<br>
> > systemd-repart in /etc/fstab?<br>
><br>
> So, if the gpt auto logic doesn't suffice, then probably labels. Or<br>
> you come up with your own UUIDs for the partitions.<br>
<br>
I opened a PR for custom partition UUIDs.<br>
<br>
> So I'd not discount labels. I think we should start supporting<br>
> specifier expansion in the label strings, so that we can generate them<br>
> somewhat automatically, derived from environment parameters.<br>
<br>
I will probably prefer UUIDs to uniquely identify something over labels:-)<br>
<br>
> > PS: Is systemd-tmpfiles run after mounts with --prefix=/mnt/point? Or<br>
> > how do you see people populating the newly created filesystems?<br>
><br>
> As indicated above with CopyBlocks= and CopyFiles= if this shall be<br>
> done during image creation. Copying in blocks and files is probably a<br>
> 20 line patch or so only (we have helpers for it in place anyway, we<br>
> just need to call them), and has again this nice benefit that we can<br>
> schedule it so that the partitions pop up fully populated and there's<br>
> no time where they are half initialized. This means you can abort an<br>
> installer any time and the disk will appear as it was before, only<br>
> when it comes to the very latest step the partitions suddenly pop into<br>
> existance, fully populated with whatever they shall contain.<br>
<br>
Nice, but what about btrfs subvolumes? I will probably end up needing those:-)<br>
<br>
Best Regards,<br>
Tobias<br>
<br>
> That said, I also want to add an --image= switch to "systemd-tmpfiles"<br>
> and "systemd-sysusers" so that you can run them easily offline too if<br>
> you want, just by pointing them to some disk image.<br>
<br>
Good idea!<br>
<br>
Best Regards,<br>
Tobias<br>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><span><p class="MsoNormal"><span style="font-size:9.5pt"> </span></p><p class="MsoNormal"><b><span style="font-size:9.5pt;color:rgb(204,204,204)">Zeta Project Germany GmbH  </span></b><span style="font-size:9.5pt;color:rgb(204,204,204)">l  <a href="https://maps.google.com/?q=Rosenthaler+Stra%C3%9Fe+40,%C2%A0+10178+Berlin,%C2%A0+Germany&entry=gmail&source=g" target="_blank"><span style="color:rgb(17,85,204)">Rosenthaler Straße 40, </span></a><a href="https://maps.google.com/?q=Rosenthaler+Stra%C3%9Fe+40,%C2%A0+10178+Berlin,%C2%A0+Germany&entry=gmail&source=g" target="_blank"><span style="color:rgb(17,85,204)">10178 Berlin, </span></a><a href="https://maps.google.com/?q=Rosenthaler+Stra%C3%9Fe+40,%C2%A0+10178+Berlin,%C2%A0+Germany&entry=gmail&source=g" target="_blank"><span style="color:rgb(17,85,204)">Germany</span></a></span><span style="font-size:9.5pt"></span></p><p class="MsoNormal"><span style="font-size:9.5pt"> </span></p><p class="MsoNormal"><span style="font-size:9.5pt;color:rgb(204,204,204)">Geschäftsführer/Managing Director: Morten J. Broegger, Dylan Riley</span><span style="font-size:9.5pt"></span></p><p class="MsoNormal"><span style="font-size:9.5pt;color:rgb(204,204,204)">HRB 149847 beim Handelsregister Charlottenburg, Berlin</span><span style="font-size:9.5pt"></span></p><p class="MsoNormal"><span style="font-size:9.5pt;color:rgb(204,204,204)">VAT-ID DE288748675</span></p></span></div></div>