# Stop dmesg outputting to tty display after logging in (turn down loglevel)

**URL:** https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558
**Category:** General Discussions
**Tags:** yocto, raspberry-pi-4, kirkstone
**Created:** [February 15, 2024, 4:10pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558 "2024-02-15T16:10:33Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![pyxlwuff](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)
#### Post date: [February 15, 2024, 4:10pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/1 "2024-02-15T16:10:33Z")

</div>

Hi there,

Is there any way with Yocto to turn down the log level of what’s outputted to the console? Trying to edit configs or do small tests can get frustrating quickly when you have dmesg suddenly deciding to drop a log message or two on your display

---

<div class="post-metadata">

### Author: ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)
#### Post date: [February 15, 2024, 5:32pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/2 "2024-02-15T17:32:01Z")

</div>

Do cat /proc/cmdline and see if console=tty… shows up.

Also you should disable the serial terminal services:  
systemctl disable getty@ttyDevice  
Regards to yocto, it depends what hardware platform you are using. cmdline.txt is used on raspberry pi to send kernel arguments. If you have that, check if console is specified there.

---

<div class="post-metadata">

### Author: ![pyxlwuff](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)
#### Post date: [February 16, 2024, 4:08pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/3 "2024-02-16T16:08:07Z")

</div>

What i’m trying to do is turn the log level down to stop the flooding of messages in the console (apologies if that wasn’t made clear enough in the initial post), but I haven’t been able to find a way to do that in Yocto at the moment. I initially tried making a bbappend to the generator of the cmdline.txt file in meta-raspberrypi but that would end up stopping mender from generating its images and artifact files for some reason.

---

<div class="post-metadata">

### Author: ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)
#### Post date: [February 16, 2024, 4:40pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/4 "2024-02-16T16:40:54Z")

</div>

just do loglevel=x in cmdline.txt.  
CMDLINE\_SERIAL=“loglevel=x”

```auto
loglevel= All Kernel Messages with a loglevel smaller than the
                    console loglevel will be printed to the console. It can
                    also be changed with klogd or other programs. The
                    loglevels are defined as follows:

                    0 (KERN_EMERG) system is unusable
                    1 (KERN_ALERT) action must be taken immediately
                    2 (KERN_CRIT) critical conditions
                    3 (KERN_ERR) error conditions
                    4 (KERN_WARNING) warning conditions
                    5 (KERN_NOTICE) normal but significant condition
                    6 (KERN_INFO) informational
                    7 (KERN_DEBUG) debug-level messages

```

or apply it in your kernel configuration.

---

<div class="post-metadata">

### Author: ![pyxlwuff](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)
#### Post date: [February 16, 2024, 4:52pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/5 "2024-02-16T16:52:30Z")

</div>

`cmdline.txt` Has no way of modifying it through meta-raspberrypi, i’m looking for a way to do it in a recipe of my own

---

<div class="post-metadata">

### Author: ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)
#### Post date: [February 16, 2024, 5:05pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/6 "2024-02-16T17:05:06Z")

</div>

> [@emilm](#):
>
> CMDLINE\_SERIAL

Yes it does. I mean CMDLINE , sorry  
You use this in your distro / machine config.

Check meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb for reference.

---

<div class="post-metadata">

### Author: ![pyxlwuff](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)
#### Post date: [February 16, 2024, 6:46pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/7 "2024-02-16T18:46:30Z")

</div>

Yep, that’s what I tried initially, but that would end up stopping mender from generating its images and artifact files for some reason. Looking at meta-mender-raspberrypi it seems they have their _own_ bbappend file for it doing rootfs allocation. Could it be cancelling each other out?

---

<div class="post-metadata">

### Author: ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)
#### Post date: [February 16, 2024, 7:09pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/8 "2024-02-16T19:09:26Z")

</div>

Depends what distro you are on. meta-mender from kirkstone does not mess with cmdline but dunfell does.

> <https://github.com/mendersoftware/meta-mender/blob/dunfell/meta-mender-raspberrypi/recipes-kernel/linux/linux-raspberrypi-mender.inc>

How does your CMDLINE look like? And where did you put it ? And what does the resulting cmdline.txt look like in your end? What yocto distro? What mender version? You need to provide some info man

---

<div class="post-metadata">

### Author: ![pyxlwuff](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)
#### Post date: [February 16, 2024, 7:53pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/9 "2024-02-16T19:53:21Z")

</div>

Apologies:

- I’m using the Kirkstone branch of Yocto & meta-mender ([which also does modify the CMDLINE](https://github.com/mendersoftware/meta-mender/blob/kirkstone/meta-mender-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bbappend))
- I’m using the default poky distro as the base
- I made a bbappend file for meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb in my own layer, which appends " loglevel=1 " to the full cmdline.txt that gets generated. This segment causes mender to stop producing its own artifact files and image, and bitbake will only produce a .wic file. The edit _does_ however, show up when I inspect the cmdline.txt file it generates in the deploy folder.
- meta-mender builds 3.5.2 for me I believe

---

<div class="post-metadata">

### Author: ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)
#### Post date: [February 16, 2024, 8:21pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/10 "2024-02-16T20:21:49Z")

</div>

Ok, thing is that it looks like stock for me with kirkstone, so how does your cmdline.txt look like?

---

<div class="post-metadata">

### Author: ![pyxlwuff](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)
#### Post date: [February 16, 2024, 8:49pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/11 "2024-02-16T20:49:19Z")

</div>

It’s near enough thes tock cmdline.txt that gets generated , has /dev/mmcblk0p2 as the initial rootfs, doesn’t mention a console argument, has the rootfs type, etc. Don’t have it with me right now but that’s basically what it was. Add loglevel=1 to the end of that when I tried the .bbappend method, which would stop mender from doing its stuff.

---

<div class="post-metadata">

### Author: ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)
#### Post date: [February 16, 2024, 9:00pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/12 "2024-02-16T21:00:53Z")

</div>

I am not sure if the order of things in cmdline.txt matters.  
Did you try to move it before?

---

<div class="post-metadata">

### Author: ![pyxlwuff](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)
#### Post date: [February 16, 2024, 10:20pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/13 "2024-02-16T22:20:24Z")

</div>

The bbappend will always put it last. The issue is mender suddenly not wanting to make its images or artifacts anymore after I make that bbappend. When I get rid of it (and forcefully reimport my layer l) mender goes back to generating its images and artifacts again. I’ve also tried forcefully adding and removing it with the append there, but that still causes meta-mender not to make anything.

---

<div class="post-metadata">

### Author: ![emilm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/emilm/32/449_2.png) [@emilm](https://hub.mender.io/u/emilm)
#### Post date: [February 16, 2024, 10:54pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/14 "2024-02-16T22:54:15Z")

</div>

I don’t set it in a recipe, I set it in the machine. But that is CMDLINE\_SERIAL.  
Kinda hard to help if you don’t show me your layer or the error message + log.

The only references to CMDLINE are those, so it shouldn’t break because of mender…

```auto
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_DWC_OTG ?= "dwc_otg.lpm_enable=0"
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_ROOT_FSTYPE ?= "rootfstype=ext4"
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_ROOTFS ?= "root=/dev/mmcblk0p2 ${CMDLINE_ROOT_FSTYPE} rootwait"
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_SERIAL ?= "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}"
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_CMA ?= "${@oe.utils.conditional("RASPBERRYPI_CAMERA_V2", "1", "cma=64M", "", d)}"
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_CMA ?= "${@oe.utils.conditional("RASPBERRYPI_HD_CAMERA", "1", "cma=64M", "", d)}"
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_PITFT ?= "${@bb.utils.contains("MACHINE_FEATURES", "pitft", "fbcon=map:10 fbcon=font:VGA8x8", "", d)}"
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_KGDB ?= '${@oe.utils.conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}'
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_LOGO ?= '${@oe.utils.conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nologo", "", d)}'
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:# You can define CMDLINE_DEBUG as "debug" in your local.conf or distro.conf
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_DEBUG ?= ""
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_ISOL_CPUS ?= "${@setup_isolcpus(d)}"
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:# CMDLINE_RNDIS = "modules-load=dwc2,g_ether g_ether.host_addr=<some MAC
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE_RNDIS ?= ""
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb:CMDLINE = " \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_ISOL_CPUS} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_DWC_OTG} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_SERIAL} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_ROOTFS} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_CMA} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_KGDB} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_LOGO} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_PITFT} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_DEBUG} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: ${CMDLINE_RNDIS} \
meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb: echo "${@' '.join(d.getVar('CMDLINE').split())}" > "${WORKDIR}/cmdline.txt"

```

So the best bet is to sneak in your loglevel in one of those variables. Then you can control where it is. I don’t think it’s a good idea to modify CMDLINE direcly unless you make a rpi-cmdline.bbapend.  
Remember it’s just a string so either way it will be joined into a whole string as you see.

Just use CMDLINE\_SERIAL or something. ?= means that it will set it only if it’s unset.

---

<div class="post-metadata">

### Author: ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)
#### Post date: [February 19, 2024, 7:16pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/15 "2024-02-19T19:16:31Z")

</div>

A post was split to a new topic: [Partition switch not happening on Raspberry Pi](https://hub.mender.io/t/partition-switch-not-happening-on-raspberry-pi/6568)

---

<div class="post-metadata">

### Author: ![pyxlwuff](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)
#### Post date: [February 19, 2024, 4:56pm UTC](https://hub.mender.io/t/stop-dmesg-outputting-to-tty-display-after-logging-in-turn-down-loglevel/6558/16 "2024-02-19T16:56:47Z")

</div>

Slipping it into CMDLINE\_DEBUG with my append file seems to have solved it and also allows mender to behave as normal again. Thanks!
