6

When I execute the following command on RedHat 7.4 x64 terminal, (just enable tomcat.service)


sudo systemctl enable tomcat.service

Get the following error message:

Failed to execute operation: Bad message

Do you have any idea or suggestion what I can check further?

Thank you.

Joseph Ishak
  • 1,194
  • 1
  • 9
  • 18
David Yin
  • 61
  • 1
  • 1
  • 3

3 Answers3

9

I am installing etcd cluster and encount the same error,I finally found the problem is my etcd.service config add a useless character,remove it and the problem solved.You should check the tomcat.service file.Maybe help for you!

i[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
Documentation=https://github.com/coreos

Input a 'i' when edit file using vim,remove it.

Dolphin
  • 29,069
  • 61
  • 260
  • 539
1

like https://stackoverflow.com/a/57498251/19541857

I am installing frp and encount the same error too I found the problem is my frps.service config delete some important characters when use vim

t]
Description = frp server
After = network.target syslog.target
Wants = network.target

[Service]
Type = simple
ExecStart = /home/whitewater/frp/frps -c /home/whitewater/frp/frps.ini


[Install]
WantedBy = multi-user.target

the correct frps.service should be like this:

[unit]
Description = frp server
After = network.target syslog.target
Wants = network.target

[Service]
Type = simple
ExecStart = /home/whitewater/frp/frps -c /home/whitewater/frp/frps.ini


[Install]
WantedBy = multi-user.target
0

In RHEL 7.x, the error indicates an issue in 'tomcat.service' file which will be created manually while setting up tomcat. 'tomcat.service' file is important to make tomcat run as a service automatically once the server is booted up. It is kept in '/etc/systemd/system/' directory.

Usually 'tomcat.service' will have sections called [Unit], [Service] and [Install].

[Unit] section gives values to params like "Description" and "After".

[Service] section gives values to params like "Type", "User", "Group", "Environment", "ExecStart", "ExecStop" etc.

[Install] provides the value for param "WantedBy".

If there is any spelling mistake in above keywords, we wont be able to "enable" the service as part of systemctl, hence getting "Bad message" error as mentioned in the question.