systemctl complains about no installation config, but it exists

19,881

Solution 1

Your systemd unit doesn't have an [Install] section. It does, however, have an [INSTALL] section. Section names are case sensitive.

Solution 2

A similar warning (The unit files have no [Install] section. They are not meant to be enabled using systemctl.) can also be seen on CentOS 7 (at least) when you've already enabled the service, and the symlink already exists in /etc/systemd/system/multi-user.target.wants/. I found this out when re-running make install from a Makefile intended for installing an app on a freshly provisioned droplet (VPS).

Share:
19,881

Related videos on Youtube

corsiKa
Author by

corsiKa

I'm here to find out about the mysteries of air.

Updated on September 18, 2022

Comments

  • corsiKa
    corsiKa over 1 year

    While following this tutorial on installing tomcat on CentOS I came across a problem executing the line sudo systemctl enable tomcat - it complains with the following error message:

    The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
    settings in the [Install] section, and DefaultInstance for template units).
    This means they are not meant to be enabled using systemctl.
    

    However, I clearly have an entry in my [Install] section:

    [Unit]
    Description=Tomcat 9 servlet container
    After=network.target
    
    [Service]
    Type=forking
    
    User=tomcat
    Group=tomcat
    
    Environment="JAVA_HOME=/usr/lib/jvm/jre"
    Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
    
    Environment="CATALINA_BASE=/opt/tomcat/latest"
    Environment="CATALINA_HOME=/opt/tomcat/latest"
    Environment="CATALINA_PID=/opt/tomcat/latest/temp/tomcat.pid"
    Environment="CATALINA_OPTS=-Xms256M -Xmx512M -server -XX:+UseParallelGC"
    
    ExecStart=/opt/tomcat/latest/bin/startup.sh
    ExecStop=/opt/tomcat/latest/bin/shutdown.sh
    
    [INSTALL]
    WantedBy=multi-user.target
    

    How can I get it to allow me to enable this service? I believe I've done everything right that it's asking for.