[lxc-devel] Centos template: symlink for /dev/fd missing? - And from Oracle too...

Dwight Engen dwight.engen at oracle.com
Thu Feb 13 19:44:27 UTC 2014


On Thu, 13 Feb 2014 13:32:44 -0500
"Michael H. Warfield" <mhw at WittsEnd.com> wrote:

> On Thu, 2014-02-13 at 12:18 -0500, Michael H. Warfield wrote:
> > On Thu, 2014-02-13 at 14:02 +0100, Harald Dunkel wrote:
> > > Hi folks,
> > 
> > > Problem in LXC (beta4) running a Centos 6.5 client:
> > 
> > > 	# cat <(echo hello)
> > > 	cat: /dev/fd/63: No such file or directory
> > 
> > > On a "real" host /dev/fd is a symlink pointing to /proc/self/fd.
> > > AFAICS only the altlinux template creates this symlink. Debian
> > > seems to provide the link on its own.
> 
> > > lxc.autodev = 1 does not help. I tried, of course.
> > 
> > > Question: Should this symlink be added to the lxc-centos template,
> > > as it was done for altlinux?
> 
> > Probably.  I'll have to look at it.  If the CentOS template needs
> > it, then the Fedora template would also probably need it as well,
> > especially in the autodev case.  The Oracle template also doesn't
> > do anything with /dev/fd and it should be very similar to the
> > CentOS layout.  I'm not sure what the deal is.  Maybe they're
> > providing it in their startup.
> 
> Oh crud.  Isn't this a fine kettle of fish.
> 
> I've confirmed that /dev/fd is missing from CentOS and Oracle
> containers but not from Fedora (systemd w/ autodev) containers.  Not
> exactly what I was expecting.  I haven't tested it with earlier
> deprecated upstart or sysvinit versions of Fedora.  I don't see where
> it's being created by any of the init scripts.

Okay, the symlink is being created in the init script in the initramfs
image. We're obviously not going to be running that in the container
case, so we'll have to do something in lxc. I'd vote for your
suggestion of just having lxc do it where its creating the ptys unless
someone has a case where it shouldn't exist (which I doubt since its
documented in the kernel's Documentation/devices.txt under "Compulsory
links").

> I can add creating that symlink into the CentOS template, there's just
> one problem.
> 
> As you noticed, it also doesn't work if you set autodev = 1.  Adding
> the symlink into the CentOS and Oracle templates would fix the static
> fs case but the autodev case (which should work with both, even with
> sysvinit or upstart) will still be broken.  Maybe when CentOS 7, RHEL
> 7, Oracle 7 comes out with systemd (which will require autodev), that
> will fix itself.  With devtmpfs, that /dev/fd symlink has to be
> created dynamically when the system inits and mounts devtmpfs on /dev.
> 
> In my mind, that symlink needs to be created at run-time if it doesn't
> exist.  A workaround, right now, would be to add that to a hook (post
> mount hook maybe?).  Longer term, I think that may need to be in the
> lxc-start code itself, right where we're populating the /dev directory
> with things like the pty's (is there any case where we would NOT want
> to do this?).  We could also add a start-up script into the container
> itself to do this as it inits but I would prefer keeping those kinds
> of interventions to a minimum.
> 
> I'd like to hear Dwight's thoughts on this wrt the Oracle template
> before we go down either road or another.
> 
> > > Every helpful comment would be highly appreciated
> > > Harri
> > 
> > Regards,
> > Mike
> 



More information about the lxc-devel mailing list