How to prevent logs from being displayed on tty* consoles?

Ask questions about Arch Linux ARM. Please search before making a new topic.

How to prevent logs from being displayed on tty* consoles?

Postby fogoh » Sat Dec 10, 2022 11:23 am

Hi,

I'm new to Archlinux and Archlinuxarm and I just installed Archlinuxarm on a Raspberry Pi 3b+. Everything is almost standard, haven't modified the base system.
I would like to use my rpi to start ncmpcpp on tty1 in order to control the mpd server installed on the same rpi. I've successfully created a systemd service to automatically start ncmpcpp on tty1 (instead of agetty), but I'm now confronted with a new issue and I don't know how-to solve it.
Logs are constantly displayed on the active tty (it seems that logs "follow" the current active tty because I still see new logs when I switch to another tty with alt-f*), and this makes ncmpcpp barely unusable.

I've tested to set "console=tty2" in /boot/boot.txt, and set "ForwardToConsole=no" and "ForwardToWall=no" in /etc/systemd/journald.conf, but this does not help.

Any advice will be appreciated.
fogoh
 
Posts: 2
Joined: Sat Dec 10, 2022 10:54 am

Re: How to prevent logs from being displayed on tty* console

Postby Rapty » Sat Dec 10, 2022 2:32 pm

Hi,

In cmdline.txt you should try to play with quiet and loglevel:
https://wiki.archlinux.org/title/Silent_boot

My guess is quiet is just enough, but maybe you want to be sure to have no log at all.
Rapty
 
Posts: 34
Joined: Sat Dec 26, 2020 5:31 pm

Re: How to prevent logs from being displayed on tty* console

Postby fogoh » Sat Dec 10, 2022 4:54 pm

Hi Rapty,

Many thanks for your reply. It pointed me in the right direction. I learned about the "logevel" kernel parameter and the corresponding sysctl ("kernel.printk").

$this->bbcode_second_pass_code('', '
[root@raspberrypi ~]# cat /proc/sys/kernel/printk
7 4 1 7
[root@raspberrypi ~]# sysctl -w kernel.printk=2
kernel.printk = 2
[root@raspberrypi ~]# cat /proc/sys/kernel/printk
2 4 1 7
')

So instead of changing the kernel parameter "loglevel" (in /boot/boot.txt in my case as I use uboot), I prefered to set the "kernel.printk" sysctl during the boot.

The value 2 for "kernel.printk" will still print EMERG, ALERT and CRIT messages on tty1, but I think it's a good compromise. The default value is 7, with this value all kernel messages are displayed on tty1 (even DEBUG).

So, I ended up creating the file "/etc/sysctl.d/local.conf" with the following line:
$this->bbcode_second_pass_code('', 'kernel.printk=2')

Thanks again.
fogoh
 
Posts: 2
Joined: Sat Dec 10, 2022 10:54 am

Re: How to prevent logs from being displayed on tty* console

Postby solskogen » Mon Dec 12, 2022 11:04 am

You can also add this to cmdline.txt

$this->bbcode_second_pass_code('', 'audit=0')
solskogen
 
Posts: 215
Joined: Mon Nov 18, 2013 10:41 am


Return to User Questions

Who is online

Users browsing this forum: No registered users and 31 guests