[CentOS-virt] libvirt/kvm changes /dev/ttyS0

Thu Sep 18 09:45:15 UTC 2014
lhecking at users.sourceforge.net <lhecking at users.sourceforge.net>

 A new kvm guest on a CentOS6.5 x84_64 host is set up to make use of the serial
 port (virt-install ... --serial dev,path=/dev/ttyS0)

    <serial type='dev'>
      <source path='/dev/ttyS0'/>
      <target port='0'/>
    </serial>
    <console type='dev'>
      <source path='/dev/ttyS0'/>
      <target type='serial' port='0'/>
    </console>

 When I launch the vm, setroubleshootd goes into overdrive and creates massive
 logs, and /var/log/messages starts growing significantly also. The reason is
 that as soon as the vm starts, ownership and context of /dev/ttyS0 on the host
 are being reset. Why is that, and how can I prevent it from happening?

 Should be:

crw-rw----. root dialout system_u:object_r:tty_device_t:s0 /dev/ttyS0

 Changes to:

crw-rw----. qemu qemu unconfined_u:object_r:svirt_image_t:s0:c9,c796 /dev/ttyS0