Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use initrd.target instead of custom conditions #50

Open
gdamjan opened this issue Apr 1, 2020 · 2 comments
Open

use initrd.target instead of custom conditions #50

gdamjan opened this issue Apr 1, 2020 · 2 comments

Comments

@gdamjan
Copy link

gdamjan commented Apr 1, 2020

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
Copy link
Collaborator

dvzrv commented Apr 1, 2020

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
Copy link
Collaborator

@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�[?7l�[2J�[0mSeaBIOS (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�[2J
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants