| Message ID | 20251129035436.249679-2-Qi.Chen@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | [V2,1/2] rootfs-postcommands.bbclass: fix adding 'no password' banner | expand |
On Sat, 29 Nov 2025 at 04:54, Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote: > The '\n' means hostname instead of new line in /etc/issues. > - echo "Type 'root' to login with superuser privileges (no password will be asked).\n" >> ${IMAGE_ROOTFS}/etc/issue > + echo "Type 'root' to login with superuser privileges (no password will be asked)." >> ${IMAGE_ROOTFS}/etc/issue \n does not actually make it into /etc/issue and does get converted to a newline (as intended) somewhere on the way: alex@Zen2:/srv/storage/alex/yocto/build-64$ cat tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/rootfs/etc/issue Poky (Yocto Project Reference Distro) 5.2.99+snapshot-449cd68248749daedc9990c4094ef5577907ea3d \n \l Type 'root' to login with superuser privileges (no password will be asked). alex@Zen2:/srv/storage/alex/yocto/build-64$ Is that not the case in your build? Alex
Hi Alex, Without this patch: In build directory: $ cat tmp/work/qemux86_64-poky-linux/core-image-full-cmdline/1.0/rootfs/etc/issue Poky (Yocto Project Reference Distro) 5.2.99+snapshot-0cd922ad0f9cf59226660c30b1db07e23c09460c \n \l Type 'root' to login with superuser privileges (no password will be asked).\n On target: Poky (Yocto Project Reference Distro) 5.2.99+snapshot-0cd922ad0f9cf59226660c30b1db07e23c09460c qemux86-64 ttyS0 Type 'root' to login with superuser privileges (no password will be asked).qemux86-64 Regards, Qi -----Original Message----- From: Alexander Kanavin <alex.kanavin@gmail.com> Sent: Saturday, November 29, 2025 9:20 PM To: Chen, Qi <Qi.Chen@windriver.com> Cc: openembedded-core@lists.openembedded.org; alex@linutronix.de Subject: Re: [OE-core][PATCH V2 2/2] rootfs-postcommands.bbclass: remove the '\n' in 'no password' banner On Sat, 29 Nov 2025 at 04:54, Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote: > The '\n' means hostname instead of new line in /etc/issues. > - echo "Type 'root' to login with superuser privileges (no password will be asked).\n" >> ${IMAGE_ROOTFS}/etc/issue > + echo "Type 'root' to login with superuser privileges > + (no password will be asked)." >> ${IMAGE_ROOTFS}/etc/issue \n does not actually make it into /etc/issue and does get converted to a newline (as intended) somewhere on the way: alex@Zen2:/srv/storage/alex/yocto/build-64$ cat tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/rootfs/etc/issue Poky (Yocto Project Reference Distro) 5.2.99+snapshot-449cd68248749daedc9990c4094ef5577907ea3d \n \l Type 'root' to login with superuser privileges (no password will be asked). alex@Zen2:/srv/storage/alex/yocto/build-64$ Is that not the case in your build? Alex
Hi Alex, I think I know what's going on here. Your sh symlinks to dash, right? It seems that bash and dash have different behavior on echo + '\n'. I'll send out V3 so that both dash and bash work as expected. Regards, Qi -----Original Message----- From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Chen Qi via lists.openembedded.org Sent: Saturday, November 29, 2025 10:24 PM To: Alexander Kanavin <alex.kanavin@gmail.com> Cc: openembedded-core@lists.openembedded.org; alex@linutronix.de Subject: Re: [OE-core][PATCH V2 2/2] rootfs-postcommands.bbclass: remove the '\n' in 'no password' banner Hi Alex, Without this patch: In build directory: $ cat tmp/work/qemux86_64-poky-linux/core-image-full-cmdline/1.0/rootfs/etc/issue Poky (Yocto Project Reference Distro) 5.2.99+snapshot-0cd922ad0f9cf59226660c30b1db07e23c09460c \n \l Type 'root' to login with superuser privileges (no password will be asked).\n On target: Poky (Yocto Project Reference Distro) 5.2.99+snapshot-0cd922ad0f9cf59226660c30b1db07e23c09460c qemux86-64 ttyS0 Type 'root' to login with superuser privileges (no password will be asked).qemux86-64 Regards, Qi -----Original Message----- From: Alexander Kanavin <alex.kanavin@gmail.com> Sent: Saturday, November 29, 2025 9:20 PM To: Chen, Qi <Qi.Chen@windriver.com> Cc: openembedded-core@lists.openembedded.org; alex@linutronix.de Subject: Re: [OE-core][PATCH V2 2/2] rootfs-postcommands.bbclass: remove the '\n' in 'no password' banner On Sat, 29 Nov 2025 at 04:54, Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote: > The '\n' means hostname instead of new line in /etc/issues. > - echo "Type 'root' to login with superuser privileges (no password will be asked).\n" >> ${IMAGE_ROOTFS}/etc/issue > + echo "Type 'root' to login with superuser privileges > + (no password will be asked)." >> ${IMAGE_ROOTFS}/etc/issue \n does not actually make it into /etc/issue and does get converted to a newline (as intended) somewhere on the way: alex@Zen2:/srv/storage/alex/yocto/build-64$ cat tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/rootfs/etc/issue Poky (Yocto Project Reference Distro) 5.2.99+snapshot-449cd68248749daedc9990c4094ef5577907ea3d \n \l Type 'root' to login with superuser privileges (no password will be asked). alex@Zen2:/srv/storage/alex/yocto/build-64$ Is that not the case in your build? Alex
On Sat, Nov 29 2025 at 15:43:17 +00:00:00, Chen Qi via lists.openembedded.org <Qi.Chen=windriver.com@lists.openembedded.org> wrote: > I think I know what's going on here. > Your sh symlinks to dash, right? > > It seems that bash and dash have different behavior on echo + '\n'. bash's ‘echo’ requires the ‘-e’ option so that \n is interpreted as new line.
diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass index bcc25798b9..3c4edc0301 100644 --- a/meta/classes-recipe/rootfs-postcommands.bbclass +++ b/meta/classes-recipe/rootfs-postcommands.bbclass @@ -262,7 +262,7 @@ add_empty_root_password_note () { rootpw="`grep '^root:' ${IMAGE_ROOTFS}/etc/shadow | cut -d':' -f2`" rootpw_lastchanged="`grep "^root:" ${IMAGE_ROOTFS}/etc/shadow | cut -d: -f3`" if [ -z "$rootpw" -a "$rootpw_lastchanged" != "0" ]; then - echo "Type 'root' to login with superuser privileges (no password will be asked).\n" >> ${IMAGE_ROOTFS}/etc/issue + echo "Type 'root' to login with superuser privileges (no password will be asked)." >> ${IMAGE_ROOTFS}/etc/issue fi }