I would like to disable the current serial port once logged into the board rather that changing the uEnv in the uboot, because I’m scared of not being able to have access to the uboot again.
I see there is this service running:
root@apalis-imx6:/etc/systemd/system/getty.target.wants# systemctl status serial-getty@ttymxc0.service
● serial-getty@ttymxc0.service - Serial Getty on ttymxc0
Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-09-23 00:55:54 UTC; 14min ago
Docs: man:agetty(8)
man:systemd-getty-generator(8)
http://0pointer.de/blog/projects/serial-console.html
Main PID: 568 (login)
CGroup: /system.slice/system-serial\x2dgetty.slice/serial-getty@ttymxc0.service
‣ 568 /bin/login --
Sep 23 00:55:54 apalis-imx6 systemd[1]: Started Serial Getty on ttymxc0.
Sep 23 01:09:26 apalis-imx6 login[568]: pam_unix(login:session): session ope...0)
Hint: Some lines were ellipsized, use -l to show in full.
But I can’t disable it:
root@apalis-imx6:/etc/systemd/system/getty.target.wants# systemctl disable serial-getty@ttymxc0.service
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was reached (g-io-error-quark, 24)
Failed to execute operation: Connection timed out
My questions are :
How can I disable the serial console on port /dev/ttymxc0 once logged into the board instead of at uboot?
If I were to set console=null in the uboot, does that mean I have lost forever the access to uboot?
Moreover, I tested disabling the serial console on one of our modules and indeed I couldn’t send any command but I was able to enter u-boot and also connect through SSH to the module.
In addition, can you please confirm which BSP Version are you using? As you can see on the same page there may be additional steps depending on the BSP such as masking one service in addition to the first disable. This should do the trick of disabling the serial console. To reenable it you’d probably need to connect via ssh to your module.
About the specific questions:
You could use fw_setenv tdxargs 'console=null' as described in our article to disable some of the console output. This function allows you to edit some variables that you’d usually only have access to in U-boot after boot and log-in. You could also try to set a service that does this like here: how to disable serial console after successful boot (systemd/grub2) - Server Fault.
The referred article on our website states the following:
“Note: Enabling silent console just bypasses the console messages to null. Depending on the module type and U-Boot version you might still be able to interrupt U-Boot by pressing the specified key which allows you to control the U-Boot at run time.”
There are also indications of the commands to re-enable serial output.
Please tell me if this helps or if you need any further assistance.
Many thanks for your answer! Doing well and you? Very grateful for your help
I hadn’t checked this article you mentioned but now I have.
I did these:
root@apalis-imx6:~# fw_setenv tdxargs 'console=null'
Warning: Bad CRC, using default environment
root@apalis-imx6:~#
root@apalis-imx6:~# systemctl mask serial-getty@ttymxc0.service
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Activation of org.freedesktop.PolicyKit1 timed out (g-dbus-error-quark, 20)
Created symlink from /etc/systemd/system/serial-getty@ttymxc0.service to /dev/null.
I don’t think the fw_setenv tdxargs ‘console=null’ command worked, but using the systemctl mask did.
My Linux Kernel version is 3.14.x.
So on boot off the board, I see some stuff happening on the serial console, but then it doesn’t ask me to log in and I can use the serial port for something else.
I’m also good, thanks . I’m glad I could help you with your issue.
If you recompiled your u-boot as described in the article it should at least reduce the number of messages appearing in the console but maybe some of them would still appear as you’re presencing. It was at least what happened to me when I did a quick test yesterday.