Opened 18 years ago

Closed 17 years ago

Last modified 17 years ago

#1866 closed task (worksforme)

Pointless warning when running "ifdown" for a manually-configured interface

Reported by: alexander@… Owned by: lfs-book@…
Priority: lowest Milestone:
Component: Book Version: SVN
Severity: normal Keywords:
Cc:

Description

For the LiveCD needs, LFS network bootscripts have to be modified for compatibility with the "hibernate" script. The issue is:

  • The LiveCD has to run dhcpcd by default on all network interfaces, because it is not known which of possibly more than one network card is connected to a switch. Current syntax of network configuration files doesn't allow this, and the LiveCD has to bypass the existing infrastructure and run dhcpcd from udev rules in order to accomplish the goal.
  • Because of that, some interfaces may be up, but without valid configuration files (I refer to such interfaces as manually-configured below, because exactly the same situation arises when one runs the "ip" command manually).
  • The "hibernate" script wants to "ifdown" all interfaces, but doing so for interfaces without the configuration file results in a pointless (in this situation) warning. A similar warning appears when resuming, when the "hibernate" script runs "ifup". This warning has to be invisible in this case.

Of course, the LiveCD can create an interface configuration file and run "ifup" instead of running dhcpcd directly, but the bug is still relevant for manually-configured interfaces: not everyone discovers net-setup, and some people configure static IP addresses manually by the "ip" command.

Text of the warning:

/etc/sysconfig/network-devices/ifconfig.eth0 is not a network configuration file or directory.

So the bootscripts should provide some means (environment variable or ifup/ifdown command line switch to be used by the "hibernate" script) to suppress this pointless warning.

Change History (12)

comment:1 by Jeremy Huntwork, 17 years ago

Instead of running dhcpcd on all devices, why not just run it on the ones where a link is detected? I'm not sure if that information is in any of the kernel fs's, but the test could be done with a small custom C program.

comment:2 by alexander@…, 17 years ago

You missed the point of the ticket.

As of now, there are third-party, not LFS-specific, packages that want to run ifdown. E.g, the "hibernate" script. As of the time when the ticket was submitted, they produced warnings.

Right now, the issue is somewhat worked around in the LiveCD repository by patching the "hibernate" script and generating the ifconfig.ethX files from udev rules. But this solution is still not robust.

comment:3 by Jeremy Huntwork, 17 years ago

I thought you might say as much. :) And my above comment would be better placed in the LiveCD list or ticket system. (I'm still curious to hear what you think of that on its own merit, but that discussion can take place elsewhere.)

If we have the ability to alter the way hibernate calls ifdown (I assume so based on your above proposal of adding a switch to ifdown that hibernate can make use of...), what keeps us from just telling hibernate to send errors/output to /dev/null? Am I still missing the point?

comment:4 by alexander@…, 17 years ago

I don't want to suppress errors other than "ifconfig.eth0 is not a network configuration file or directory", that's why >/dev/null is not a solution. I will patch the script to skip the "ifdown" if the file doesn't exist. I patch it in other places anyway, for unrelated reasons.

comment:5 by alexander@…, 17 years ago

Priority: normallowest

As of r1747 in the LiveCD repository, due to added workarounds, there are no warnings from the "hibernate" script even for manually configured interfaces. Thus, lowering the priority.

comment:6 by Matthew Burgess, 17 years ago

For bringing down interfaces, rather than looking at the configuration files, how about the following:

#get a list of available interfaces
interfaces=`ip link show | grep ^[[:digit:]].*,UP | cut -f2 -d:`
#bring each interface down
for iface in interfaces; do
  ip link set $iface down;
done;

I'm not quite sure how to handle bringing interfaces up automatically though. Maybe it's just a case of doing the following for each interface that ip link show reports:

1) If the interface is blacklisted (I haven't thought of any possible configuration interfaces for this yet), i.e. the user explicitly doesn't want it to be brought up, don't do anything 2) If the interface isn't blacklisted and has an /etc/sysconfig/network-devices/ifconfig.${iface} file, bring it up 3) If the interface isn't blacklisted and doesn't have an /etc/sysconfig/network-devices/ifconfig.${iface} file fallback to a system-wide default configuration, such as DHCP.

in reply to:  6 ; comment:7 by bdubbs@…, 17 years ago

Replying to matthew@linuxfromscratch.org:

#get a list of available interfaces interfaces=ip link show | grep ^[[:digit:]].*,UP | cut -f2 -d:

I don't think this will always be what we want. On my system, I get:

lo
wifi0
ath0

In this case, I don't want to make any direct changes to wifi0, but I do use ath0. This is a characteristic of madwifi cards because both interfaces are for one wireless network card. OTOH, it probably doesn't make any difference for shutdown.

in reply to:  7 comment:8 by Matthew Burgess, 17 years ago

Replying to bdubbs@linuxfromscratch.org:

Replying to matthew@linuxfromscratch.org:

#get a list of available interfaces interfaces=ip link show | grep ^[[:digit:]].*,UP | cut -f2 -d:

I don't think this will always be what we want. On my system, I get:

lo
wifi0
ath0

In this case, I don't want to make any direct changes to wifi0, but I do use ath0. This is a characteristic of madwifi cards because both interfaces are for one wireless network card. OTOH, it probably doesn't make any difference for shutdown.

Yeah, I get similar interfaces listed for my wifi card - wmaster0 and wlan0. Again, I don't think I should be touching wmaster0 at all, but, like you, I'm not sure that bringing that interface down will do any harm. That said, I can't even bring the interface up at the moment so I can't test this for the time being. I do wonder whether there are similar types of interface (dial-up modems, isdn stuff, etc.) that might end up with more than one interface being listed. The above mechanism for detecting available interfaces might be just too brittle :-(

comment:9 by dnicholson@…, 17 years ago

I don't know if this helps much, but maybe we can add a special --all parameter to ifdown. Then it can glob the UP devices and bring them all down. I'm not sure how that would be used since it collides with the stop cases of init.d/network and init.d/localnet.

comment:10 by bdubbs@…, 17 years ago

I'm not sure what the point of this ticket is any more. Alexander has a work around for the Live CD. At least the title of the ticket is no longer valid.

What else needs to be fixed?

Or should this ticket just be closed with WORKSFORME?

comment:11 by alexander@…, 17 years ago

Resolution: worksforme
Status: newclosed

Closing.

comment:12 by Jeremy Huntwork, 17 years ago

Milestone: 6.3

Milestone 6.3 deleted

Note: See TracTickets for help on using tickets.