diff --git a/manifests/serial/login.pp b/manifests/serial/login.pp
index 8275dc830df8566956e6c53175eb7f2d6737a477..870fba44cf8588fd3b37920672bbad2c835e751f 100644
--- a/manifests/serial/login.pp
+++ b/manifests/serial/login.pp
@@ -1,4 +1,4 @@
-# Copyright © 2018-2020   Thomas Bellman, Linköping, Sweden
+# Copyright © 2018-2021   Thomas Bellman, Linköping, Sweden
 # Licensed under the GNU LGPL v3+; see the README file for more information.
 
 
@@ -7,6 +7,8 @@
  *
  * Parameters:
  *  - name		Name of serial port device (without /dev/ prefix).
+ *  - getty_options	Options to pass to the getty process.
+ *			The defaults depend on the operating system.
  *  - ensure		One of 'enabled' (the default) or 'disabled'.
  *  - speeds		(List of) speeds in bits/second.
  *  - termtype		Default terminal type connected to the port.
@@ -15,6 +17,7 @@
  */
 define console::serial::login(
 	$ensure='enabled',
+	$getty_options=undef,
 	$speeds=[115200,38400,9600],
 	$termtype='vt100',
 	$rootlogin=undef,
@@ -34,7 +37,9 @@ define console::serial::login(
 	    console::serial::login::systemd {
 		$name:
 		    ensure => $ensure,
-		    speeds => $speeds, termtype => $termtype;
+		    getty_options => $getty_options,
+		    speeds => $speeds,
+		    termtype => $termtype;
 	    }
 	}
 
@@ -42,7 +47,9 @@ define console::serial::login(
 	    console::serial::login::rhel_6 {
 		$name:
 		    ensure => $ensure,
-		    speeds => $speeds, termtype => $termtype;
+		    getty_options => $getty_options,
+		    speeds => $speeds,
+		    termtype => $termtype;
 	    }
 	}
 
@@ -67,11 +74,26 @@ define console::serial::login(
 #
 define console::serial::login::systemd(
 	$ensure,
+	$getty_options=['--keep-baud'],	# This is the systemd default
 	$speeds,
 	$termtype,
 )
 {
     $svcdir = "/etc/systemd/system/serial-getty@${name}.service.d"
+    # Systemd cmdline quoting is not *exactly* like shell, but close enough.
+    $agetty_cmdline = shellquote(
+	# agetty(8) doc says tty name should be before speeds, but default
+	# systemd service definition puts %I after; do it like systemd does.
+	'/sbin/agetty',
+	$getty_options ? { undef => [], default => $getty_options, },
+	inline_template('<%= [@speeds].flatten.join(",") %>'),
+	'%I',
+	$termtype
+    )
+    $svc_params_cfg = (
+	"[Service]\nExecStart=\nExecStart=-${agetty_cmdline}\n"
+    )
+
     file {
 	$svcdir:
 	    ensure => $ensure ? {
@@ -83,11 +105,7 @@ define console::serial::login::systemd(
 	    ensure => $ensure ? {
 		'enabled' => file, 'disabled' => absent,
 	    },
-	    content => inline_template(
-		"[Service]\n",
-		"ExecStart=\n",
-		"ExecStart=-/sbin/agetty --keep-baud <%= [@speeds].flatten.join(',') %> %I <%= @termtype %>\n"
-	    ),
+	    content => $svc_params_cfg,
 	    owner => 'root', group => 'root', mode => '0444',
 	    notify => Service["serial-getty@${name}"];
     }
@@ -110,12 +128,20 @@ define console::serial::login::systemd(
 #
 define console::serial::login::rhel_6(
 	$ensure,
+	$getty_options=[],
 	$speeds,
 	$termtype
 )
 {
     $svcname = "serial-${name}"
-    $xspeeds = inline_template('<%= [@speeds].flatten.join(",") %>')
+    # Upstart uses shell if special characters in command so use shellquote().
+    $agetty_cmdline = shellquote(
+	'/sbin/agetty',
+	$getty_options ? { undef => [], default => $getty_options, },
+	"/dev/${name}",
+	inline_template('<%= [@speeds].flatten.join(",") %>'),
+	$termtype
+    )
 
     if ($ensure == 'enabled')
     {
@@ -125,7 +151,7 @@ define console::serial::login::rhel_6(
 	    'start on stopped rc RUNLEVEL=[2345]',
 	    'stop on starting runlevel [016]',
 	    'respawn',
-	    "exec /sbin/agetty /dev/${name} ${xspeeds} ${termtype}",
+	    "exec ${agetty_cmdline}",
 	]
 	file {
 	    "/etc/init/${svcname}.conf":