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 would like to boot an Arch Linux instance using LXC. Just about everything works, but I'm encountering the following error when trying to configure an interface using dhcpcd:

# dhcpcd eth0
dhcpcd[4213]: version 5.6.4 starting
dhcpcd[4213]: eth0: if_init: Read-only file system
dhcpcd[4213]: eth0: interface not found or invalid

This appears to be a direct result of dhcpcd trying to modify /proc/sys/net/ipv4/conf/eth0/promote_secondaries:

4210  open("/proc/sys/net/ipv4/conf/eth0/promote_secondaries", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 EROFS (Read-only file system)
4210  writev(2, [{"dhcpcd[4210]: eth0: if_init: Read-only file system", 50}, {"\n", 1}], 2) = 51

I can hack around it using a bind mount:

# touch /tmp/promote_secondaries
# mount -o bind /tmp/promote_secondaries \
  /proc/sys/net/ipv4/conf/eth0/promote_secondaries

But that seems like a terrible idea. Is there any way to get dhcpcd to run under LXC without this hack? Why is write access to this sysctl not available under LXC?

share|improve this question

2 Answers 2

The reason is that, upon startup, your container mounts a read-only version of /proc/sys on top of the /proc structure.

Inside container:

# grep proc /proc/mounts 
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
proc /proc/sys proc ro,relatime 0 0

You can umount ( or mount -o remount,rw) it and your problem will disappear.

umount /proc/sys

The read-only /proc/sys directory is meant to protect (the overall stability) of your host from (accidental) modifications from the LXC-container, so the above statement does imply a risk.

share|improve this answer

I have the same problem. I don't know what can be done in general about the ro filesystem, but to fix the dhcp problem, I use dhclient instead of dhcpcd. dhclient does not try to write anything on /proc/sys.

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.