[prev in list] [next in list] [prev in thread] [next in thread] 

List:       systemd-devel
Subject:    Re: [systemd-devel] USB installer for mkosi
From:       Daan De Meyer <daan.j.demeyer () gmail ! com>
Date:       2023-08-18 23:22:53
Message-ID: CAO8sHckSjK57DzfRf_96KS+S3cUVGoZQ7s_X1wmAhB3D=A-bLw () mail ! gmail ! com
[Download RAW message or body]

Unfortunately there's no ready made answer yet here. We're busy designing
and implementing a solution for these problems.
https://github.com/systemd/systemd/pull/27792 has more details.

Cheers,

Daan

On Fri, 18 Aug 2023, 19:44 Nils Kattenbeck, <nilskemail@gmail.com> wrote:

> Hi,
> 
> currently I am building a minimalistic Linux image using mkosi which
> should be installed on bare-metal hardware.
> For the installation I am trying to create a USB-stick installer which
> simply installs the resulting image on the hardware.
> 
> First and foremost:
> Does someone maybe know of an existing tool which generates such a USB
> installer?
> For now I have found the installer script[1] from Yocto, and FAI
> (Fully automatic installation)[2].
> I would like to avoid using Yocto and the script seems to also perform
> partitioning etc. which I do not need as mkosi already generates a
> ready-to-use raw disk image with partitions set up.
> FAI on the other hand seems to focus on network installs and prefers
> to build its own images instead of using an arbitrary .raw/ISOs.
> 
> So I fear that I will have to write my own installer...
> I do not require fancy GUI shenanigans; a simple CLI application
> prompting for the destination disk should suffice.
> 
> Based on my understanding the primary steps are `cp /dev/usb-stick
> /dev/target-disk` (or dd for the old fashioned), followed by a `parted
> --script --fix /dev/target-disk print` to resolve GPT warnings due to
> the header not being at the end when the disk is larger than the USB
> stick.
> Is it possible to replace the second step with `systemd-parted`.
> Especially given that mkosi v15 now uses it for itself, this would
> likely be a lot cleaner than invoking parted.
> 
> The major problem I am facing with that approach is how do I know
> whether I am booting from a USB stick or already from the final disk
> drive.
> One technique which comes to mind would be to create two images, one
> of which will be placed into the mkosi.extra/ directory of the other.
> This way I could have one auto-start the install script whereas the
> other image would be completely free of that logic.
> Am I missing a more obvious way to perform this?
> 
> Any help would be greatly appreciated!
> Kind regard, Nils
> 
> [1]
> https://github.com/yoctoproject/poky/blob/13734bb520732882a95da7ee6efe1e5b98568acc/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb
>  [2] https://fai-project.org/
> 


[Attachment #3 (text/html)]

<div dir="auto">Unfortunately there&#39;s no ready made answer yet here. We&#39;re \
busy designing and implementing a solution for these problems. <a \
href="https://github.com/systemd/systemd/pull/27792">https://github.com/systemd/systemd/pull/27792</a> \
has more details.<div dir="auto"><br></div><div dir="auto">Cheers,</div><div \
dir="auto"><br></div><div dir="auto">Daan</div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 18 Aug 2023, 19:44 Nils \
Kattenbeck, &lt;<a href="mailto:nilskemail@gmail.com">nilskemail@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br> <br>
currently I am building a minimalistic Linux image using mkosi which<br>
should be installed on bare-metal hardware.<br>
For the installation I am trying to create a USB-stick installer which<br>
simply installs the resulting image on the hardware.<br>
<br>
First and foremost:<br>
Does someone maybe know of an existing tool which generates such a USB<br>
installer?<br>
For now I have found the installer script[1] from Yocto, and FAI<br>
(Fully automatic installation)[2].<br>
I would like to avoid using Yocto and the script seems to also perform<br>
partitioning etc. which I do not need as mkosi already generates a<br>
ready-to-use raw disk image with partitions set up.<br>
FAI on the other hand seems to focus on network installs and prefers<br>
to build its own images instead of using an arbitrary .raw/ISOs.<br>
<br>
So I fear that I will have to write my own installer...<br>
I do not require fancy GUI shenanigans; a simple CLI application<br>
prompting for the destination disk should suffice.<br>
<br>
Based on my understanding the primary steps are `cp /dev/usb-stick<br>
/dev/target-disk` (or dd for the old fashioned), followed by a `parted<br>
--script --fix /dev/target-disk print` to resolve GPT warnings due to<br>
the header not being at the end when the disk is larger than the USB<br>
stick.<br>
Is it possible to replace the second step with `systemd-parted`.<br>
Especially given that mkosi v15 now uses it for itself, this would<br>
likely be a lot cleaner than invoking parted.<br>
<br>
The major problem I am facing with that approach is how do I know<br>
whether I am booting from a USB stick or already from the final disk<br>
drive.<br>
One technique which comes to mind would be to create two images, one<br>
of which will be placed into the mkosi.extra/ directory of the other.<br>
This way I could have one auto-start the install script whereas the<br>
other image would be completely free of that logic.<br>
Am I missing a more obvious way to perform this?<br>
<br>
Any help would be greatly appreciated!<br>
Kind regard, Nils<br>
<br>
[1] <a href="https://github.com/yoctoproject/poky/blob/13734bb520732882a95da7ee6efe1e5b98568acc/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb" \
rel="noreferrer noreferrer" \
target="_blank">https://github.com/yoctoproject/poky/blob/13734bb520732882a95da7ee6efe \
1e5b98568acc/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb</a><br>
 [2] <a href="https://fai-project.org/" rel="noreferrer noreferrer" \
target="_blank">https://fai-project.org/</a><br> </blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic