[lxc-devel] [PATCH] lxc-fedora template - systemd console gettys

Serge Hallyn serge.hallyn at ubuntu.com
Mon May 20 18:43:35 UTC 2013


Quoting Michael H. Warfield (mhw at 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 |  mhw at 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 <mhw at WittsEnd.com>

Acked-by: Serge E. Hallyn <serge.hallyn at 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?

> +    # 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 at tty${i}.service; done )
>  }
>  
>  download_fedora()
> 



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





More information about the lxc-devel mailing list