random-archer / mkinitcpio-systemd-tool

Provisioning tool for systemd in initramfs (systemd-tool)
https://www.archlinux.org/packages/community/any/mkinitcpio-systemd-tool/
Other
113 stars 27 forks source link

use initrd.target instead of custom conditions #50

Open gdamjan opened 4 years ago

gdamjan commented 4 years ago

https://github.com/systemd/systemd/blob/v245/NEWS#L91

    * When systemd/PID 1 detects it is used in the initrd it will now boot
      into initrd.target rather than default.target by default. This should
      make it simpler to build initrds with systemd as for many cases the
      only difference between a host OS image and an initrd image now is
      the presence of the /etc/initrd-release file.
dvzrv commented 4 years ago

If I understand the bootup process correctly, then the sysinit.target is still the first thing we need to take care of (and this is probably one of the reasons, why this is currently still the default target).

However, it should indeed be tested, whether we can just stuff this into initrd.target instead, as e.g. the encrypted drives are not required for the initrd to function of course.

Andrei-Pozolotin commented 4 years ago

@gdamjan Дамјан:

Thank you for the idea, and:

  1. we now have (partially complete) support for qemu testing https://github.com/random-archer/mkinitcpio-systemd-tool/tree/master/tool/image

  2. at least with the following test test/cryptsetup/verify.py one can quickly produce initrd image inside project folder /boot:

    [project git repository]/boot

    and the command line for running that image inside qemu manually:

    sudo qemu-system-x86_64 -cpu host -enable-kvm  -runas user0 -kernel [repo]/boot/vmlinuz-linux -initrd [repo]/boot/initramfs-linux.img -m 512 -smp 2 -drive if=virtio,cache=none,format=raw,file=[repo]/tool/module/sysroot.disk -append 'edd=off console=ttyS0 TERM=xterm SYSTEMD_COLORS=0' -nographic -serial mon:stdio -monitor telnet:127.0.0.1:51234,server,nowait 

for example, console output form the boot sequence, secret> at the end means all is good :-)

``` ### initrd image: qemu: activate qemu-system-x86_64: no process found ### booter start : test-cryptsetup-boot c[?7lSeaBIOS (version ?-20191223_100556-anatol) iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+1FF927C0+1FEF27C0 CA00 Press Ctrl-B to configure iPXE (PCI 00:03.0)... Booting from ROM... c[?7l Welcome to Linux! [ OK ] Created slice system-systemd\x2dcryptsetup.slice. [ OK ] Started Initrd Cryptsetup Path. [ OK ] Reached target Initrd Root Device. [ OK ] Reached target Initrd Root File System. [ OK ] Reached target Paths. [ OK ] Reached target Slices. [ OK ] Reached target Swap. [ OK ] Reached target Timers. [ OK ] Listening on Journal Audit Socket. [ OK ] Listening on Journal Socket (/dev/log). [ OK ] Listening on Journal Socket. [ OK ] Listening on udev Control Socket. [ OK ] Listening on udev Kernel Socket. [ OK ] Reached target Sockets. Starting Initrd Debug Progs Service... Starting Reload Configuration from the Real Root... Starting Create list of static device nodes for the current kernel... Starting Journal Service... Starting Load Kernel Modules... Starting udev Coldplug all Devices... [ OK ] Started Initrd Debug Progs Service. [ OK ] Started Create list of static device nodes for the current kernel. Starting Create Static Device Nodes in /dev... [ OK ] Started Load Kernel Modules. [ OK ] Started Create Static Device Nodes in /dev. Starting udev Kernel Device Manager... [ OK ] Started Reload Configuration from the Real Root. [ OK ] Reached target Initrd File Systems. [ OK ] Started udev Coldplug all Devices. [ OK ] Started Journal Service. [ OK ] Started udev Kernel Device Manager. [ OK ] Found device /dev/disk/by-uuid/00000000-feed-face-0000-added0facade. Starting Cryptography Setup for booter_root... secret> ### initrd image: qemu: deactivate qemu-system-x86_64: terminating on signal 15 from pid 23911 () ```
  1. please test your proposal in qemu, and send a PR which shows what works, and what not.