Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-26-2017, 01:46 AM   #1
LQ Newbie
Registered: Nov 2009
Posts: 12

Rep: Reputation: 0
Enable /dev/ttyS0 on Centos 7 vm on ESX server


I have created a centos 7 VM on VMWare vsphere ESX server.
I have not attached serial port to this VM to begin with.
But I still need to enable /dev/ttyS0.
How can achieve this? I remember on Centos 6 it was working fine even without attaching serial port.

Any operations I do on /dev/ttyS0 results in ttyS0: input/output error.
dmesg | grep tty only shows:
console [ttyS0] enabled.

But if I attach a serial port to this VM, ttyS0 works just fine.
Then, the dmesg | grep tty shows:
console [ttyS0] enabled.
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A <---- this tells me that somewhere ttyS0 is now mapped(?) to some pci irq slot which was not happening in the above case.
I tried even playing with systemd files like [email]serial-getty@ttyS0.service but no luck!
If I try to start the service serial-getty@ttyS0, agetty gives error as "/dev/ttyS0 is not a character device."

Could someone please help me?

Thanks in advance.
Old 05-26-2017, 05:39 AM   #2
Registered: Aug 2002
Posts: 23,254

Rep: Reputation: 4985Reputation: 4985Reputation: 4985Reputation: 4985Reputation: 4985Reputation: 4985Reputation: 4985Reputation: 4985Reputation: 4985Reputation: 4985Reputation: 4985
It is not clear what you are trying to achieve. You can set up a serial port in several ways depending on what you want to accomplish i.e using a physical port on the host, send output to a file, connect to a named pipe or connect over a network.
Old 05-26-2017, 12:05 PM   #3
LQ Newbie
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks michaelk for your reply.

Let me explain you what I am trying to achieve here:

We have our linux software which can work centos 6 as well as centos 7.
One of the task of that software is to ask user password on the console. (It's a shell script that used "read" command.) User enters that password and it is stored at some location on filesystem.
Now, for a vm instance, a user can use the graphical console of VMWare ESX server (tty1) OR he can use a serial port (ttyS0) connected to this VM - we don't know what he will configure/use at his end.

So, our shell script is generic - something like this:

for t in /dev/tty0 /dev/ttyS0; do
prompt_user_for_password_script $t &
some other important logic "assuming" there are 2 processes running in background.

Now, if I have 2 VMs - one is centos 6 VM and other is Centos 7 VM (Both VMs doesn't have any serial port configured):
1. For centos 6 VM, the above script shows there are 2 processes running in background for prompt_user_for_password script.
2. for centos 7 VM, one of the background process dealing with /dev/ttyS0 fails and returns immediately. Also, if you run any command like stty, or echo or anything on /dev/ttyS0, it fails with error "ttyS0: Input/Output error".
But, if I attach a serial port to centos 7 VM, then the above script works fine.

I think it has something to do with systemd's dynamic tty logic or something.
Can someone please help me?

Last edited by neo3matrix; 05-26-2017 at 12:15 PM.
Old 05-26-2017, 02:48 PM   #4
Registered: Mar 2008
Posts: 21,484

Rep: Reputation: 3512Reputation: 3512Reputation: 3512Reputation: 3512Reputation: 3512Reputation: 3512Reputation: 3512Reputation: 3512Reputation: 3512Reputation: 3512Reputation: 3512

A vm is a software version of a real computer and in many real computers that is a uart or parts for a serial console even if no shell connector. At first glance we'd think that the Centos version is to blame in some way. To prove it may be slightly harder. My question may be to decide if 7 enables the hardware in a different way or is it somehow changed to detect a vm or lack of serial support in config at install causes this.???

My question would be why not configure a serial port?

Last edited by jefro; 05-27-2017 at 02:30 PM.
Old 05-27-2017, 01:02 AM   #5
Registered: Feb 2008
Location: Emmer-compascuum
Distribution: redhat* debian* arch* slack*
Posts: 216

Rep: Reputation: 31
chmod 666 /dev/ttyS0
its just a wild guess


centos7, serial console, systemd, ttys0, vmware

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Link /dev/mouse -> /dev/ttyS0 undone at reboot. stf92 Slackware 4 12-07-2012 05:37 PM
Cloning CentOS 6.2 Server to another ESX 4.1 host baldur2630 Linux - Virtualization and Cloud 1 03-19-2012 04:28 PM
SSH enable on ESX 4 sherimm Linux - Software 1 06-03-2009 08:57 PM
Minicom in /dev/ttyS0 Luis GUSTAVO Linux - Software 0 07-31-2003 05:42 PM
/dev/ttyS0 problems rbermude Linux - Software 2 06-27-2001 10:43 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:52 AM.

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