Resolving “systemctl enable” Error: Missing Installation Config Despite Valid [Install] Section


2 views

When working with systemd services on Linux, you might encounter the frustrating error:

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.

This typically occurs when the service unit file lacks proper installation directives in its [Install] section, even when you're certain the section exists.

Looking at the Tomcat service file example:

[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

Can you spot the issue? The problem lies in the case sensitivity of the section header.

Systemd is strict about section headers. The correct section should be [Install] (uppercase I), not [INSTALL] (all caps). This simple typo makes systemd ignore the entire installation configuration.

Here's the properly formatted version:

[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

After fixing the case sensitivity:

  1. Reload systemd: sudo systemctl daemon-reload
  2. Try enabling again: sudo systemctl enable tomcat
  3. Verify with: systemctl is-enabled tomcat

If the issue persists, consider these possibilities:

  • File permissions - ensure root owns the file
  • File location - should be in /etc/systemd/system/
  • Syntax errors - use systemd-analyze verify to check

For complex cases, these commands can help diagnose:

# Check unit file syntax
systemd-analyze verify /etc/systemd/system/tomcat.service

# Show all properties of a unit
systemctl show tomcat.service

# Check journal logs
journalctl -xe

Remember that systemd is particular about every character in the service file. Even invisible Unicode characters or incorrect line endings can cause issues.


When you encounter this error while trying to enable Tomcat service with systemctl, the immediate assumption might be that the [Install] section is missing entirely. However, in this case, we can see the section exists but still produces the error. The key issue here is case sensitivity in systemd unit files.

Looking closely at your configuration, the problematic line is:

[INSTALL]
WantedBy=multi-user.target

Systemd unit files are case-sensitive, and the correct section name should be [Install] (with capital I), not [INSTALL].

Here's the corrected version of your tomcat.service file:

[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

After making the correction:

# Reload systemd manager configuration
sudo systemctl daemon-reload

# Enable the service
sudo systemctl enable tomcat

# Verify the service status
sudo systemctl status tomcat

If you still encounter issues:

  1. Check file permissions: sudo chmod 644 /etc/systemd/system/tomcat.service
  2. Validate the unit file: systemd-analyze verify /etc/systemd/system/tomcat.service
  3. Check for syntax errors: cat /etc/systemd/system/tomcat.service | grep -v "^#" | grep -v "^$"

Here's a verified working Tomcat 9 service file for CentOS 7:

# /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat 9 Web Application Container
After=syslog.target network.target

[Service]
Type=forking

User=tomcat
Group=tomcat

Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target