Enabling boot-start for Splunk on rhel 9 / rocky 9
I installed Splunk on a VM the other day and found that I could not enable boot-start. I've never had a problem doing this before and was obviously frustrated.
The error I was running into was:
> /sbin/chkconfig no such file or directory
The issue I discovered is, that chkconfig does not come pre-installed on rhel 9 / rocky 9.
So to fix this I attempted to manually install chkconfig:
> dnf install chkconfig -y
Once again, however, no luck, errors installing chkconfig:
> error unpacking rpm package chkconfig
> Error: Transaction failed
What's going on? The folder /etc/init.d already exists and this for some reason is stopping chkconfig installing.
So what's the solution?
Well first, because I already had a Splunk folder and some other items in my /etc/init.d folder, I copied these out to my home directory:
> cp -r /etc/init.d/* ~/
Then removed the init.d folder:
> rm -rf /etc/init.d
Once again attempted to reinstall chkconfig:
> dnf install chkconfig
This time successfully:
> Complete!
Then copied my folders back in (use a more specific command than below if you have a lot in your home directory):
> cp -r ~/ /etc/init.d
Then I was able to enable boot-start for Splunk successfully:
> ./opt/splunk/bin/splunk enable boot-start
> Init script installed at /etc/init.d/splunk.
> Init script is configured to run at boot.
And now all is happy and well!
Hopefully this should work for you on RetHat or any of its version 9 alternatives, such as Rocky or Alma.
Goodluck!