Disable console printing in no GUI mode

I have this python script:

import warnings

import os, signal, subprocess
import RPi.GPIO as GPIO

class SwitchStatus:
    def __init__(self, input_pin=18) -> None:
        self.input_pin = input_pin
        # Pin Setup:
        GPIO.setmode(GPIO.BCM)  # BCM pin-numbering scheme from Raspberry Pi
        GPIO.setup(self.input_pin, GPIO.IN)  # set pin as an 
    def play_status(self):
        0 -> play non-com
        1 -> play premium_com
            value = GPIO.input(self.input_pin)
            return 0 if value == GPIO.HIGH else 1
        except Exception as e:
            print("[ERROR] Can't check switch status due to: ", e)

def play_cmd(cmd: str):
    pro = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid)

    return pro

def kill_cmd(pro):
    os.killpg(os.getpgid(pro.pid), signal.SIGUSR1)  # Send the signal to all the process groups

switch_status = SwitchStatus()
cmd = [
    "gst-launch-1.0 v4l2src device=/dev/video0 ! capsfilter caps='image/jpeg, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1' ! jpegdec ! nvvidconv ! nvoverlaysink sync=False qos=True",

    "gst-launch-1.0 filesrc location=./video.mkv ! matroskademux name=demux demux.video_0 ! queue ! h264parse ! nvv4l2decoder ! nvvidconv flip-method=0 ! nvoverlaysink",


switch_prev_status = 0 #default non-com
pro = play_cmd(cmd[0]) #default play non com

while True:
        curr_state = switch_status.play_status()
        if  curr_state != switch_prev_status:
            switch_prev_status = curr_state
            pro = play_cmd(cmd[curr_state])
    except KeyboardInterrupt:

The script checks a certain GPIO (pin 12 on the nano) and depending on the pin status it runs a certain gstreamer pipeline. Code works as expected, only problem when a switch happens between both pipelines the terminal appears as the jetson is connected to a monitor using an hdmi, I don’t mind that behaviour, what I do mind is tegra-xusb spamming 'buffer overrun even on endpoint" warnings which I want to close. Note that the GUI of the nano was closed using:

sudo systemctl set-default multi-user.target

TLDR I want to turn off any type of console text outputting to the terminal when the nano is connected to the monitor via HDMI, the more blank the screen the better.
Any help is appreciated !

Ok so it worked for me by looking at:


Very helpful links. Although their solutions didn’t directly work for me but made me understand the problem more. I have an eMMc based system too from a 3rd party vendor so this my “no flashing required” solution:

cat /proc/cmdline

copy the contents of the above command and add it in:

vim /boot/extlinux/extlinux.conf

instead of the APPEND that is already there replace it with APPEND and the contents copid instead of ${cbootargs}, that is my file after the edit: NOTE MAKE SURE TO BACKUP extlinux.conf or the Image in /boot just in case.

DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND tegraid= ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,4 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1125 core_edp_ma=4000 gpt tegra_fbmem=0x800000@0x92cb4000 is_hdmi_initialised=1  earlycon=uart8250,mmio32,0x70006000  root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 fbcon=map:0 net.ifnames=0 sdhci_tegra.en_boot_part_access=1 vt.global_cursor_default=0 loglevel=0 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 net.ifnames=0 quiet console=ttyS0,115200n8

that might not be the cleanest solution and a better one might be to edit the bootargs in a cleaner way such as in: Jetson nano Boot messages are not hiding - #12 by linuxdev but for my case I thought because its a 3rd party vendor I might do some flashing so I went with the lazy option.

1 Like

NOTE: FORGOT TO MENTION YOU NEED TO REMOVE ANY console=tty0 string from the copied command.

Thanks for your sharing!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.