[Lxc-users] upstart /etc/init/screen-cleanup.conf

Serge E. Hallyn serge.hallyn at canonical.com
Thu Jan 27 17:48:54 UTC 2011


Quoting Trent W. Buck (twb at cybersource.com.au):
> "Serge E. Hallyn" <serge.hallyn at canonical.com>
> writes:
> 
> > Quoting Trent W. Buck (trentbuck at gmail.com):
> >> A race condition in my containers means that occasionally
> >> /var/run/screen/ isn't present when startup finishes and I SSH in.
> >> This results in an error when normal users try to run screen.
> >> 
> >> I believe the race is against my lxc integration job:
> >> 
> >>     root at imago:~# cat /etc/init/lxc.conf
> >>     start on startup
> >>     task
> >>     script
> >>     [...]
> >>      find /var/run/ -xdev -not -path /var/run/ -delete
> >> 
> >> The screen-cleanup job is
> >> 
> >>     root at imago:~# grep -v ^$ /etc/init/screen-cleanup.conf
> >>     start on filesystem
> >>     task
> >>     script
> >>       SCREENDIR=/var/run/screen
> >>       if [ -L $SCREENDIR ] || [ ! -d $SCREENDIR ]; then
> >>         rm -f $SCREENDIR
> >>         mkdir $SCREENDIR
> >>         chown root:utmp $SCREENDIR
> >>       fi
> >>       [...]
> >> 
> >> Obviously the *right* solution is to use a tmpfs for /var/run, as
> >> non-containerized Ubuntu does.  Since this breaks lxc-start's
> >> reboot/halt (via utmp) detection, I'm looking for the next best
> >> workaround.
> >> 
> >> I think this is probably to disable /etc/init/mountall.conf and spoof
> >
> > If you're saying that what you need is for this to run before mountall.conf,
> > then you can make sure that screen-cleanup.conf finishes before mountall
> > starts by making it
> >
> > 	start on starting mountall
> >
> > Then it will finish before mountall really starts.
> 
> screen-cleanup creates /var/run/screen -- it needs to run *after*
> lxc.conf deletes everything in /var/tmp.  It (lxc) does that to simulate
> mounting a tmpfs on /var/run, which is something the mountall job
> normally does, and what it normally emits a filesystem event after.
> 
> But with the lxc job above, /var/run is deleted asynchronously from the
> mountall run, meaning that screen-cleanup can earlier.  Changing
> screen-cleanup to depend on anything mountall emits wouldn't help,
> AFAICT -- and more to the point, it'd only fix screen-cleanup and not
> arbitrary other jobs that might be created when a new package is
> installed.

I'm not groking what order you want/need upstart jobs to run in,
I just wanted to make sure that you knew you had quite a bit of
power in specifying the order.

>From the above it sounds like you actually might want to have
lxc.conf start on starting mountall, and have IT mkdir -p /var/run/screen.

-serge




More information about the lxc-users mailing list