You are not logged in.

#1 2015-12-05 04:45:39

nbd
Member
Registered: 2014-08-04
Posts: 389

"The unit files have no [Install] section."

I have a simple script in '~/bin' and a systemd service file which starts it at boot time. The service file is stored in /root/systemd/ directory and is as follows:

[Unit]
Description=Forwarding journal log to tty12.
After=systemd-user-sessions.service,systemd-journald.service

[Service]
Type=simple
ExecStart=/usr/bin/python /home/al/bin/forwjour.py
Restart=always
RestartSec=1
TTYPath=/dev/tty12
TTYReset=yes
TTYHangup=yes
TTYVTDisallocate=no
KillMode=process
IgnoreSIGPIPE=no
Environment="DISPLAY=:0"

[Install]
WantedBy=getty.target

When I try to enable with 'systemctl enable', the following message is shown:

[root@kw systemd]# systemctl enable /root/systemd/forwjour.service
Created symlink from /etc/systemd/system/getty.target.wants/forwjour.service to /root/systemd/forwjour.service.
Created symlink from /etc/systemd/system/forwjour.service to /root/systemd/forwjour.service.
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

Why the message about "No [Install] section" is shown?

Last edited by nbd (2015-12-06 13:51:19)


bing different

Offline

#2 2015-12-05 07:26:53

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: "The unit files have no [Install] section."

Copying the service file to /usr/lib/systemd/system seems to have solved the problem. Though don't know why. Also the 'No [Install] section' message is somewhat misleading.


bing different

Offline

#3 2015-12-05 09:41:00

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: "The unit files have no [Install] section."

nbd wrote:

Copying the service file to /usr/lib/systemd/system seems to have solved the problem. Though don't know why.

/root/systemd/ is not normally part of the unit file load path (see systemd.unit(5)). /usr/lib/systemd is where packages put unit files, /etc/systemd is where you can put additional files for your system.

Also the 'No [Install] section' message is somewhat misleading.

I agree. But it seems like it created the right symlinks anyway, even though you were passing an absolute filename instead of a unit name that could be found in one of the unit directories. Based on the man page, you'd have to use

# systemctl link /root/systemd/forwjour.service

to get the unit linked into a directory in the unit file load path (probably /etc/systemd) and then you could use enable, start and other commands. Apparently enable has since been enhanced to integrate the link step (not sure if this is documented somewhere). For completeness sake, you could try it again, calling `systemctl link` manually (and then only using the unit name, not a full path, for enabling) and see if that works without this warning and maybe report a bug upstream.

Last edited by Raynman (2015-12-05 09:41:35)

Offline

#4 2015-12-05 10:20:01

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: "The unit files have no [Install] section."

[root@kw systemd]# systemctl link /root/systemd/forwjour.service 
Created symlink from /etc/systemd/system/forwjour.service to /root/systemd/forwjour.service.
[root@kw systemd]# systemctl enable forwjour.service 
Failed to execute operation: Too many levels of symbolic links

Maybe will be corrected in the next version. Or probably more precisely documented that all unit files should be copied into the unit load path.


bing different

Offline

#5 2015-12-05 11:19:38

hydracone
Member
Registered: 2015-06-25
Posts: 24

Re: "The unit files have no [Install] section."

Probably off topic, but if you want to forward the journal to tty12, you could just follow the wiki instructions :

https://wiki.archlinux.org/index.php/Sy … ev.2Ftty12

Offline

#6 2015-12-05 17:11:59

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: "The unit files have no [Install] section."


bing different

Offline

#7 2015-12-06 13:59:29

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: "The unit files have no [Install] section."

I just tried to enable another service file on another machine and got the same message about 'no [Install] section'. If I remember correctly, earler, service files could have been installed from outside the standard locations without any hassle.  I wonder if no one else gets this message? Or maybe everyone installs service files which are already copied to /usr/lib/systemd/system and /etc/systemd/system?


bing different

Offline

#8 2015-12-06 15:08:22

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: "The unit files have no [Install] section."

I always put mine into /etc/systemd/... as that is the documented/supported location. Similarly I never edit/place files in /usr/lib/systemd/... (as only packages should put their service files etc there) and use the /etc/... overrides that systemd supports.

Offline

#9 2015-12-06 21:33:33

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: "The unit files have no [Install] section."

ukhippo wrote:

/etc/systemd/... as that is the documented/supported location.

Documentation says that units are *loaded* from the unit load path, but not that files must be copied into this path and not symlinked. (This approach would look very "non-unix".) Anyways, the message about "no [Install] section" clearly looks as a bug. Probably in the next version it will be fixed.


bing different

Offline

Board footer

Powered by FluxBB