Bug 2036214 - Dracut commandline parsing incompatible with systemd-fsck-generator
Summary: Dracut commandline parsing incompatible with systemd-fsck-generator
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: dracut
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: dracut-maint-list
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-30 13:56 UTC by Ian Dall
Modified: 2023-12-05 21:03 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-12-05 21:03:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
dracut config dropin file (481 bytes, text/plain)
2021-12-30 13:56 UTC, Ian Dall
no flags Details
Bogus systemd.mount unit file (102 bytes, text/plain)
2021-12-30 13:59 UTC, Ian Dall
no flags Details
Dodgy workaround. (1.14 KB, patch)
2022-01-05 11:32 UTC, Ian Dall
no flags Details | Diff
Patch to generate sysroot.mount for nfs mounts. (2.34 KB, patch)
2022-11-21 05:20 UTC, Ian Dall
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1989119 1 unspecified NEW Nfsroot system fails to boot when using systemd-networkd 2024-06-14 07:16:58 UTC
Red Hat Bugzilla 2037311 1 unspecified CLOSED systemd-resolved not loaded or started in initrd 2023-05-25 15:55:55 UTC

Description Ian Dall 2021-12-30 13:56:18 UTC
Created attachment 1848326 [details]
dracut config dropin file

Description of problem:
When initramfs is built to use systemd-networkd, it fails to mount an NFS root file system.

Version-Release number of selected component (if applicable):
dracut-055-6.fc35.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Configure dracut with systemd-network-management and build initramfs
2. Boot with parameters root=nfs4:server:path
3. 

Actual results:
Boot times out in initqueue due to not finding $NEWROOT/proc and eventually fails

Expected results:
Successful mount and boot


Additional info:
Dracut expects a boot command line parameter like "root=nfs4:server:path:flags". But systemd-fstab-generator creates a unit file with:

What=nfs4:server:path:flags

instead of 

What=server:path
Type=nfs4

When you try and perform this mount, eg: systemctl start mnt-test.mount it generates the error:

mount.nfs: Failed to resolve server nfs4: Name or service not known

This can be verified by adding the rd.break=initqueue parameter and typing:
 systemctl cat sysroot.mount

Unfortunately you can't use root=server:path rootfstype=nfs4 rootflags=flags (as expected by systemd-fstab-generator) because dracut doesn't handle this properly. Either systemd-fstab-generato needs to learn how to parse "root=nfs4:server:path:flags" arguments ore dracut needs to learn how to parse root=server:path rootfstype=nfs4 rootflags=flags (or both). 

There seems to be multiple bugs preventing this configuration working see also bug #1989119

Comment 1 Ian Dall 2021-12-30 13:59:36 UTC
Created attachment 1848327 [details]
Bogus systemd.mount unit file

Comment 2 Zbigniew Jędrzejewski-Szmek 2021-12-31 19:02:04 UTC
Hmm, dracut.cmdline(7) says:

       root=<path to blockdevice>
           specify the block device to use as the root filesystem.

           Example.

               root=/dev/sda1
               root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
               root=/dev/disk/by-label/Root
               root=LABEL=Root
               root=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
               root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
               root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7

       root=[<server-ip>:]<root-dir>[:<nfs-options>]
           mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
           dhcp next_server. If server-ip is an IPv6 address it has to be put in
           brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
           ":" or "," and are separated by ",".

       root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>],
       root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>], root={dhcp|dhcp6}
           netroot=dhcp alone directs initrd to look at the DHCP root-path where NFS
           options can be specified.

           Example.

                   root-path=<server-ip>:<root-dir>[,<nfs-options>]
                   root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
                   root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]

       root=/dev/nfs nfsroot=[<server-ip>:]<root-dir>[:<nfs-options>]
           Deprecated!  kernel Documentation_/filesystems/nfsroot.txt_ defines this
           method. This is supported by dracut, but not recommended.


Looking around on the net, I see e.g. https://rags.wordpress.com/2012/03/20/using-nfsroot-to-boot-diskless-clients-on-rhel/
which implies that root=nfs:… and root=nfs4:… worked at various points.

I think we don't have much choice but to add support for this in systemd-network-generator.


@yuwata, wdyt?

Comment 3 Ian Dall 2022-01-05 11:32:33 UTC
Created attachment 1849020 [details]
Dodgy workaround.

Comment 4 Ian Dall 2022-01-06 23:19:33 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #2)
> Hmm, dracut.cmdline(7) says:
> 
>        root=<path to blockdevice>
>            specify the block device to use as the root filesystem.
> 
>            Example.
> 
>                root=/dev/sda1
>                root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
>                root=/dev/disk/by-label/Root
>                root=LABEL=Root
>                root=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
>                root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
>                root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
> 
>        root=[<server-ip>:]<root-dir>[:<nfs-options>]
>            mount nfs share from <server-ip>:/<root-dir>, if no server-ip is
> given, use
>            dhcp next_server. If server-ip is an IPv6 address it has to be
> put in
>            brackets, e.g. [2001:DB8::1]. NFS options can be appended with
> the prefix
>            ":" or "," and are separated by ",".
> 
>        root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>],
>        root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>], root={dhcp|dhcp6}
>            netroot=dhcp alone directs initrd to look at the DHCP root-path
> where NFS
>            options can be specified.
> 
>            Example.
> 
>                    root-path=<server-ip>:<root-dir>[,<nfs-options>]
>                    root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
>                    root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
> 
>        root=/dev/nfs nfsroot=[<server-ip>:]<root-dir>[:<nfs-options>]
>            Deprecated!  kernel Documentation_/filesystems/nfsroot.txt_
> defines this
>            method. This is supported by dracut, but not recommended.
> 
> 
> Looking around on the net, I see e.g.
> https://rags.wordpress.com/2012/03/20/using-nfsroot-to-boot-diskless-clients-
> on-rhel/
> which implies that root=nfs:… and root=nfs4:… worked at various points.
> 
> I think we don't have much choice but to add support for this in
> systemd-network-generator.
> 
> 
> @yuwata, wdyt?

Comment 5 Ian Dall 2022-01-06 23:36:28 UTC
(In reply to Ian Dall from comment #0)
Fixing this bug is sufficient for the case where <server> is an ip address. Where <server> is a domain name, bug #2037311 comes into play.

Comment 6 Zbigniew Jędrzejewski-Szmek 2022-01-07 16:00:17 UTC
https://github.com/systemd/systemd/pull/22013

Comment 7 Ian Dall 2022-11-21 05:20:05 UTC
Created attachment 1926021 [details]
Patch to generate sysroot.mount for nfs mounts.

This module relies on a generator to create a sysroot.mount
unit. However in rootfs-generator.sh, line 106, generator_mount_rootfs
is only run if there is no 'root=' argument and generator_mount_rootfs
immediately returns 0 if $root is an empty string, so this line
apparently did nothing. However systemd-fstab-generator is also
installed.

The this module did not work for NFS roots (bailing if rootok is not
1). Also, current systemd-fstab-generator bails for nfs types.  Add
code to create a sysroot.mount unit for the nfs case. This does not
work if root is dhcp, but we bail in that case and are no worse
off. The systemd-networkd does not provide a documented way to get
parameters out of the dhcp response. Maybe using a legacy dhcp module
works (untested).

Comment 8 Ian Dall 2022-11-21 05:30:23 UTC
This bug is still present in Fedora 36, however, since this bug was originally submitted there has been a relevant change to systemd-fstab-generator so that is now bails on nfs root filesystems. This means the earlier (admittedly dodgy) patch no longer works, but opens the way to a better (less dodgy) solution of modifying dracut-rootfs-generator.

Comment 9 Ben Cotton 2022-11-29 17:34:38 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 10 Aoife Moloney 2023-11-23 00:07:46 UTC
This message is a reminder that Fedora Linux 37 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '37'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 37 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 11 Aoife Moloney 2023-12-05 21:03:08 UTC
Fedora Linux 37 entered end-of-life (EOL) status on None.

Fedora Linux 37 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.