How to remove getty@tty1 link in yocto dunfell branch

Hii @jaski.tx

I am building linux system for raspberrypi4
but for some reason I need to remove getty@tty1 service in yocto.
I have created system_%.bbappend file for that (attached).

this is working on Host pc ubuntu 18.04 with warrior branch

but now i’m moved on ubuntu 20.4, so warrior branch not working on ubuntu 20.4
so I am trying to compile with dunfell branch in yocto

but at the time of systemd compiling it gives an error like "Can’t remove /etc/systemd/system/getty.target.wants/getty@tty1, no such file or deirectory

Thanks
Margish

link text

Hi @margish

Thanks for writing to the Toradex community!
Sorry but this forum is for Toradex Products only.

Best regards,
Jaski

Hi,

I am facing exactly the same problem with my Iris carrier board 2.0 and Colibri iMX8DX 1.0D. I am working with BSP 5, Yocto dunfell branch, using the latest versions of kernel, u-boot and device tree overlays listed here.

I have successfully managed to show my custom logo on RGB display, using slightly modified Referential minimal image. The problem is it requires to disable getty@tty1.service to get rid of the “login screen”. For the testing purpose, I have done this manually using command

systemctl disable getty@tty1.service

Unfortunately, this will be insufficient in the future and I need to get rid of it when the custom image is created.

Uncle Google provides the results identical with this community suggestion from 2019. User @margish posted the same question on different forums but what I found, nobody replied to it.
Normally, when the image is compiled, I can find getty.target.wants folder in

build/tmp/work/colibri_imx8x-tdx-linux/<image name>/1.0-r0/rootfs/etc/systemd/system

with serial-getty@ttymxc0.service and getty@tty1.service. So I tried to create a .bbappend file for systemd-serialgetty.bb, with a little bit modified path

do_install_append() {
    rm ${D}${systemd_unitdir}/system/getty.target.wants/getty@tty1.service
}

REQUIRED_DISTRO_FEATURES= "systemd"

with no success. I tried to append also systemd recipe with the same code. Again, no success. I was not able to find out in the layers folder data, how exactly getty@tty1.service appears in the correct /etc/ folder.
My colibri-imx8x.conf file contains this part

# we do not want to have getty running on tty1 as we run
# auto-serial-console there
USE_VT = "0"

1. Is it possible to use this option somehow to switch to different tty[0-9] to suppress the tty1 service output?
2. Is there any description why do_install_append does not work and how to bypass it?

I have also found this patch with catching title. The solution seems to be using kernel command line option splash. I am not using splash at all.
Does anybody have any example how to work with a kernel cmd options? I would like to test this approach but I have no idea, where to start. I have checked the source code of the whole meta-layer of the patch but I have found nothing useful.

Thank you in advance for any hint or advice.
Best regards,
John

Greetings @John1!

The way I would approach this would be by tweaking the U-Boot environment variables and disabling the framebuffer console entirely. This article shows how to do it manually. Then you can just turn this into a U-Boot patch, since these are usually defined in the corresponding board source. If you’re using the generated Toradex Easy Installer image, you can also edit uEnv.txt after the image is generated.

Let me know if this works for you.

@John1,

Something else has caught my attention here. It seems that the systemd-serialgetty.bb recipe does not generate getty@tty1.service directly or at least it’s not there when your bbappend is applied. The relevant code seems to start here, so what I would try to do is to append the do_rootfs task instead of the specific service do_install task. This would guarantee that your removal of the .service file would happen after the task is done and the corresponding file is there.

Hi @gustavo.tx,

thank you for your comments.
You are right, serialgetty recipe does not work with getty@.service at all. In the past, whole getty thing was probably handled differently.
Fortunately, I spotted ROOTFS_POSTPROCESS_COMMAND in my custom image recipe, which is derived from tdx-reference-minimal-image.bb.
I have created minimal-image-base.inc file with this content:

# add the rootfs version to the welcome banner
ROOTFS_POSTPROCESS_COMMAND += "add_rootfs_version; "
ROOTFS_POSTPROCESS_COMMAND += "remove_tty1_service; "

# remove getty@tty1.service and getty@.service
remove_tty1_service () {
    rm -f ${IMAGE_ROOTFS}/lib/systemd/system/getty@.service
    rm -f ${IMAGE_ROOTFS}/etc/systemd/system/getty.target.wants/getty@tty1.service
}

add_rootfs_version () {
    printf "${DISTRO_NAME} ${DISTRO_VERSION} (${DISTRO_CODENAME}) \\\n \\\l\n" > ${IMAGE_ROOTFS}/etc/issue
    printf "${DISTRO_NAME} ${DISTRO_VERSION} (${DISTRO_CODENAME}) %%h\n" > ${IMAGE_ROOTFS}/etc/issue.net
    printf "${IMAGE_NAME}\n\n" >> ${IMAGE_ROOTFS}/etc/issue
    printf "${IMAGE_NAME}\n\n" >> ${IMAGE_ROOTFS}/etc/issue.net
}

add_rootfs_version already existed in the recipe, so I just added my remove_tty1_service function.

This inc file has to be added to an image recipe via require minimal-image-base.inc. With this file, it works. I needed to get rid of the command prompt, this solution is (so far) sufficient for me.
I have not added my solution earlier, because I was messing with a “multimedia” image based on my working “minimal” image. And because I wanted to try wayland support with opengl without X11, I wanted to be sure that weston will work, including weston-touch-calibrator. Because I found on the net that weston requires tty1 to run, I was not sure if my approach with getty@tty1.service will be ok.

But, everything runs well, my display is calibrated, demo cinematicexperience runs on 60 fps smoothly.

1 Like

Hi @John1!

That’s an interesting solution, thanks for sharing. Glad that everything is running well.