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

Michael H. Warfield mhw at WittsEnd.com
Mon May 20 16:04:38 UTC 2013


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>

--- 
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
+    # 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()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130520/f3046376/attachment.pgp>


More information about the lxc-devel mailing list