LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-03-2021, 07:57 AM   #1
tigerdxy
LQ Newbie
 
Registered: May 2021
Posts: 2

Rep: Reputation: Disabled
Accepting User Input from UART debug Console in a service during booting


Hi,
I have Kernel Version: 4.19.50-ti-r20
running debian buster.
The Console is UART0 port linked to /dev/ttyS0:
crw------- 1 debian tty 4, 64 Jul 7 17:19 /dev/ttyS0

I try to accept user input from the ttyS0 during booting process in a service script.
I followed steps in outlined in the link:
https://alan-mushi.github.io/2014/10...h-systemd.html
But not working. It seems to me that ttyS0 is not redirected to TTYPath=/dev/tty2. I also tried chvt 13

//=== ncu-install.service
[Unit]
Description=NCU Installation
After=network.target sshd.service systemd-logind.service getty@tty2.service
[Service]
Type=oneshot
TTYPath=/dev/tty2
ExecStartPre=/bin/chvt 13
ExecStart=/ncu_install/ncu_install.sh
ExecStartPost=/bin/chvt 1
StandardInput=tty
TTYVHangup=yes
TTYReset=yes
TTYVTDisallocate=yes
#RemainAfterExit=no
[Install]
WantedBy=default.target
RequiredBy=sshd.service systemd-logind.service getty@tty1.service

//=====
They are not working.
Anything I missed?
Thank You,
David
 
Old 05-03-2021, 11:02 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,151

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
/dev/tty2 is the second virtual terminal. When you enable virtual terminals, you can switch to tty2 by doing Ctrl-Alt-2 on the directly attached keyboard/display. It has nothing to do with serial consoles.

See instead:
https://www.linuxquestions.org/quest...-a-4175557041/

If systemctl can't find the service you may have to copy the template /usr/lib/systemd/system/serial-getty@.service
to /etc/systemd/system/serial-getty@ttyS0.service and edit for the baud rate or other parameters that you want.

You may also want to add to your grub config so that grub and kernel console go to the serial port. See:
https://wiki.archlinux.org/title/Wor...serial_console
 
Old 05-11-2021, 07:35 AM   #3
tigerdxy
LQ Newbie
 
Registered: May 2021
Posts: 2

Original Poster
Rep: Reputation: Disabled
It didn't work for me. And I stopped this approach.
Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
serial console not accepting input grgsaliba Linux - Embedded & Single-board computer 2 03-10-2019 12:44 PM
how to debug (printk/printf/uart?) inside vdso (arch/x86/vdso/vclock_gettime.c) goblinhack Linux - Kernel 1 12-10-2015 07:16 AM
Where does uart console get its value of uart port membase? unifoxz Linux - Kernel 1 12-20-2011 02:28 PM
Accepting single backslash "\" as a user input. sundar_r05 Linux - Enterprise 6 02-02-2010 05:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration