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

Serge E. Hallyn serge.hallyn at canonical.com
Wed Jan 26 14:06:39 UTC 2011


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
>     description "LXC vs. Upstart workarounds"
>     start on startup
>     task
>     console output
>     script
>      # As lxc 0.7's halt/reboot detection hack needs /var/run to NOT be a
>      # tmpfs, we need to manually clean it -- esp. the ifstate file that
>      # tells falsely tells ifupdown "lo is up".
>      #
>      # To debug, add -printf "Deleting stale file %p\n" before -delete.
>      find /var/run/ -xdev -not -path /var/run/ -delete
>      initctl emit -n stopped JOB=udevtrigger
>      initctl emit -n started JOB=udev
>      # This one is needed for broken ifupdown NMU 0.6.8ubuntu29.1
>      initctl emit -n net-device-up IFACE=lo LOGICAL=lo ADDRFAM=inet
>      METHOD=loopback
>     end script
> 
> The screen-cleanup job is
> 
>     root at imago:~# grep -v ^$ /etc/init/screen-cleanup.conf
>     # screen
>     description "GNU Screen Cleanup"
>     author "Dustin Kirkland <kirkland at canonical.com>"
>     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
>       find $SCREENDIR -type p -delete
>       # If the local admin has used dpkg-statoverride to install the screen
>       # binary with different set[ug]id bits, change the permissions of
>       # $SCREENDIR accordingly
>       BINARYPERM=`stat -c%a /usr/bin/screen`
>       if [ "$BINARYPERM" -ge 4000 ]; then
>         chmod 0755 $SCREENDIR
>       elif [ "$BINARYPERM" -ge 2000 ]; then
>         chmod 0775 $SCREENDIR
>       else
>         chmod 0777 $SCREENDIR
>       fi
>     end script
> 
> 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.

> its events at the end of /etc/init/lxc.conf.  mountall.conf is currently
> a noop -- I don't allow containers to perform mounts -- but I left it
> enabled because it generates a whole bunch of events and I haven't
> gotten around to working out exactly what they are yet.
> 
> 
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
> February 28th, so secure your free ArcSight Logger TODAY! 
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users




More information about the lxc-users mailing list