I would like to disable the serial console on my apalis imx6, to be able to reuse it for serial communication.
I need to do so because some serial ports of my board do not work “anymore” while they do work on another board. (problem explained here, haven’t managed to solve it yet Serial ports on Apalis imx6/Eagle Board from Diamond System)
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 firstname.lastname@example.org
● email@example.com - 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
Main PID: 568 (login)
‣ 568 /bin/login --
Sep 23 00:55:54 apalis-imx6 systemd: Started Serial Getty on ttymxc0.
Sep 23 01:09:26 apalis-imx6 login: 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 firstname.lastname@example.org
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?
Dear @JG2, how are you?
Did you have time to check this article on ou developer page: Configuring Serial Port Debug Console (Linux/U-Boot) | Toradex Developer Center? It talks about how to reduce the number of logs appearing in the console and also how to disable the user’s ability to add custom inputs to the serial console.
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:~# systemctl mask email@example.com
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 /firstname.lastname@example.org 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.
Many thanks again!
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.