On Mon, 2013-05-20 at 13:43 -0500, Serge Hallyn wrote:
> Quoting Michael H. Warfield (m...@wittsend.com):
> > Hey all...
> > 
> > Patch to the lxc-fedora template to setup gettys on the ttys that are
> > enabled in the configuration.  The area of the code already had some
> > modifications to that service that didn't seem to do anything and would
> > get wiped out by an update.  I commented that out but subsumed the
> > change it was attempting into my command in case it does something on
> > another rev somewhere.
> > 
> > This is very similar to the logic in the OpenSuse template but doesn't
> > seem to appear in other templates, such as arch, which have to deal with
> > systemd.  This isn't unique to Fedora.  The templates for Fedora,
> > ArchLinux, and OpenSuse are the only three that seem to have any
> > reference to systemd at all.
> > 
> > Attached below the jump.
> > 
> > Regards,
> > Mike
> > -- 
> > Michael H. Warfield (AI4NB) | (770) 985-6132 |  m...@wittsend.com
> >    /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
> >    NIC whois: MHW9          | An optimist believes we live in the best of 
> > all
> >  PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
> > -- 
> > 
> > Signed-off-by: Michael H. Warfield <m...@wittsend.com>

> Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com>

> > 
> > --- 
> > diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
> > index 710039c..481f718 100644
> > --- a/templates/lxc-fedora.in
> > +++ b/templates/lxc-fedora.in
> > @@ -143,7 +143,24 @@ configure_fedora_systemd()
> >      chroot ${rootfs_path} ln -s /dev/null //etc/systemd/system/udev.service
> >      chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target 
> > /etc/systemd/system/default.target
> >      #dependency on a device unit fails it specially that we disabled udev
> > -    sed -i 's/After=dev-%i.device/After=/' 
> > ${rootfs_path}/lib/systemd/system/getty\@.service
> > +    # sed -i 's/After=dev-%i.device/After=/' 
> > ${rootfs_path}/lib/systemd/system/getty\@.service
> > +    #
> > +    # Actually, the After=dev-%i.device line does not appear in the
> > +    # Fedora 17 or Fedora 18 systemd getty\@.service file.  It may be left
> > +    # over from an earlier version and it's not doing any harm.  We do need
> > +    # to disable the "ConditionalPathExists=/dev/tty0" line or no gettys 
> > are
> > +    # started on the ttys in the container.  Lets do it in an override 
> > copy of
> > +    # the service so it can still pass rpm verifies and not be 
> > automatically

> Stupid systemd question - I assume based on this that the override copy
> is /etc/somepath and the original is /lib/somepath?

Yes, that appears to be correct.  If something already exists
under /etc/systemd/ then it is used and has priority.  If it doesn't,
then /lib/systemd/ is used.

I think the same sort of paradigm applies to udev rules and some other
OS internals we've "come to know and love" down through the years.  I
can't say I disagree with the methodology in that regards.  I gleaned
some of this from a URL about system "generators" that was posted in one
of the messages over on the -users list.

Adhering to this convention then also works (should work) with systemctl
where "enable" creates those links.  If someone creates additional ttys,
they can then call "systemctl enable getty@ttyN.service and it should
create the correct symbolic link to the /etc/system/system file rather
than the /lib/systemd/system fallback (except that it's not quite
working and I'm still figuring out the command syntax for that).
Conversely, "systemctl disable getty@ttyN.service" removes the link
(tested and it does) and "mask" creates a link to /dev/null to prevent
an accidental creation from some other source.

> > +    # updated by a new systemd version.  --  mhw  /\/\|=mhw=|\/\/
> > +
> > +    sed -e 's/^ConditionPathExists=/# ConditionPathExists=/' \
> > +        -e 's/After=dev-%i.device/After=/' \
> > +   < ${rootfs_path}/lib/systemd/system/getty\@.service \
> > +   > ${rootfs_path}/etc/systemd/system/getty\@.service
> > +    # Setup getty service on the 4 ttys we are going to allow in the
> > +    # default config.  Number should match lxc.tty
> > +    ( cd ${rootfs_path}/etc/systemd/system/getty.target.wants
> > +        for i in 1 2 3 4 ; do ln -sf ../getty\@.service 
> > getty@tty${i}.service; done )
> >  }
> >  
> >  download_fedora()

Regards,
Mike
-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  m...@wittsend.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to