OSInside / kiwi-descriptions

Provides a collection of kiwi image descriptions
GNU General Public License v3.0
64 stars 40 forks source link

No kiwi-boot-requires for tumbleweed #78

Closed luizluca closed 4 years ago

luizluca commented 4 years ago

Hello,

I recently notice that my LivePXE kiwi project in OBS was failed with "nothing provides kiwi-boot:netboot" for Tumbleweed (while it still works for Leap). It should be provided by kiwi-boot-requires.rpm which is not built anymore for Tumbleweed (I guess) since https://github.com/OSInside/kiwi-descriptions/commit/4991a6f848aec1965cbf01f73f68d86edb20f3ca .

Is it expected to not be able to build a netboot image for Tumbleweed?

schaefi commented 4 years ago

Hi,

the netboot code is from the legacy kiwi version and was not ported over to the next generation kiwi. For remote image deployment we are using a different concept and would like to encourage people to use this system which uses much less code in the dracut initrd and is based on remote disk image deployment rather than filesystem image deployment which requires to have a lot of initrd code (netboot) to run. For details see:

And there also the "Network Deployment" method.

We understand that existing infrastructure that is based on netboot cannot be easily switched to another concept. This is the reason why netboot descriptions exists for older distributions but not for newer or the rolling releases (e.g TW)

As we no longer actively develop the netboot code it's still possible for you to make use of it and adapt and/or maintain the code according to your project in your space. For this purpose we have setup an integration test and a package that only provides that netboot code here:

You could take/branch the package and adapt as you need to make it work on TW. The netboot code itself will be on your responsibility but the feature that kiwi will be able to use it to build an image you can always expect us to keep and also to stay responsible for. That's why this integration test exists.

On a personal note: All major linux distros has moved their initrd system to dracut. The feature in kiwi to allow custom initrds will stay but I know it will be hard for you to keep this concept up and running because of the disconnect of that initrd with the standard used by the distributions. If you have a chance to switch the concept it will be a bit more work at the beginning but will pay off on the long run.

Hope all that makes sense to you ?

Let me know which direction you go with this.

Thanks

luizluca commented 4 years ago

I generally avoid strategies that are legacy. I'll try to dig into docs to see where my usecase fits.

I'm building a LivePXE image (LiveDVD like) composed of kernel and initrd for PXE and squashfs filesystem, exported using NDB.

leap15.2.kiwi
  <preferences>
    <type image="pxe" filesystem="squashfs" boot="netboot/suse-leap15.0"/>
/srv/tftpboot/KIWI/config.default:
#/bin/sh
UNIONFS_CONFIG=tmpfs,nbd,overlay
LANG=pt_BR.utf8

It was a pretty straightforward solution. The image was always updated in our local OBS instance. It just needed a simple test and it was ready for deploy. That LivePXE saved hundreds of working hours for me and my coworkers when anything break in our workstation. It helped me to debug many OpenSUSE issues, specially in Tumbleweed, as it was easy to boot a Tumbleweed or Leap image equivalent to my system and try it with clean confs.

I have to admit that most of kiwi internal is unknown for me. I simply tried some example configs and check the output scripts/images until I got what I needed. It looks like I need something like image=”kis” and hope something at somepoint in kis/dracut will allow me to mount a squashfs through nbd and boot it.

schaefi commented 4 years ago

It was a pretty straightforward solution. The image was always updated in our local OBS instance. It just needed a simple test >and it was ready for deploy. That LivePXE saved hundreds of working hours for me and my coworkers when anything break in >our workstation. It helped me to debug many OpenSUSE issues, specially in Tumbleweed, as it was easy to boot a >Tumbleweed or Leap image equivalent to my system and try it with clean confs.

I understand and you can also keep this system. The part that moves into your hands would be "netboot/suse-leap15.0" which should be provided as an extra package similar as we provide it in the integration test from here:

The code provided by the package would be on your side and the current way of booting via NBD is already implemented as you know.

I'm building a LivePXE image (LiveDVD like) composed of kernel and initrd for PXE and squashfs filesystem, exported using NDB

This use case could also be achieved without an extra kiwi initrd since dracut supports nbdroot. Consider the following setup (untested)

1) Change your kiwi type as follows:

```xml
<type image="kis" filesystem="squashfs"/>
```

This will produce the same set of images as you are used to with the pxe type but creates a dracut initrd and not an
extra netboot kiwi initrd

2) Make sure the dracut initrd contains the nbd dracut module

Create an overlay file in your image description ```root/etc/dracut.conf.d/nbd.conf``` with the content

```
add_dracutmodules+=" nbd "
```

Please note, spaces in the dracutmodules settings are mandatory. Also the .conf extension on the filename is mandatory for dracut

3) Once you have that set of images the nbd setup on your server stays the same. For booting with nbd from dracut you need to pass:

   root=nbd:ip:port:fstype

In the kernel cmdline at boot (pxe setup, I think you know all this). Documentation on dracut nbd can be found here:

https://man7.org/linux/man-pages/man7/dracut.cmdline.7.html

search for NBD

I understand the way we offered in kiwi with netboot is nice under certain conditions but it's not what the upstream community uses. As I tried to explain everything moved/is moving to dracut and lots of the functionality of netboot is already available in dracut as well. I consider the custom kiwi initrd feature as last resort when no dracut implementation exists and for some reason no dracut module could be developed.

I haven't tetest the nbd setup as described above and would be happy if you can keep me posted.

Thanks much

luizluca commented 4 years ago

It's progressing nicely...

First, OBS does not like the kis image as it requires "kiwi-image:kis" and nothing provices it yet. I simply replaced it with: "Substitute: kiwi-image:kis kiwi-image:pxe" but it should be something provided by a kiwi package in the future.

I also added those new packages: dracut-kiwi-overlay, dracut-kiwi-oem-repart, dracut-kiwi-oem-dump, nbd.

add_dracutmodules+=" nbd " does not seem to be needed as it it included by default. The less I need to touch rootfs, the better it is.

root=nbd:ip:port:fstype does work but it gives me a read-only FS. I wanted an overlayfs that uses the squashfs as ro and ram as rw. The last thing I tried was a blind "root=live:nbd:ip:port:fstype", which didn't work.

I'll check tomorrow what dracut-kiwi-live and dracut-kiwi-overlay can provide me. There is also this https://github.com/dracutdevs/dracut/pull/447

schaefi commented 4 years ago

First, OBS does not like the kis image as it requires "kiwi-image:kis" and nothing provices it yet.

yes you are right. We are at the moment working on this. A PR that needs still some work is open to cover this part on the kiwi git repo

I also added those new packages: dracut-kiwi-overlay, dracut-kiwi-oem-repart, dracut-kiwi-oem-dump

Those you only need if you build an oem image. But you are building a kis (kernel, initrd, system) image

root=nbd:ip:port:fstype does work but it gives me a read-only FS

Ah ok, and no support for an overlay in there. I understand

I'll check tomorrow what dracut-kiwi-live and dracut-kiwi-overlay can provide me.

So with dracut-kiwi-overlay you can create the system you are after but there is probably an issue. So let me explain the background first. If you change your image type to the following:

<type image="oem" filesystem="ext3" overlayroot="true">

Then this creates you a disk image with a partition table that has the root as squashfs on one partition and a reserved write partition (as ext3 in this case). The dracut-kiwi-overlay module contains the code to bring this together using overlayfs at boot time. The deployment of this image however needs some storage on the target, which can be either a disk or ram space. The deployment can also happen via pxe but it deploys the complete image through the network on the target.

I think in your use case you want the root of the system to be a network block device and the write goes to ram. That I think requires a little change in the dracut-kiwi-overlay code

schaefi commented 4 years ago

Let me check if we can come up with a patch for the dracut-kiwi-overlay module...

luizluca commented 4 years ago

So I guess dmsquash-live, which is already available, might be my next try for now

schaefi commented 4 years ago

So I guess dmsquash-live, which is already available, might be my next try for now

I don't think it will satisfy your needs. Looking at https://man7.org/linux/man-pages/man7/dracut.cmdline.7.html I don't think there is a mode that allows the overlay you are after. I started to add a bit of code to the kiwi-overlay module which I think can be used to serve your use case with only a few more lines. See the referenced branch above. I'll come up with a PR once my tests showed that this works. We also need to adapt the documentation as part of the upcoming PR

stay tuned... :)

schaefi commented 4 years ago

Please note I don't plan to support old-style nbd config, only the new style using export names. I guess that's ok for you ?

luizluca commented 4 years ago

I don't think it will satisfy your needs. Looking at https://man7.org/linux/man-pages/man7/dracut.cmdline.7.html I don't think there is a mode that allows the overlay you are after. I started to add a bit of code to the kiwi-overlay module which I think can be used to serve your use case with only a few more lines. See the referenced branch above. I'll come up with a PR once my tests showed that this works. We also need to adapt the documentation as part of the upcoming PR

It takes some time to rebuild and test but my current test is:

netroot=nbd:ip:port:fstype root=live:/dev/nbd0

It looks like netroot allows me to have a second root defined. I tested it but I didn't add the module for live. So, it created the nbd0 device but it failed to build the overlay. When I got it working, I discovered that nbd (95nbd) runs after live(90dmsquash-live). But it looks like it would work. I just need to figure out how to reorder dracut module the less intrusive possible way.

Please note I don't plan to support old-style nbd config, only the new style using export names. I guess that's ok for you ?

I use export names from the moment it was available to nbd. And the use or port number is going to be deprecated anyway.

luizluca commented 4 years ago

The command line almost worked:

netroot=nbd:ip:port:fstype root=live:/dev/nbd0

But dmsquash-live-root cannot deal with dmsquash-live-root /dev/nbd0 because it assumes /dev/nbd0 is a device where there is a FS with a squashfs file, not that /dev/nbd0 is already an squashfs image.

A simple patch like this https://github.com/luizluca/dracut/commit/69551271f40d0987997c65f41fe2019294020e4c is all we need. However, I still get an error starting nbd0.service with "nbd0 already in use" in dmesg. Maybe it is starting to soon or it is a conflict between 95nbd generator with dmsquash-live-root generator as both defines a mount to /sysroot.

After /sysroot failed, I can get an emergency shell (rd.shell). /dev/nbd0 is indeed not connected but I can start it manually with systemctl start nbd0.service (service created by systemd-run). After that, I just kill the already running dmsquash-live-root (from systemctl status dracut-initqueue), it shows me again "nbd0 already in use" and the system boots normally, even with X11.

I thing I need somehow start nbd0.service after network is up but before dmsquash-live-root script runs. Maybe a better nbd0.service definition could help. I'm still getting my way through dracut. I'll look into a different alternative expanding 90livenet to support nbd (but without downloading it) or cloning it in a new live.

schaefi commented 4 years ago

The patch to the kiwi overlay module worked for me :smiley:

root=overlay:nbd=nbd0:192.168.178.34:export

I'll write up the documentation and send a pull request

netroot=nbd:ip:port:fstype root=live:/dev/nbd0

I had no luck in getting that to run in the past. The following is unrelated but for netbooting live images kiwi supports the AOE interface. See the following documentation: https://osinside.github.io/kiwi/working_with_images/network_live_iso_boot.html

luizluca commented 4 years ago

Great! I'll try that and report back. However, it would be nice to have a way to boot nbd0 overlay using dracut own modules as this is a problem for thin clients, not a kiwi specific one.

schaefi commented 4 years ago

it would be nice to have a way to boot nbd0 overlay using dracut own modules as this is a problem for thin clients, not a kiwi specific one.

yes I agree, it looks like the order is not set right when using the nbd module together with dmsquash. Maybe worth reporting upstream

luizluca commented 4 years ago

I got it. nbd-client was lauched in parallel (systemd-run) and dmsquash-live was locking /dev/nbd0 (losetup) before it was connected. I created a PR for using dracut overlay+nbd: https://github.com/dracutdevs/dracut/pull/967

However, I'm still not sure how dracut orders nbd and dmsquash-live calls. It worked but maybe by luck.

I also applied OSInside/kiwi#1617 but I couldn't use it. It enter an infinite loops. It looks like it keeps restarting NetworkManager. It gets network conf but nothing else happens. These are some logs from serial:

[    8.279958] dracut-cmdline[219]: ///lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh@50(source): info 'root was overlay:nbd=10.9.1.151:opensuse-tumbleweed-202, is now block:/dev/10.9.1.151'
[    8.281675] dracut-cmdline[219]: //lib/dracut-lib.sh@83(info): echo 'root was overlay:nbd=10.9.1.151:opensuse-tumbleweed-202, is now block:/dev/10.9.1.151'
[    8.282488] dracut-cmdline[219]: ///lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh@53(source): '[' -z block:/dev/10.9.1.151 ']'
[    8.283247] dracut-cmdline[219]: ///lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh@55(source): wait_for_dev -n /dev/10.9.1.151
...
[   26.629427] dracut-initqueue[484]: //lib/dracut-lib.sh@431(source_all): '[' -e '//lib/dracut/hooks/initqueue/online/*.sh' ']'
[   26.629427] dracut-initqueue[484]: //lib/dracut/hooks/initqueue/settled/99-nm-run.sh@27(): /sbin/netroot enp0s3
[   26.629428] dracut-initqueue[777]: ++ hookdir=/lib/dracut/hooks
[   26.635288] dracut-initqueue[777]: ++ export hookdir
[   26.635746] dracut-initqueue[777]: ++ command -v findmnt
[   26.636613] dracut-initqueue[777]: ++ command -v pidof
[   26.637123] dracut-initqueue[777]: ++ setmemdebug
[   26.637786] dracut-initqueue[777]: ++ '[' -z 0 ']'
[   26.638220] dracut-initqueue[777]: + command -v setup_net
[   26.638699] dracut-initqueue[777]: + . /lib/net-lib.sh
[   26.639168] dracut-initqueue[777]: ++ type hostname
[   26.640430] dracut-initqueue[777]: + '[' -z enp0s3 ']'
[   26.641136] dracut-initqueue[777]: + '[' -d /sysroot/proc ']'
[   26.641661] dracut-initqueue[777]: + '[' -z '' ']'
[   26.642173] dracut-initqueue[778]: ++ getarg netroot=
[   26.643154] dracut-initqueue[778]: ++ debug_off
[   26.643605] dracut-initqueue[778]: ++ set +x
[   26.644024] dracut-initqueue[778]: ++ return 1
[   26.644547] dracut-initqueue[777]: + netroot=
[   26.644987] dracut-initqueue[777]: + '[' -z '' ']'
[   26.645366] dracut-initqueue[777]: + exit 1
...
[   96.742602] dracut-initqueue[484]: //lib/dracut/hooks/initqueue/settled/99-nm-run.sh@20(): for _i in /sys/class/net/*
[   96.743285] dracut-initqueue[1689]: ///lib/dracut/hooks/initqueue/settled/99-nm-run.sh@22(): cat /sys/class/net/lo/ifindex
[   96.744096] dracut-initqueue[484]: //lib/dracut/hooks/initqueue/settled/99-nm-run.sh@22(): state=/run/NetworkManager/devices/1
[   96.744719] dracut-initqueue[484]: //lib/dracut/hooks/initqueue/settled/99-nm-run.sh@23(): grep -q connection-uuid= /run/NetworkManager/devices/1
[   96.746233] dracut-initqueue[484]: //lib/dracut/hooks/initqueue/settled/99-nm-run.sh@23(): continue
[   96.746800] dracut-initqueue[484]: /bin/dracut-initqueue@45(): check_finished
[   96.747212] dracut-initqueue[484]: /lib/dracut-lib.sh@444(check_finished): local f
[   96.747647] dracut-initqueue[484]: /lib/dracut-lib.sh@445(check_finished): for f in $hookdir/initqueue/finished/*.sh
[   96.758574] dracut-initqueue[484]: /lib/dracut-lib.sh@446(check_finished): '[' '/lib/dracut/hooks/initqueue/finished/devexists-\x2fdev\x2f10.9.1.151.sh' = '/lib/dracut/hooks/initqueue/finished/*.sh' ']'
[   96.759437] dracut-initqueue[484]: /lib/dracut-lib.sh@447(check_finished): '[' -e '/lib/dracut/hooks/initqueue/finished/devexists-\x2fdev\x2f10.9.1.151.sh' ']'
[   96.760237] dracut-initqueue[1691]: /lib/dracut-lib.sh@447(check_finished): . '/lib/dracut/hooks/initqueue/finished/devexists-\x2fdev\x2f10.9.1.151.sh'
[   96.770574] dracut-initqueue[1691]: //lib/dracut/hooks/initqueue/finished/devexists-\x2fdev\x2f10.9.1.151.sh@1(source): '[' -e /dev/10.9.1.151 ']'
[   96.771314] dracut-initqueue[484]: /lib/dracut-lib.sh@447(check_finished): return 1
[   96.782577] dracut-initqueue[484]: /bin/dracut-initqueue@48(): udevadm settle --timeout=0
[   96.783031] dracut-initqueue[484]: /bin/dracut-initqueue@51(): sleep 0.5
[  147.242556] dracut-initqueue[484]: /bin/dracut-initqueue@53(): for i in /run/systemd/ask-password/ask.*
[  147.244044] dracut-initqueue[484]: /bin/dracut-initqueue@54(): '[' -e '/run/systemd/ask-password/ask.*' ']'
[  147.246950] dracut-initqueue[484]: /bin/dracut-initqueue@57(): '[' 86 -gt 240 ']'
[  147.247675] dracut-initqueue[484]: /bin/dracut-initqueue@74(): main_loop=87
[  147.248735] dracut-initqueue[484]: /bin/dracut-initqueue@75(): '[' 87 -gt 360 ']'
[  147.260521] dracut-initqueue[484]: /bin/dracut-initqueue@22(): :
[  147.274366] dracut-initqueue[484]: /bin/dracut-initqueue@24(): check_finished
[  147.274839] dracut-initqueue[484]: /lib/dracut-lib.sh@444(check_finished): local f
...

I just see main_loop= being incremented and I never saw nbd-client being mentioned.

Also, when kiwi-overlay mod is added but I use my nbd+dmsquash-live cmdline, it fails in dracut-pre-mount after some lsblk errors and a failed mount. It returns "Failed to mount overlay(ro) root filesystem". It might need some checks to skip cases where root= does not follow one of the supported format.

Update: My mistake. I missed the device name:

Maybe it could do some some checks to catch this kind of errors early. Also, I'm not sure if the user should define the device name. It's a boot process. No nbdX are in use.

schaefi commented 4 years ago

Update: My mistake. I missed the device name:

I was just about to write that :) so you found it yourself.

Maybe it could do some some checks to catch this kind of errors early

maybe we just use nbd0 as you suggested there should be no other user of it at this time. I'll change it in the PR

So just to put me right, it worked for you after you fixed root= right ?

I got it. nbd-client was lauched in parallel (systemd-run) and dmsquash-live was locking /dev/nbd0 (losetup) before it was connected. I created a PR for using dracut overlay+nbd: dracutdevs/dracut#967 However, I'm still not sure how dracut orders nbd and dmsquash-live calls. It worked but maybe by luck.

not sure if they will take it. Actually a dracut env always has systemd running except if you told it not to do so. So using systemd is considered the default and the process control via systemd-run is probably wanted in this code. Your patch deleted parts of it and directly invokes nbd-client. There is nothing wrong with it (I do it the same) but maybe they will decline because of the change in behavior.

Regarding the serialization between the dmsquash module and the nbdroot module I think you are missing something like this in the dmsquash parse code:

wait_for_dev -n "${root#block:}"

This should result into wait_for_dev -n /dev/nbdX and I would expect the nbdroot code to provide the device and update root accordingly. If this is the case the dmsquash code has a chance to wait for the device and continue to work with it when it is present. It's the way how I serialize the kiwi dracut modules through the device presence and dracut has this nice wait_for_dev which is what you see with the initqueue sequence also controlled through systemd in the dracut initrd.

Usually if things fall apart you end up in a very long loop there :)

I agree with you there might be still a race condition in the two modules nbdroot and dmsquash

Thanks

schaefi commented 4 years ago

I've updated the open PR. It should work for you now with:

root=overlay:nbd=10.9.1.151:opensuse-tumbleweed-202

I use nbd0 now statically. If we need to have this customized we can come up with an rd.overlay.nbd.node option or something.

luizluca commented 4 years ago

So just to put me right, it worked for you after you fixed root= right ?

Yes

I use nbd0 now statically. If we need to have this customized we can come up with an rd.overlay.nbd.node option or something.

I also worked for me :-). However, it is still breaking when the module is added and is root=live:xxx. I might be better to restrict kiwi-overlay module for only when root syntax really matters for it.

not sure if they will take it. Actually a dracut env always has systemd running except if you told it not to do so. So using systemd is considered the default and the process control via systemd-run is probably wanted in this code. Your patch deleted parts of it and directly invokes nbd-client. There is nothing wrong with it (I do it the same) but maybe they will decline because of the change in behavior.

systemd-run was used without providing or requiring anything. I was as good as ( cmd )&. I didn't remove any other systemd call. dracut seems to be in the middle of using and not using systemd.

Regarding the serialization between the dmsquash module and the nbdroot module I think you are missing something like this in the dmsquash parse code:

wait_for_dev -n "${root#block:}"

It has wait_for_dev -n /dev/root If /dev/root points to /dev/nbd0, it works as expected.

This should result into wait_for_dev -n /dev/nbdX and I would expect the nbdroot code to provide the device and update root accordingly. If this is the case the dmsquash code has a chance to wait for the device and continue to work with it when it is present. It's the way how I serialize the kiwi dracut modules through the device presence and dracut has this nice wait_for_dev which is what you see with the initqueue sequence also controlled through systemd in the dracut initrd.

Usually if things fall apart you end up in a very long loop there :)

I agree with you there might be still a race condition in the two modules nbdroot and dmsquash

Maybe it is already doing some implicit locking. I'll let dracut experts discuss that in my PR.

schaefi commented 4 years ago

So just to put me right, it worked for you after you fixed root= right ? Yes

Great, thanks for the feedback

I also worked for me :-). However, it is still breaking when the module is added and is root=live:xxx. I might be better to restrict kiwi-overlay module for only when root syntax really matters for it.

Really, hmm it should not do anything in that case. There is

if [ "${root%%:*}" = "overlay" ] ; then
    overlayroot=$root
fi

[ "${overlayroot%%:*}" = "overlay" ] || return 1

in 90kiwi-overlay/parse-kiwi-overlay.sh

I admit I have just used this concept as it is done in other modules.

Do you have details (log) ?

Thanks

luizluca commented 4 years ago

Do you have details (log) ?

This is part of serial log. I selected parse and pre-mount parts. I can easily grab more if needed.

[    6.914889] dracut-cmdline[218]: /lib/dracut-lib.sh@431(source_all): for f in "/$_dir"/*.sh
[    6.915589] dracut-cmdline[218]: /lib/dracut-lib.sh@431(source_all): '[' -e //lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh ']'
[    6.917209] dracut-cmdline[218]: /lib/dracut-lib.sh@431(source_all): . //lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh
[    6.918546] dracut-cmdline[218]: ///lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh@7(source): '[' -z live:/dev/nbd0 ']'
[    6.919421] dracut-cmdline[218]: ///lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh@9(source): '[' live = overlay ']'
[    6.920857] dracut-cmdline[218]: ///lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh@13(source): '[' '' = overlay ']'
[    6.921656] dracut-cmdline[218]: ///lib/dracut/hooks/cmdline/30-parse-kiwi-overlay.sh@13(source): return 1
...
[   11.257298] dracut-pre-mount[717]: /lib/dracut-lib.sh@431(source_all): '[' -e //lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh ']'
[   11.258212] dracut-pre-mount[717]: /lib/dracut-lib.sh@431(source_all): . //lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh
[   11.259031] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@3(source): type getOverlayBaseDirectory
[   11.260182] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@3(source): . /lib/kiwi-filesystem-lib.sh
[   11.260690] dracut-pre-mount[717]: ///lib/kiwi-filesystem-lib.sh@1(source): type getarg
[   11.261277] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@86(source): PATH=/usr/sbin:/usr/bin:/sbin:/bin
[   11.262495] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@88(source): declare root=live:/dev/nbd0
[   11.263963] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@91(source): setupDebugMode
[   11.264973] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@9(setupDebugMode): getargbool 0 rd.kiwi.debug
[   11.267040] dracut-pre-mount[717]: //lib/dracut-lib.sh@253(getargbool): local _b
[   11.268099] dracut-pre-mount[717]: //lib/dracut-lib.sh@254(getargbool): unset _b
[   11.268575] dracut-pre-mount[717]: //lib/dracut-lib.sh@255(getargbool): local _default
[   11.269162] dracut-pre-mount[717]: //lib/dracut-lib.sh@256(getargbool): _default=0
[   11.270506] dracut-pre-mount[717]: //lib/dracut-lib.sh@256(getargbool): shift
[   11.271142] dracut-pre-mount[722]: ///lib/dracut-lib.sh@257(getargbool): getarg rd.kiwi.debug
[   11.271778] dracut-pre-mount[722]: ///lib/dracut-lib.sh@202(getarg): debug_off
[   11.272351] dracut-pre-mount[722]: ///lib/dracut-lib.sh@18(debug_off): set +x
[   11.242160] : Can't open blockdev
[   11.274279] dracut-pre-mount[722]: ///lib/dracut-lib.sh@242(getarg): return 1
[   11.274825] dracut-pre-mount[717]: //lib/dracut-lib.sh@257(getargbool): _b=
[   11.244113] dracut: FATAL: Failed to mount overlay(ro) root filesystem
[   11.245199] dracut: Refusing to continue
[   11.277570] dracut-pre-mount[717]: //lib/dracut-lib.sh@258(getargbool): '[' 1 -ne 0 -a -z '' ']'
[   11.278231] dracut-pre-mount[717]: //lib/dracut-lib.sh@258(getargbool): _b=0
[   11.278777] dracut-pre-mount[717]: //lib/dracut-lib.sh@259(getargbool): '[' -n 0 ']'
[   11.279809] dracut-pre-mount[717]: //lib/dracut-lib.sh@260(getargbool): '[' 0 = 0 ']'
[   11.286114] dracut-pre-mount[717]: //lib/dracut-lib.sh@260(getargbool): return 1
[   11.286643] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@94(source): initGlobalDevices live:/dev/nbd0
[   11.287510] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@23(initGlobalDevices): local root_cmdline
[   11.288898] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@24(initGlobalDevices): local nbd_host
[   11.290404] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@25(initGlobalDevices): local nbd_export
[   11.291223] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@26(initGlobalDevices): '[' -z live:/dev/nbd0 ']'
[   11.292485] dracut-pre-mount[724]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@29(initGlobalDevices): getarg root=
[   11.292904] dracut-pre-mount[724]: ///lib/dracut-lib.sh@202(getarg): debug_off
[   11.293413] dracut-pre-mount[724]: ///lib/dracut-lib.sh@18(debug_off): set +x
[   11.293970] dracut-pre-mount[724]: ///lib/dracut-lib.sh@235(getarg): return 0
[   11.295010] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@29(initGlobalDevices): root_cmdline=live:/dev/nbd0
[   11.297416] dracut-pre-mount[726]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@30(initGlobalDevices): getarg rd.root.overlay.write=
[   11.298302] dracut-pre-mount[726]: ///lib/dracut-lib.sh@202(getarg): debug_off
[   11.300076] dracut-pre-mount[726]: ///lib/dracut-lib.sh@18(debug_off): set +x
[   11.300620] dracut-pre-mount[726]: ///lib/dracut-lib.sh@242(getarg): return 1
[   11.304469] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@30(initGlobalDevices): write_partition=
[   11.305376] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@31(initGlobalDevices): [[ live:/dev/nbd0 =~ overlay:nbd= ]]
[   11.306232] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@41(initGlobalDevices): write_partition=live:/dev/nbd0
         Starting Dracut Emergency Shell...
[   11.309178] dracut-pre-mount[731]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@46(initGlobalDevices): cut -f1 -d ' '
[   11.312146] dracut-pre-mount[730]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@46(initGlobalDevices): grep disk
[   11.312937] dracut-pre-mount[729]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@46(initGlobalDevices): lsblk -p -n -r -s -o NAME,TYPE live:/dev/nbd0
[   11.313826] dracut-pre-mount[729]: lsblk: live:/dev/nbd0: not a block device
[   11.314353] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@45(initGlobalDevices): root_disk=
[   11.315226] dracut-pre-mount[735]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@50(initGlobalDevices): cut -f1 -d ' '
[   11.316093] //lib/dracut-lib.sh@434(): hookdir=/lib/dracut/hooks
//lib/dracut-lib.sh@435(): export hookdir
//lib/dracut-lib.sh@564(): command -v findmnt
//lib/dracut-lib.sh@1017(): command -v pidof
//lib/dracut-lib.sh@1194(): setmemdebug
dracut-pre-mount[734]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@50(initGlobalDevices): grep squashfs
[   11.321066] dracut-pre-mount[733]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@50(initGlobalDevices): lsblk -p -r --fs -o NAME,FSTYPE ''
[   11.321826] dracut-pre-mount[733]: lsblk: : not a block device
[   11.322277] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@49(initGlobalDevices): read_only_partition=
[   11.323131] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@97(source): loadKernelModules
[   11.323925] //lib/dracut-lib.sh@1189(setmemdebug): '[' -z 0 ']'
/bin/dracut-emergency@9(): source_conf /etc/conf.d
/lib/dracut-lib.sh@453(source_conf): local f
/lib/dracut-lib.sh@454(source_conf): '[' /etc/conf.d ']'
/lib/dracut-lib.sh@454(source_conf): '[' -d //etc/conf.d ']'
/lib/dracut-lib.sh@455(source_conf): for f in "/$1"/*.conf
/lib/dracut-lib.sh@455(source_conf): '[' -e //etc/conf.d/systemd.conf ']'
/lib/dracut-lib.sh@455(source_conf): . //etc/conf.d/systemd.conf
///etc/conf.d/systemd.conf@1(source): systemdutildir=/usr/lib/systemd
///etc/conf.d/systemd.conf@2(source): systemdsystemunitdir=/usr/lib/systemd/system
///etc/conf.d/systemd.conf@3(source): systemdsystemconfdir=/etc/systemd/system
dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@19(loadKernelModules): modprobe squashfs
[   11.328993] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@100(source): mountReadOnlyRootImage
[   11.329741] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@54(mountReadOnlyRootImage): local overlay_base
[   11.330826] dracut-pre-mount[737]: ////lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@55(mountReadOnlyRootImage): getOverlayBaseDirectory
[   11.331666] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@6(getOverlayBaseDirectory): local overlay_base=/run/overlay/bin/dracut-emergency@11(): type plymouth
/bin/dracut-emergency@11(): plymouth quit

[   11.333098] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@7(getOverlayBaseDirectory): local overlay_size
[   11.333868] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@8(getOverlayBaseDirectory): mkdir -p /run/overlay
[   11.334634] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@9(getOverlayBaseDirectory): mountpoint -q /run/overlay
[   11.335443] dracut-pre-mount[740]: ////lib/kiwi-filesystem-lib.sh@10(getOverlayBaseDirectory): getarg rd.root.overlay.size
[   11.336952] dracut-pre-mount[740]: ////lib/dracut-lib.sh@202(getarg): debug_off
[   11.337494] dracut-pre-mount[740]: ////lib/dracut-lib.sh@18(debug_off): set +x
[   11.338030] dracut-pre-mount[740]: ////lib/dracut-lib.sh@242(getarg): return 1
[   11.338588] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@10(getOverlayBaseDirectory): overlay_size=
[   11.339331] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@11(getOverlayBaseDirectory): '[' -z '' ']'
[   11.340151] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@11(getOverlayBaseDirectory): overlay_size=50%
[   11.340883] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@12(getOverlayBaseDirectory): mount -t tmpfs -o size=50% tmpfs /run/overlay
[   11.341708] dracut-pre-mount[737]: ///lib/kiwi-filesystem-lib.sh@14(getOverlayBaseDirectory): echo /run/overlay
[   11.342512] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@55(mountReadOnlyRootImage): overlay_base=/run/overlay
[   11.343389] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@56(mountReadOnlyRootImage): local root_mount_point=/run/overlay/rootfsbase
[   11.344450] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@57(mountReadOnlyRootImage): mkdir -m 0755 -p /run/overlay/rootfsbase
[   11.345396] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@58(mountReadOnlyRootImage): mount -n '' /run/overlay/rootfsbase/bin/dracut-emergency@13(): export _rdshell_name=dracut action=Boot hook=emergency
/bin/dracut-emergency@13(): _rdshell_name=dracut
/bin/dracut-emergency@13(): action=Boot
/bin/dracut-emergency@13(): hook=emergency

[   11.348391] dracut-pre-mount[744]: mount: /run/overlay/rootfsbase: wrong fs type, bad option, bad superblock on , missing codepage or helper program, or other error.
[   11.349495] dracut-pre-mount[717]: ///lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh@59(mountReadOnlyRootImage): die 'Failed to mount overlay(ro) root filesystem'
[   11.350425] dracut-pre-mount[717]: //lib/dracut-lib.sh@460(die): echo '<24>dracut: FATAL: Failed to mount overlay(ro) root filesystem'
[   11.351296] dracut-pre-mount[717]: //lib/dracut-lib.sh@461(die): echo '<24>dracut: Refusing to continue'
[   11.351978] //bin/dracut-emergency@14(): getarg rd.emergency
//lib/dracut-lib.sh@202(getarg): debug_off
//lib/dracut-lib.sh@18(debug_off): set +x
dracut-pre-mount[717]: //lib/dracut-lib.sh@465(die): echo 'warn dracut: FATAL: "Failed to mount overlay(ro) root filesystem"'
[   11.352376] dracut-pre-mount[717]: //lib/dracut-lib.sh@466(die): echo 'warn dracut: Refusing to continue'
[   11.352377] //lib/dracut-lib.sh@242(getarg): return 1
schaefi commented 4 years ago

That's it

[ 11.258212] dracut-pre-mount717: /lib/dracut-lib.sh@431(source_all): . //lib/dracut/hooks/pre-mount/30-kiwi-overlay-root.sh

Thanks, this part of the code did not check if the overlay is really requested. Thus just it's pure presence is enough to be called. I add another small patch to the existing PR.

I think we are good then. Happy you found a solution using dracut and thanks for your patience and feedback :+1: