Bug 761246
Summary: | Bad parsing of network-scripts/ifcfg-xxxx files. | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Paul Moore <pmoore> | |
Component: | netcf | Assignee: | Laine Stump <laine> | |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | medium | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 7.1 | CC: | allan-redhat, cwei, dyuan, hbrock, honzhang, jiri.lunacek, laine, mshao, mzhan, thoger, ydu | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | All | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | netcf-0.2.8-1.el7 | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1198282 1208897 (view as bug list) | Environment: | ||
Last Closed: | 2015-11-19 08:58:01 UTC | Type: | --- | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | 1198282 | |||
Bug Blocks: |
Description
Paul Moore
2011-12-07 22:09:04 UTC
This also appears if you have: DOMAIN=domain1.com domain2.com in an ifcfg-* script. Changing it to: DOMAIN="domain1.com domain2.com" resolves the bug, I'm not sure if that should have been 'SEARCH=domain1.com domain2.com' instead, I believe the separate domains ended up there on that line as the result of a GUI setup during installation. If I remove quotes on other fields it does not trigger the bug. It appears to be a combination of the lack of quotes and a space. Just to clarify, although it may effect RHEL6 the quoting issue I am experiencing is on Fedora 15 - I could add a bug on that project if that is appropriate. However in this case I think the bug will be the same in both places, with the exception of the GUI causing the issue. Also, even adding a unused field in an ifcfg-* script with a space causes the issue: CLAM=one two -or- CLAM= one Both cause this issue. I am not using libvirt on the RHEL6 systems I can fiddle with. Maybe Paul can confirm this on RHEL6. Thanks Throwing an error in this case seems appropriate to me: the configuration file contains an error and the user needs to be notified. If the volume of errors being generated by virt-manager is objectionable, then I think that is something that needs to be taken up with virt-manager. I am in favor of closing this as NOTABUG. Paul has indicated that he was using valid shell syntax. Quoting Paul from the aforementioned closed bug: When the following syntax is placed in "/etc/sysconfig/network-scripts/ifcfg-eth0" the problem reappears. DEVICE="eth0"; # The physical device name. **COMPULSORY** HWADDR="20:CF:30:04:B9:61"; # The mac address used to recognise hardware. ONBOOT="yes"; # Initialise this device on system start-up. BRIDGE="br0"; # This DEVICE is part of this BRIDGE. When the following syntax is placed in "/etc/sysconfig/network-scripts/ifcfg-eth0" the problem reappears. DEVICE="eth0"; HWADDR="20:CF:30:04:B9:61"; ONBOOT="yes"; BRIDGE="br0"; but when the following syntax is used instead, there is no problem. DEVICE="eth0" # The physical device name. **COMPULSORY** HWADDR="20:CF:30:04:B9:61" # The mac address used to recognise hardware. ONBOOT="yes" # Initialise this device on system start-up. BRIDGE="br0" # This DEVICE is part of this BRIDGE. My guess would be that the netcf libraries do not like a semi-colon at the end of a line. The above syntax works fine with the initscripts package. rpm -q netcf netcf-libs netcf-0.1.9-2.el6.x86_64 netcf-libs-0.1.9-2.el6.x86_64 As per the comments above, netcf should accept valid shell characters in the network-scripts/ifcfg files. Additionally I think it would be better to fail gracefully(perhaps with a message) and skip the unparseable interface, No? Or at least indicate which file is/or could be causing this issue. Thanks. (In reply to comment #5) > Paul has indicated that he was using valid shell syntax. Quoting Paul from the > aforementioned closed bug: Okay. What he describes in his followon comment to the closed bug is a bug. Unfortunately, he didn't copy that example into this bug, which made the report misleading for someone coming in after the fact (since the original issue wasn't present, but just your issue in Comment 2 and Comment 3). Dave's comment was directed towards the problem you mention with CLAM=one two In the shell, that would have the effect of running the binary "two" with the environment variable "CLAM" set to "one", it would NOT set "CLAM" to "one two". > > When the following syntax is placed in > "/etc/sysconfig/network-scripts/ifcfg-eth0" the problem reappears. > > DEVICE="eth0"; # The physical device name. **COMPULSORY** > HWADDR="20:CF:30:04:B9:61"; # The mac address used to recognise hardware. > ONBOOT="yes"; # Initialise this device on system start-up. > BRIDGE="br0"; # This DEVICE is part of this BRIDGE. > > When the following syntax is placed in > "/etc/sysconfig/network-scripts/ifcfg-eth0" the problem reappears. > > DEVICE="eth0"; > HWADDR="20:CF:30:04:B9:61"; > ONBOOT="yes"; > BRIDGE="br0"; Those we may be able to do something about. I'll investigate. Per an earlier irc conversation with David Lutterkort, the inability to parse comments and semicolons without error is fixed in the shellvars lens of upstream augeas. But netcf doesn't use the shellvars lens, it instead uses a netcf-specific, simplified version of the shellvars lens called sysconfig. I think it was based on an earlier version of the shellvars lens. David - did you have any luck making an updated sysconfig lens? This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate, in the next release of Red Hat Enterprise Linux. (In reply to comment #5) > DEVICE="eth0"; # The physical device name. **COMPULSORY** > HWADDR="20:CF:30:04:B9:61"; # The mac address used to recognise hardware. > ONBOOT="yes"; # Initialise this device on system start-up. > BRIDGE="br0"; # This DEVICE is part of this BRIDGE. ... > My guess would be that the netcf libraries do not like a semi-colon at the > end of a line. The above syntax works fine with the initscripts package. In addition to semi colon, parsing also chokes on trailing comments. So this works fine: DEVICE=em1 and changing it to: DEVICE=em1 # comment triggers the "unspecified error" message. Hello. I have just stumbled across this on netcf-libs-0.2.4-1.el6.x86_64. The problem was leading spaces on lines in ifcfg- file. I just pushed a patch upstream to remove the netcf-specific sysconfig.aug file, causing netcf to rely on the lens that is now a part of augeas itself. This resolves the problems with partial-line comments and trailing semicolons. commit f5dd51e65cccd24c7dfd8448b6c2f2aa2804ef92 Author: Laine Stump <laine> Date: Fri Feb 27 22:03:28 2015 -0500 eliminate netcf-specific sysconfig.aug lens Back in 2010 when netcf needed a separate augeas lens for files in sysconfig/network-scripts (e.g. the ifcfg-* files), augeas itself had no special purpose sysconfig.aug lens, so netcf has its own sysconfig.aug lens based on the shellvars.aug lens from augeas at the time. Sometime soon after that augeas got its own sysconfig.aug lens, but netcf never rid itself of its own copy. The sysconfig.aug in netcf is now severely out of date compared to the one in augeas, and is missing many bugfixes. This patch just removes the netcf version from /usr/share/netcf/lenses, so that augeas will use its own lens when it's called by netcf. Among other things, this updated lens properly ignores semicolons and "#"-initiated partial line comments at the ends of lines that contain valid variable settings at the beginning. Along with any other newly encountered problem in parsing ifcfg files, the problem with leading whitespace on a line as mentioned in Comment 14 will need to be addressed in augeas rather than netcf. And in fact the leading whitespace problem *is* fixed by the following augeas patch (not yet pushed upstream as of this writing): https://github.com/hercules-team/augeas/pull/212/files I will clone this bug to augeas to make sure the latest sysconfig.aug is pulled into the RHEL version of augeas. I can reproduce it on old version. [root@localhost networks]# rpm -q libvirt netcf libvirt-1.2.15-2.el7.x86_64 netcf-0.2.6-3.el7.x86_64 [root@localhost networks]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1; ONBOOT=yes; IPV6INIT="yes"; IPV6_AUTOCONF="no"; DHCPV6C="no"; IPV6ADDR="2002::200/64"; IPV6ADDR_SECONDARIES="2002::201/64 2002::202/64"; [root@localhost networks]# virsh iface-list --all error: Failed to list interfaces error: internal error: failed to get number of host interfaces: unspecified error - errors in loading some config files [root@localhost networks]# ll /usr/share/netcf/lenses/sysconfig.aug -rw-r--r--. 1 root root 2041 Jul 20 2010 /usr/share/netcf/lenses/sysconfig.aug And, I can not reproduce it on below fixed version. [root@localhost networks]# rpm -q libvirt netcf libvirt-1.2.15-2.el7.x86_64 netcf-0.2.8-1.el7.x86_64 [root@localhost networks]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1; ONBOOT=yes; IPV6INIT="yes"; IPV6_AUTOCONF="no"; DHCPV6C="no"; IPV6ADDR="2002::200/64"; IPV6ADDR_SECONDARIES="2002::201/64 2002::202/64"; [root@localhost networks]# virsh iface-list --all Name State MAC Address --------------------------------------------------- br0 inactive eno1 active 24:be:05:18:81:ce enp2s0 active 00:1b:21:27:4e:ce eth1 inactive lo active 00:00:00:00:00:00 [root@localhost networks]# ll /usr/share/netcf/lenses/sysconfig.aug ls: cannot access /usr/share/netcf/lenses/sysconfig.aug: No such file or directory [root@localhost networks]# virsh iface-dumpxml eth1 <interface type='ethernet' name='eth1'> <start mode='onboot'/> <protocol family='ipv6'> <ip address='2002::200' prefix='64'/> <ip address='2002::201' prefix='64'/> <ip address='2002::202' prefix='64'/> </protocol> </interface> We can get expected results. Appended a missing scenario in bug 1198282: ++++++++++++++++++++++ In Bug 1198282 - Bad parsing of network-scripts/ifcfg-xxxx files by sysconfig.aug lens 3) lines starting with whitespace: ^ DEVICe="eth0" ++++++++++++++++++++++ [root@localhost network-scripts]# rpm -q netcf libvirt augeas package netcf is not installed libvirt-1.2.15-2.el7.x86_64 augeas-1.1.0-17.el7.x86_64 [root@localhost network-scripts]# cat ifcfg-eth1 DEVICE=eth1; ONBOOT=yes; IPV6INIT="yes"; IPV6_AUTOCONF="no"; DHCPV6C="no"; IPV6ADDR="2002::200/64"; IPV6ADDR_SECONDARIES="2002::201/64 2002::202/64"; [root@localhost network-scripts]# virsh iface-list --all error: Failed to list interfaces error: internal error: failed to get number of host interfaces: unspecified error - errors in loading some config files Using the latest augeas version: [root@localhost ~]# rpm -q netcf libvirt augeas netcf-0.2.8-1.el7.x86_64 libvirt-1.2.16-1.el7.x86_64 augeas-1.4.0-1.el7.x86_64 [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1; ONBOOT=yes; IPV6INIT="yes"; IPV6_AUTOCONF="no"; DHCPV6C="no"; IPV6ADDR="2002::200/64"; IPV6ADDR_SECONDARIES="2002::201/64 2002::202/64"; [root@localhost ~]# virsh iface-list --all Name State MAC Address --------------------------------------------------- br888 inactive eno1 active 24:be:05:18:81:ce eth1 inactive lo active 00:00:00:00:00:00 [root@localhost ~]# ll /usr/share/netcf/lenses/sysconfig.aug ls: cannot access /usr/share/netcf/lenses/sysconfig.aug: No such file or directory [root@localhost ~]# virsh iface-dumpxml eth1 <interface type='ethernet' name='eth1'> <start mode='onboot'/> <protocol family='ipv6'> <ip address='2002::200' prefix='64'/> <ip address='2002::201' prefix='64'/> <ip address='2002::202' prefix='64'/> </protocol> </interface> [root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1 [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1; ONBOOT=yes; IPV6INIT="yes"; IPV6_AUTOCONF="no"; DHCPV6C="no"; IPV6ADDR="2002::200/64"; IPV6ADDR_SECONDARIES="2002::201/64 2002::202/64"; [root@localhost ~]# virsh iface-list --all Name State MAC Address --------------------------------------------------- br888 inactive eno1 active 24:be:05:18:81:ce eth1 inactive lo active 00:00:00:00:00:00 [root@localhost ~]# virsh iface-dumpxml eth1 <interface type='ethernet' name='eth1'> <start mode='onboot'/> <protocol family='ipv6'> <ip address='2002::200' prefix='64'/> <ip address='2002::201' prefix='64'/> <ip address='2002::202' prefix='64'/> </protocol> </interface> We can get expected results, moved to Verified. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2015-2248.html |