RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1208897 - Bad parsing of network-scripts/ifcfg-xxxx files.
Summary: Bad parsing of network-scripts/ifcfg-xxxx files.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: netcf
Version: 6.6
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-03 18:22 UTC by Laine Stump
Modified: 2016-04-26 14:04 UTC (History)
13 users (show)

Fixed In Version: netcf-0.2.4-3.el6
Doc Type: Bug Fix
Doc Text:
Clone Of: 761246
Environment:
Last Closed: 2015-07-22 06:26:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1307 0 normal SHIPPED_LIVE netcf bug fix update 2015-07-20 17:53:43 UTC

Description Laine Stump 2015-04-03 18:22:47 UTC
+++ This bug was initially created as a clone of Bug #761246 +++

Description of problem:

Log files fill with errors when virt-manager is running.
Command "virsh iface-list --all" fails to list active interfaces.

Version-Release number of selected component (if applicable):

virt-manager-0.9.0-7.el6.x86_64
libvirt-client-0.9.4-23.el6_2.1.x86_64
netcf-0.1.9-2.el6.x86_64
netcf-libs-0.1.9-2.el6.x86_64


How reproducible:

Always.

Steps to Reproduce:
1. Start virt-manager.
2. Manually edit /etc/sysconfig/network-scripts/ifcfg-eth0 and add a semicolon at the end of any line.
3. Tail the relevant log file to see two errors every second.
4. Run the command "virsh iface-list --all" to see a failure to list all interfaces.
  
Actual results:

Log file fills with errors as listed below when virt-manager is running.

    07:38:00.045: 3684: error : interfaceNumOfInterfaces:195 : internal error
                                failed to get number of interfaces on host:
                                unspecified error - errors in loading some
                                config files
    07:38:00.094: 3683: error : interfaceNumOfDefinedInterfaces:237 : internal
                                error failed to get number of defined
                                interfaces on host: unspecified error - errors
                                in loading some config files

Running the command "virsh iface-list --all" reports
    error: Failed to list active interfaces
    error: internal error failed to get number of interfaces on host:
           unspecified error - errors in loading some config files

Expected results:

The virt-manager tool should list all interfaces, or at least those that it believes to have a valid configuration file.
The virsh tool should list all interfaces, or at least those that it believes to have a valid configuration file.

Additional info:

For virt-manager to log the same information every second repeatedly can quickly fill up the log files. I would expect virt-manager to report an error and stop trying to list interfaces to limit this scenario.

This bug is related to the netcf parsing bug https://bugzilla.redhat.com/show_bug.cgi?id=613886 and particularly comments subsequent to comment 29.

As per the comments in the above (resolved) bug, the /etc/sysconfig/network-scripts/ifcfg-xxxx files are parsed sourced by network-functions from the bash file /sbin/ifup (initscripts) and so according to initscripts, they may contain any valid shell syntax including double-quotes surrounding variable assignments and comments starting with the '#' symbol.


--- Additional comment from Laine Stump on 2015-03-03 12:13:32 EST ---

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 augeas upstream commit 3bc029d 

  https://github.com/hercules-team/augeas/pull/212/files

Comment 4 Hu Jianwei 2015-04-20 05:55:40 UTC
I can reproduce it on old version.

[root@ibm-x3650m3-04 ~]# 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@ibm-x3650m3-04 ~]# 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@ibm-x3650m3-04 ~]# 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@ibm-x3650m3-04 ~]# rpm -q libvirt netcf-libs
libvirt-0.10.2-53.el6.x86_64
netcf-libs-0.2.4-3.el6.x86_64

[root@ibm-x3650m3-04 ~]# ll /usr/share/netcf/lenses/sysconfig.aug 
ls: cannot access /usr/share/netcf/lenses/sysconfig.aug: No such file or directory

[root@ibm-x3650m3-04 ~]# 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@ibm-x3650m3-04 ~]# virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
eth0                 active     e4:1f:13:b9:60:a0
eth1                 inactive   e4:1f:13:b9:60:a2
lo                   active     00:00:00:00:00:00
usb0                 active     e6:1f:13:ac:60:a3

[root@ibm-x3650m3-04 ~]# 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.

Comment 5 Hu Jianwei 2015-06-02 08:41:31 UTC
According to comment 4, changed to Verified.

Comment 7 errata-xmlrpc 2015-07-22 06:26:13 UTC
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/RHBA-2015-1307.html


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