Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've just started working with LXC under CentOS 6 (via the libvirt adapter). If I create an LXC container, I'm unable to see any network interfaces when using the native system tools:

# ifconfig -a
#

The behavior is very odd; specifying an interface by names yields neither the expected output nor an error message. This is true even for clearly invalid interface names, like this:

# ifconfig foo
#

The ip command exhibits the same behavior.

On the other hand, if I use "ifconfig" provided by busybox, everything works as expected:

# busybox ifconfig -a

eth0      Link encap:Ethernet  HWaddr 52:54:00:E0:12:C8  
          inet6 addr: fe80::5054:ff:fee0:12c8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:268 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:17814 (17.3 KiB)  TX bytes:552 (552.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

So...what does busybox know that the native tools don't? The libvirt config for this environment is pretty standard; the network definition looks like this:

<interface type='network'>
  <mac address='52:54:00:e0:12:c8'/>
  <source network='default'/>
  <target dev='veth0'/>
</interface>

The full configuration is here if you think it might help.

I'm running:

  • lxc-0.7.2-2.el6.x86_64
  • kernel-2.6.32-71.29.1.el6.x86_64

EDIT

Weirder and weirder...it's a display issue, not a functionality issue. I can see the output of ifconfig if I pipe it into anything, so for example:

# ifconfig eth0 | cat
eth0      Link encap:Ethernet  HWaddr 52:54:00:E0:12:C8  
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fee0:12c8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:573 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:37914 (37.0 KiB)  TX bytes:552 (552.0 b)

And in fact even when not piping the output, strace shows that ifconfig is in fact writing the output to file descriptor 1 (aka stdout), so it's not clear why no output is actually showing up. This could be either an LXC or a virsh issue, I guess.

share|improve this question

1 Answer 1

Usually this kind of thing happens which the apparently-failing program is trying to smarter, by querying the terminal driver for its size when it's set incorrectly or just 0 (look at stty -a), or using terminfo but with an incorrect $TERM or $LC_* variables (try running env), or in some weird cases where some buffer is getting used that's swallowing data that doesn't fill the buffer. Running strace on ifconfig vs the busybox version might be interesting. The normal Linux ifconfig is really spare about this kind of thing - about all it does is an access to the locale info.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.