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

2011-01-27 Thread Serge E. Hallyn
Quoting Trent W. Buck (t...@cybersource.com.au):
 Serge E. Hallyn serge.hal...@canonical.com
 writes:
 
  Quoting Trent W. Buck (trentb...@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@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@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

--
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users


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

2011-01-26 Thread Trent W. Buck
Serge E. Hallyn serge.hal...@canonical.com
writes:

 Quoting Trent W. Buck (trentb...@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@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@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.


--
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users