Bug 880474

Summary: RFE: Remove requirement to edit unit files
Product: [Fedora] Fedora Reporter: Ian Pilcher <ipilcher>
Component: tigervncAssignee: Jan Grulich <jgrulich>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: bphinz, ovasik
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Ian Pilcher 2012-11-26 23:53:33 EST
Description of problem:
Currently, the recommended method of setting up a VNC server to autostart involves copying the unit file from /lib/systemd/system/vncserver@.service to /etc/systemd/system/vncserver@:<DISPLAY>.service and editting the new file to set the user, etc.  This is fairly ugly, and it also causes any updates to the file in /lib/systemd/system (such as the new macros in F18) to be ineffective.

I suggest using per-server configuration files.  For example:

/etc/sysconfig/vncserver-:10

  USER=ipilcher
  GEOMETRY=1600x900
  OPTIONS="-localhost -nolisten tcp"

/etc/systemd/system/vncserver@.service

  [Unit]
  Description=Remote desktop service (VNC) - display %I
  After=syslog.target network.target

  [Service]
  Type=forking
  EnvironmentFile=/etc/sysconfig/vncserver-%i
  # Clean any existing files in /tmp/.X11-unix environment
  ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
  ExecStart=/sbin/runuser -l $USER -c "/usr/bin/vncserver %i -geometry ${GEOMETRY} ${OPTIONS}"
  ExecStop=/sbin/runuser -l $USER -c "/usr/bin/vncserver -kill %i"

  [Install]
  WantedBy=multi-user.target

(I'm not particularly suggesting those file locations, etc.  Just trying to convey the general concept.)

With this scheme, setting up a new VNC server is a matter of creating the appropriate display-specific config file and using systemctl start/enable with the right display after the '@' symbol.
Comment 1 Antonio Trande 2013-01-24 06:58:37 EST
In the matter of this issue, recently I talked on systemd-devel list about how to edit vnc*.service file for a correct launch of this service. In particular, both on Fedora 17 ARM or Fedora 18, the instructions on the same original '/lib/systemd/system/vncserver@.service' seems misleading. 

According to the mails on systemd-devel list:

 >1. syslog.target is old and not needed in recent systemd's
 >
 >2. No need to shell out and ignore the return value of the Pre command.
 >Use the - after the equals to ignore the return value of the command.
 >It's output will be logged in the journal but that's fine IMO.
 >
 >3. User=/Group= is a built in way to set the user and group. You should
 >drop runuser completely as it's totally unneeded - systemd has this
 >built in as documented in the manual.

You can read the discussion here: http://lists.freedesktop.org/archives/systemd-devel/2013-January/008349.html
Comment 3 Fedora Admin XMLRPC Client 2013-05-13 10:55:09 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 4 Fedora Admin XMLRPC Client 2015-08-20 04:44:16 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.