Bug 880474 - RFE: Remove requirement to edit unit files
Summary: RFE: Remove requirement to edit unit files
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: tigervnc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Grulich
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-27 04:53 UTC by Ian Pilcher
Modified: 2017-07-29 08:12 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ian Pilcher 2012-11-27 04:53:33 UTC
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 T. (sagitter) 2013-01-24 11:58:37 UTC
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 14:55:09 UTC
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 08:44:16 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Avi Alkalay 2017-07-29 08:11:33 UTC
I prefer Ian's suggestion better than the way it is now. Unit file for VNC Servers should be read only and flexible enough to support externally-configured servers.

(In reply to Ian Pilcher from comment #0)
> 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.

Comment 6 Avi Alkalay 2017-07-29 08:12:12 UTC
I prefer Ian's suggestion better than the way it is now. Unit file for VNC Servers should be read only and flexible enough to support externally-configured servers.

(In reply to Ian Pilcher from comment #0)
> 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.


Note You need to log in before you can comment on or make changes to this bug.