Bug 596553

Summary: VM doesn't start after adding Serial Device for /dev/ttyS0
Product: [Fedora] Fedora Reporter: Aram Agajanian <agajania>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 15CC: berrange, clalance, crobinso, itamar, jforbes, veillard, virt-maint, zart
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-07 00:41:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aram Agajanian 2010-05-26 23:14:51 UTC
Description of problem:
I have a Windows XP VM.  I added a Serial Device using the Virtual Machine Manager.  The Device Type is Physical Host Character Device (dev) and the Source Path is /dev/ttyS0.  After adding this device, when I try to start the VM, a dialog pops up and the following error is displayed.  The VM is not started.

Error starting domain: internal error Process exited while reading console log output: char device redirected to /dev/pts/5
chardev: opening backend "tty" failed

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 799, in run_domain
    vm.startup()
  File "/usr/share/virt-manager/virtManager/domain.py", line 1256, in startup
    self._backend.create()
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 317, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error Process exited while reading console log output: char device redirected to /dev/pts/5
chardev: opening backend "tty" failed



Version-Release number of selected component (if applicable):
0.7.7-3

How reproducible:
happens every time

Steps to Reproduce:
1.  Add Serial Device to VM with type=dev and path=/dev/ttyS0
2.  Try to start VM
3.
  
Actual results:
Error message is displayed.

Expected results:
VM should start up and be able to access serial port.

Comment 1 Bug Zapper 2011-06-02 13:19:57 UTC
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Cole Robinson 2011-06-10 17:44:51 UTC
Since this is pretty old, closing. Please reopen if you can still reproduce with F15 or later

Comment 3 Aram Agajanian 2011-06-11 13:52:05 UTC
I still can't get this to work in F15.  

I have a Windows XP VM.  I add a serial device with type of "dev" and source path of "/dev/ttyS0".  It is listed in the devices as Serial 2.  

When I start the VM using virt-manager, there is an error starting the domain.  The traceback is as follows:

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 45, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/engine.py", line 959, in asyncfunc
    vm.startup()
  File "/usr/share/virt-manager/virtManager/domain.py", line 1128, in startup
    self._backend.create()
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 330, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error Process exited while reading console log output: char device redirected to /dev/pts/1
chardev: opening backend "tty" failed

As soon as I remove the Serial 2 device, the VM runs as expected.

Comment 4 Konstantin Zemlyak 2011-07-01 07:17:31 UTC
This is a permissions issue. Somehow libvirt changes ownership of /dev/ttyS* to <some random integer>:1 (keeping mode as is which is 0660).

Quick workaround is either
1) disable dynamic_ownership in /etc/libvirt/qemu.conf and ensure that qemu has access to /dev/ttyS* (ie add user qemu to dialout group), or
2) chmod /dev/ttyS* device to 0666 (this is insecure, of course. to preserve 0666 across reboots write udev rule). Note that with dynamic_ownership enabled when guest is shutdown ownership of /dev/ttyS* is restored as root:root rather then root:dialout - see http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/security/security_dac.c;h=58d57ec2126a74ca5cecd541517be847a6754b0c;hb=HEAD#l150

Comment 5 Fedora Admin XMLRPC Client 2011-09-22 17:54:57 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora Admin XMLRPC Client 2011-09-22 17:58:29 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 7 Fedora Admin XMLRPC Client 2011-11-30 20:06:01 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 8 Fedora Admin XMLRPC Client 2011-11-30 20:06:07 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 9 Fedora Admin XMLRPC Client 2011-11-30 20:09:42 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 10 Fedora Admin XMLRPC Client 2011-11-30 20:09:50 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 11 Cole Robinson 2012-06-07 00:41:46 UTC
Sorry for the lack of response.

I added a ttyS0 serial device to a guest on F16 host, and it started fine. Selinux enabled, as well as dynamic_ownership. The latter part of Konstantin's point in Comment #4 is still relevant, but that's kind of a long standing issue with our permissions model.

I'm closing as WORKSFORME. But if anyone can still reproduce with F17 or F16, please reopen and we can try and follow up from there.