LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Enable /dev/ttyS0 on Centos 7 vm on ESX server (https://www.linuxquestions.org/questions/linux-software-2/enable-dev-ttys0-on-centos-7-vm-on-esx-server-4175606689/)

neo3matrix 05-26-2017 01:46 AM

Enable /dev/ttyS0 on Centos 7 vm on ESX server
 
Hi,

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:
Quote:

console [ttyS0] enabled.

But if I attach a serial port to this VM, ttyS0 works just fine.
Then, the dmesg | grep tty shows:
Quote:

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.

michaelk 05-26-2017 05:39 AM

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.


https://pubs.vmware.com/vsphere-50/i...962ABC9E3.html

neo3matrix 05-26-2017 12:05 PM

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:

Quote:

for t in /dev/tty0 /dev/ttyS0; do
prompt_user_for_password_script $t &
:
:
done
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?

jefro 05-26-2017 02:48 PM

thoughts.

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?

R03L 05-27-2017 01:02 AM

try
Code:

chmod 666 /dev/ttyS0
its just a wild guess


All times are GMT -5. The time now is 02:13 AM.