Disable dmesg writing to console/tty

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

Disable dmesg writing to console/tty

Postby Mister Anderson » Thu Sep 21, 2023 1:47 am

Hi, I'm sure this gets asked but I must be using the wrong search terms because I don't see an answer.

How do I disable dmesg writing all of its messages to the console? I've just imaged a raspberry pi 4 and I just can't find any info that makes sense. I tried adding audit=0 to /boot/config.txt but I could be going completely wrong there.

The messages getting printed are exactly what is given from running dmesg.
Mister Anderson
 
Posts: 3
Joined: Thu Sep 21, 2023 1:00 am

Re: Disable dmesg writing to console/tty

Postby solskogen » Thu Sep 21, 2023 6:42 am

"audit=0" needs to go in cmdline.txt - you can also add "quiet" there.
solskogen
 
Posts: 161
Joined: Mon Nov 18, 2013 10:41 am

Re: Disable dmesg writing to console/tty

Postby Mister Anderson » Thu Sep 21, 2023 7:36 am

OK, I had to create /boot/cmdline.txt as it doesn't exist on the default install. I tried adding audit=0 at the beginning of the file, both with and without double quotes around it, and not seeing any difference.

I also tried adding quiet on the same line and on a second line. /boot/config.txt is almost completely empty too, just has the one line of enable_uart=1 in it.

Should I just take some copies from a standard rpi OS image and go from there?
Mister Anderson
 
Posts: 3
Joined: Thu Sep 21, 2023 1:00 am

Re: Disable dmesg writing to console/tty

Postby solskogen » Thu Sep 21, 2023 7:52 am

Oh, you using the mainline kernel. I would rather recommend you to install the linux-rpi kernel. I don't remember where you add kernel command line options with u-boot.
solskogen
 
Posts: 161
Joined: Mon Nov 18, 2013 10:41 am

Re: Disable dmesg writing to console/tty

Postby Mister Anderson » Fri Sep 22, 2023 1:24 pm

Ah I see, I'll have to look more into u-boot. I need to run a 64-bit install for what I'm doing so I can't swap to the armv7 kernel.

I've worked out that after running mkscr in /boot, it created a boot.txt file which has the kernel options and can be configured from there.

Anyway, audit=0 seems to make no difference, but quiet reduces the messages a lot. I ended up making a /etc/sysctl.d/20-quiet-printk.conf file (as per this post:make_clickable_callback(MAGIC_URL_FULL, ' ', 'https://bbs.archlinux.org/viewtopic.php?pid=1793637#p1793637', '', ' class="postlink"')) so I can avoid the quiet flag and still have the boot messages show, using 4 4 1 4 as the options. Now I get a single message about brcmf which I can look into separately.

Thanks for your help.
Mister Anderson
 
Posts: 3
Joined: Thu Sep 21, 2023 1:00 am

Re: Disable dmesg writing to console/tty

Postby solskogen » Sun Sep 24, 2023 1:02 pm

The linux-rpi kernel is for arm64/aarch64 as well.
solskogen
 
Posts: 161
Joined: Mon Nov 18, 2013 10:41 am

Re: Disable dmesg writing to console/tty

Postby technosf » Mon Sep 25, 2023 7:52 pm

I turn off dmesg to console when I log via console, and turn it on when I exit. My pref is to have console dmesg available without logging in for emergency purposes.

Add this to ur .bash_profile

if [ `tty` == "/dev/ttyS0" ];
then
dmesg -D
fi;


And add this .bash_logout

#! /bin/bash

if [[ `tty` == "/dev/ttyS0" ]]
then
dmesg -E
fi;
[size=85] MochaBin 5G || NSA325 [/size]
technosf
 
Posts: 133
Joined: Sat Jan 08, 2011 10:54 pm


Return to User Questions

Who is online

Users browsing this forum: Google [Bot] and 7 guests