Services are not starting, sometimes

Greetings All

I have an issue since updated OpenWRT to version 18.06.2. Before everything was fine.

After reboot, sometimes, SQM service and Vnstat service are not starting, at least not properly. It's not like both serivces fails after the same reboot. Sometimes it's SQM serivce, other time Vnstat.

I am pretty noob in linux so really need your help guys.

My question is:

How can i check if service is running on OpenWRT ?

I tried:

service service_name status

but it does not work on OpenWRT as status is not correct paramter on OpenWRT.

Thanks for any help guys.

If there is a SXXsomeservice link in /etc/rc.d/ then the service is slated for startup. It doesn't mean it is still running (or was started successfully).

ps w will give you a list of running processes (assuming you are using the busybox-supplied version)

1 Like

service servicename ... does not work on openwrt.
You might check "logread" or "dmesg" whether any info from the start of the services in question to be found. Good chance, they immediately exited because of some type of error.

1 Like

Except the following

Available commands:
        start   Start the service
        stop    Stop the service
        restart Restart the service
        reload  Reload configuration files (or restart if service does not implement reload)
        enable  Enable service autostart
        disable Disable service autostart

You are correct, it works (now).
My apologies.
Looks like some type of alias for "/etc/init.d/service command"
Any idea, how/where it is implemented ?


service() {
	[ -f "/etc/init.d/$1" ] || {
		echo "service "'"'"$1"'"'" not found, the following services are available:"
		ls "/etc/init.d"
		return 1

Missing the service function meas the OP has preserved/restored some previous release configuration.
Doing so is not completely safe and increases the chance to encounter all kinds of issues.

I'm not sure he is missing the service function; it could be that he just tried service servicename status, which doesn't seem to work with OpenWrt. I think he can try service servicename start or service servicename stop to see if he is missing it or not.

1 Like

I haven't had service work on my deployments. It was only by searching for it that I found it. It's as if profile isn't being sourced. Never bothered me enough to track it down.

I am facing the same issue, I can see my service as enabled and stopped and no matter what I do I am unable to start them. what is the solution to this ?

What is the service? How did you install the service (via opkg install or another method)? What does the init.d script look like? What version of OpenWrt are you running? Do you get any log information about the service start attempt and failure? If you start it manually, does it work?

its autossh and yes I did opkg install ... I am running openwrt 22.03 and I checked the logs and its giving me nothing ... also I tried making a script into a service even that didnt work... Its getting enabled but not starting... By manually do you mean /etc/init.d/autossh start ? then no still its not starting

Did you disable the dropbear ssh server?

no I didnt do that, is that required to run autossh ?

Probably… especially if autossh uses the same port (port 22).

but how do I ssh into the box? other than dropbear ? I installed OpenSSH server and for some reason, can't even ssh into the box with the root password.. so weird

But what I am unable to understand is, how is all this responsible for me not able to start any service at boot

Were you able to ssh before installing autossh? What was the purpose of installing another ssh package?

yeah, anyways now I reset again back to the original form... and I erad that autossh uses dropbear and sshtunnel uses openssh.... I am thinking can I achieve the same thing using cron as a service ?

can you please help me with that like what am I supposed to add in cron to start the reverse ssh tunnel for and where do I add this...

Why don’t you start a new thread that describes your goal and the problems you have had to date. This way the whole thread will be dedicated to your specific situation.

1 Like