* [meta-oe][PATCH v2] classes: rootfs-postcommands: autologin root on serial-getty
@ 2022-07-26 9:39 Johannes Schneider
2022-07-26 18:28 ` [OE-core] " Andre McCurdy
2022-07-27 15:30 ` Ross Burton
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Schneider @ 2022-07-26 9:39 UTC (permalink / raw)
To: openembedded-core; +Cc: Johannes Schneider
when empty-root-password AND serial-autologin-root are part of the
IMAGE_FEATURES, save some of the developers time by not having to type
the (then still sole) 'root' username on the serial consoleafter each
and every reboot
this is done by inserting '--autologin root' into the command line of
the responsible 'getty' service
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
---
meta/classes/image.bbclass | 2 +-
meta/classes/rootfs-postcommands.bbclass | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 2139a7e576..fe32cdefd5 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -34,7 +34,7 @@ INHIBIT_DEFAULT_DEPS = "1"
# IMAGE_FEATURES may contain any available package group
IMAGE_FEATURES ?= ""
IMAGE_FEATURES[type] = "list"
-IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs read-only-rootfs-delayed-postinsts stateless-rootfs empty-root-password allow-empty-password allow-root-login post-install-logging overlayfs-etc"
+IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs read-only-rootfs-delayed-postinsts stateless-rootfs empty-root-password allow-empty-password allow-root-login serial-autologin-root post-install-logging overlayfs-etc"
# Generate companion debugfs?
IMAGE_GEN_DEBUGFS ?= "0"
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index a8a952f31d..e8e9661f58 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -8,6 +8,9 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'deb
# Allow dropbear/openssh to accept root logins if debug-tweaks or allow-root-login is enabled
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], "ssh_allow_root_login; ", "",d)}'
+# Autologin the root user on the serial console, if empty-root-password and serial-autologin-root are active
+ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", [ 'empty-root-password', 'serial-autologin-root' ], "serial_autologin_root; ", "",d)}'
+
# Enable postinst logging if debug-tweaks or post-install-logging is enabled
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'post-install-logging' ], "postinst_enable_logging; ", "",d)}'
@@ -196,6 +199,18 @@ ssh_allow_root_login () {
fi
}
+#
+# Autologin the 'root' user on the serial terminal,
+# if empty-root-password is enabled
+#
+serial_autologin_root () {
+ if [ -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service ]; then
+ sed -i '/^\s*ExecStart\b/ s/getty /&--autologin root /' \
+ "${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service"
+ fi
+}
+
+
python sort_passwd () {
import rootfspostcommands
rootfspostcommands.sort_passwd(d.expand('${IMAGE_ROOTFS}${sysconfdir}'))
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [meta-oe][PATCH v2] classes: rootfs-postcommands: autologin root on serial-getty
2022-07-26 9:39 [meta-oe][PATCH v2] classes: rootfs-postcommands: autologin root on serial-getty Johannes Schneider
@ 2022-07-26 18:28 ` Andre McCurdy
2022-07-27 15:30 ` Ross Burton
1 sibling, 0 replies; 4+ messages in thread
From: Andre McCurdy @ 2022-07-26 18:28 UTC (permalink / raw)
To: johannes.schneider; +Cc: OE Core mailing list
On Tue, Jul 26, 2022 at 2:39 AM Johannes Schneider via
lists.openembedded.org
<johannes.schneider=leica-geosystems.com@lists.openembedded.org>
wrote:
>
> when empty-root-password AND serial-autologin-root are part of the
> IMAGE_FEATURES, save some of the developers time by not having to type
> the (then still sole) 'root' username on the serial consoleafter each
> and every reboot
>
> this is done by inserting '--autologin root' into the command line of
> the responsible 'getty' service
>
> Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
> ---
> meta/classes/image.bbclass | 2 +-
> meta/classes/rootfs-postcommands.bbclass | 15 +++++++++++++++
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 2139a7e576..fe32cdefd5 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -34,7 +34,7 @@ INHIBIT_DEFAULT_DEPS = "1"
> # IMAGE_FEATURES may contain any available package group
> IMAGE_FEATURES ?= ""
> IMAGE_FEATURES[type] = "list"
> -IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs read-only-rootfs-delayed-postinsts stateless-rootfs empty-root-password allow-empty-password allow-root-login post-install-logging overlayfs-etc"
> +IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs read-only-rootfs-delayed-postinsts stateless-rootfs empty-root-password allow-empty-password allow-root-login serial-autologin-root post-install-logging overlayfs-etc"
>
> # Generate companion debugfs?
> IMAGE_GEN_DEBUGFS ?= "0"
> diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
> index a8a952f31d..e8e9661f58 100644
> --- a/meta/classes/rootfs-postcommands.bbclass
> +++ b/meta/classes/rootfs-postcommands.bbclass
> @@ -8,6 +8,9 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'deb
> # Allow dropbear/openssh to accept root logins if debug-tweaks or allow-root-login is enabled
> ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], "ssh_allow_root_login; ", "",d)}'
>
> +# Autologin the root user on the serial console, if empty-root-password and serial-autologin-root are active
> +ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", [ 'empty-root-password', 'serial-autologin-root' ], "serial_autologin_root; ", "",d)}'
> +
> # Enable postinst logging if debug-tweaks or post-install-logging is enabled
> ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'post-install-logging' ], "postinst_enable_logging; ", "",d)}'
>
> @@ -196,6 +199,18 @@ ssh_allow_root_login () {
> fi
> }
>
> +#
> +# Autologin the 'root' user on the serial terminal,
> +# if empty-root-password is enabled
Comment should be updated too "... if empty-root-password and
serial-autologin-root are both enabled".
> +#
> +serial_autologin_root () {
> + if [ -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service ]; then
> + sed -i '/^\s*ExecStart\b/ s/getty /&--autologin root /' \
> + "${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service"
> + fi
> +}
> +
> +
> python sort_passwd () {
> import rootfspostcommands
> rootfspostcommands.sort_passwd(d.expand('${IMAGE_ROOTFS}${sysconfdir}'))
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168502): https://lists.openembedded.org/g/openembedded-core/message/168502
> Mute This Topic: https://lists.openembedded.org/mt/92623778/3619030
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [armccurdy@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [meta-oe][PATCH v2] classes: rootfs-postcommands: autologin root on serial-getty
2022-07-26 9:39 [meta-oe][PATCH v2] classes: rootfs-postcommands: autologin root on serial-getty Johannes Schneider
2022-07-26 18:28 ` [OE-core] " Andre McCurdy
@ 2022-07-27 15:30 ` Ross Burton
2022-07-28 4:09 ` SCHNEIDER Johannes
1 sibling, 1 reply; 4+ messages in thread
From: Ross Burton @ 2022-07-27 15:30 UTC (permalink / raw)
To: johannes.schneider; +Cc: openembedded-core
> +serial_autologin_root () {
> + if [ -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service ]; then
> + sed -i '/^\s*ExecStart\b/ s/getty /&--autologin root /' \
> + "${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service"
> + fi
> +}
What about images using sysvinit?
Ross
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [meta-oe][PATCH v2] classes: rootfs-postcommands: autologin root on serial-getty
2022-07-27 15:30 ` Ross Burton
@ 2022-07-28 4:09 ` SCHNEIDER Johannes
0 siblings, 0 replies; 4+ messages in thread
From: SCHNEIDER Johannes @ 2022-07-28 4:09 UTC (permalink / raw)
To: Ross Burton; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1481 bytes --]
good question, haven't had a sysvinit system in ages... so no easy "let's test it on this platform" :-s
do you happen to have one?
should the patch include a warning to sysvinit users like "not supported" "config switch only applies to systemd" ... suggestions? (-:
the only sysvinit+getty reference i see in the code is ./meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
which relies on a symlinked getty - possibly provided by busybox or others?
regards
________________________________
From: Ross Burton <Ross.Burton@arm.com>
Sent: Wednesday, July 27, 2022 17:30
To: SCHNEIDER Johannes <johannes.schneider@leica-geosystems.com>
Cc: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [meta-oe][PATCH v2] classes: rootfs-postcommands: autologin root on serial-getty
[You don't often get email from ross.burton@arm.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
This email is not from Hexagon’s Office 365 instance. Please be careful while clicking links, opening attachments, or replying to this email.
> +serial_autologin_root () {
> + if [ -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service ]; then
> + sed -i '/^\s*ExecStart\b/ s/getty /&--autologin root /' \
> + "${IMAGE_ROOTFS}${systemd_system_unitdir}/serial-getty@.service"
> + fi
> +}
What about images using sysvinit?
Ross
[-- Attachment #2: Type: text/html, Size: 3856 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-28 4:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 9:39 [meta-oe][PATCH v2] classes: rootfs-postcommands: autologin root on serial-getty Johannes Schneider
2022-07-26 18:28 ` [OE-core] " Andre McCurdy
2022-07-27 15:30 ` Ross Burton
2022-07-28 4:09 ` SCHNEIDER Johannes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.