Bug 1385183

Summary: [LLNL 7.4 Bug] multiple --include command line options cause non-obvious errors
Product: Red Hat Enterprise Linux 7 Reporter: Ben Woodard <woodard>
Component: dracutAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED WORKSFORME QA Contact: Release Test Team <release-test-team>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: dracut-maint-list, harald, jstodola, tgummels
Target Milestone: rc   
Target Release: 7.4   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-06 12:56:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1380361, 1381646, 1393867    

Description Ben Woodard 2016-10-14 23:34:10 UTC
Description of problem:
While it is documented that --include can only be used once on a dracut command line. This fact is easy to overlook and instead of emitting a comprehensible error message mkinitrd behaves in a difficult to explain way when there are multiple --include command lines supplied.

For example when I was testing something with kdump.

Sep 20 14:44:18 opal1 kdumpctl[158175]: Rebuilding /boot/initramfs-3.10.0-493.el7.x86_64kdump.img
Sep 20 14:44:19 opal1 dracut[160390]: Executing: /usr/sbin/dracut --hostonly --hostonly-cmdline --hostonly-i18n -o "plymouth dash resume ifcfg" --add nfs --mount "cfhost:/tftpboot/dumps /kdumproot//tftpboot/dumps nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.64.185,mountvers=3,mountport=20048,mountproto=udp,local_lock=all,addr=192.168.64.185" --include /etc/hosts /etc/hosts --include /tmp/99ip.conf -f /boot/initramfs-3.10.0-493.el7.x86_64kdump.img 3.10.0-493.el7.x86_64
Sep 20 14:44:19 opal1 kdumpctl[158175]: No permission to write to /.
Sep 20 14:44:19 opal1 dracut[160390]: No permission to write to /.
Sep 20 14:44:19 opal1 kdumpctl[158175]: mkdumprd: failed to make kdump initrd
Sep 20 14:44:19 opal1 kdumpctl[158175]: Starting kdump: [FAILED]
Sep 20 14:44:19 opal1 systemd[1]: kdump.service: main process exited, code=exited, status=1/FAILURE
Sep 20 14:44:19 opal1 systemd[1]: Failed to start Crash recovery kernel arming.
Sep 20 14:44:19 opal1 systemd[1]: Unit kdump.service entered failed state.
Sep 20 14:44:19 opal1 systemd[1]: kdump.service failed.

Dracut is complaining that it can't write to /. However, it should not need to write to / it should only need to write to /boot so this message is confusing. The problem was that in the kdump.conf there was:

dracut_args --include /etc/hosts /etc/hosts --include /tmp/99ip.conf /etc/cmdline.d/01mycmdline.conf

Possibly adding a little bit of code to: 

   578  while (($# > 0)); do
   579      if [ ${1%%=*} == "++include" ]; then
   580          push include_src "$2"
   581          push include_target "$3"
   582          PARMS_TO_STORE+=" --include '$2' '$3'"
   583          shift 2
   584      fi
   585      shift
   586  done

That prints an error and then exists the second time through the --include loop would make the program a bit more user friendly.

Comment 2 Lukáš Nykrýn 2016-10-18 13:57:41 UTC
This looks doable, I will look into it during 7.4 development.

Comment 3 Harald Hoyer 2016-11-16 12:54:38 UTC
1.  "--include /etc/hosts /etc/hosts"
this is bogus, you should use "--install /etc/hosts" here

2. "--include /tmp/99ip.conf"
is missing the second parameter

3. ok, I will add code for multiple "--include"

Comment 4 Harald Hoyer 2016-11-16 12:58:32 UTC
(In reply to Harald Hoyer from comment #3)
> 3. ok, I will add code for multiple "--include"

already there:
https://github.com/dracutdevs/dracut/blob/master/dracut.sh#L580

Comment 5 Lukáš Nykrýn 2017-04-06 12:56:40 UTC
Hmm it looks that there is nothing to do here. The code that Harald mentioned is already in rhel7.