Bug 965658

Summary: initrd built by dracut ignores rootflags cmdline settings
Product: [openSUSE] openSUSE Distribution Reporter: Per Jessen <per>
Component: BasesystemAssignee: Fabian Vogt <fvogt>
Status: RESOLVED WONTFIX QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Leap 42.1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Per Jessen 2016-02-08 16:27:55 UTC
Hardware:  stork2, boots over PXE+NFS. 

My normal cmdline as supplied by PXE:

initrd=stork2/initrd.new2 root=/dev/nfs rw nfsroot=10.42.8.254:/srv/nfs/stork2/root rootflags=hard,intr elevator=deadline rd.shell

This gives me a root filesystem over NFSv4.  To check to see if bug#965542 was somehow related to NFS being v3 or v4, I wanted to override so I changed the PXE config :

rootflags=hard,intr,v3

Didn't work - the cmdline on a system booted with that:

# cat /proc/cmdline
initrd=stork2/initrd.new2 root=/dev/nfs rw
nfsroot=nfsroot.example.com:/srv/nfs/stork2/root rootflags=hard,intr,v3 
elevator=deadline rd.shell

But "mount -v" shows:

# mount -v
10.42.8.254:/srv/nfs/stork2/root on / type nfs4
(rw,relatime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,......)

After some experimentation, I worked out how to do it:

root=nfs:10.42.8.254:/srv/nfs/stork2/root:rw,relatime,v3,hard,intr

As a work-around that's fine, but dracut has to be backward compatible, surely.
Comment 1 Fabian Vogt 2016-02-09 09:27:13 UTC
Looking at "man dracut.cmdline" tells that

>        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.

The "Deprecated!" is even underlined.
Looking at the code, if nfs is being used, rootflags= is completely ignored.
As all methods of NFS mounting except this deprecated one allow specifying mount options, I'd say this is a WONTFIX.
Even if it would be supported, which one should be used if both rootflags= and NFS options are specified?
Comment 2 Per Jessen 2016-02-09 09:53:32 UTC
(In reply to Fabian Vogt from comment #1)
> Looking at "man dracut.cmdline" tells that
> 
> >        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.
> 
> The "Deprecated!" is even underlined.

Usually "deprecated"!="wont work" and "supported"="will work" :-)

I guess I don't think it's reasonable to have to change kernel cmdline arguments just because a new tool is creating the initrd. 

> Looking at the code, if nfs is being used, rootflags= is completely ignored.
> As all methods of NFS mounting except this deprecated one allow specifying
> mount options, I'd say this is a WONTFIX.
> Even if it would be supported, which one should be used if both rootflags=
> and NFS options are specified?

When a mixture of conflicting arguments are present, the last one should be used. 

Anyway, let's leave as WONTFIX, but I have to comment it's pretty poor show on dracut's behalf.  I wonder if the  nfs: syntax also works with older initrds built by the old mkinitrd.
Comment 3 Fabian Vogt 2016-02-09 10:27:54 UTC
(In reply to Per Jessen from comment #2)
> (In reply to Fabian Vogt from comment #1)
> > Looking at "man dracut.cmdline" tells that
> > 
> > >        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.
> > 
> > The "Deprecated!" is even underlined.
> 
> Usually "deprecated"!="wont work" and "supported"="will work" :-)

I see it the same way, but it's not worth fixing it IMHO, especially in non-TW.

> I guess I don't think it's reasonable to have to change kernel cmdline
> arguments just because a new tool is creating the initrd. 

Just call it "initrd cmdline arguments" which they effectively are
and it makes sense.

> > Looking at the code, if nfs is being used, rootflags= is completely ignored.
> > As all methods of NFS mounting except this deprecated one allow specifying
> > mount options, I'd say this is a WONTFIX.
> > Even if it would be supported, which one should be used if both rootflags=
> > and NFS options are specified?
> 
> When a mixture of conflicting arguments are present, the last one should be
> used. 

Here are two different arguments with conflicts. Dracut does not store the order in this case. Doing that would be pretty confusing and a trap IMO.

> Anyway, let's leave as WONTFIX, but I have to comment it's pretty poor show
> on dracut's behalf.  I wonder if the  nfs: syntax also works with older
> initrds built by the old mkinitrd.

mkinitrd supports /dev/nfs, nfs:// and host:/path syntax AFAIK :-/