I'm using 21.02 with Archer C7 V2.
Service is not installed ..
root@Repeater_WZ:~# service
-ash: service: not found
But all is working fine ..
How to install service ?
I'm using 21.02 with Archer C7 V2.
Service is not installed ..
root@Repeater_WZ:~# service
-ash: service: not found
But all is working fine ..
How to install service ?
What are you trying to achieve? The service feature found on other distress isn't necessary in OpenWrt -- for example, if you want to restart the network, you can just issue: /etc/init.d/network restart
The /etc/init.d/ stuff is working !
If t type service on my Netgear EX3700 i get:
-----------------------------------------------------
OpenWrt 21.02.0, r16279-5cc0535800
-----------------------------------------------------
root@Repeater_HW:~# service
service "" not found, the following services are available:
boot dropbear network sysfixtime umount
bootcount firewall odhcpd sysntpd urandom_seed
cron gpio_switch relayd system urngd
dnsmasq led rpcd ucitrack wpad
done log sysctl uhttpd
root@Repeater_HW:~#
If a type service on my archer C7 V2 i get:
-----------------------------------------------------
OpenWrt 21.02.0, r16279-5cc0535800
-----------------------------------------------------
root@Repeater_WZ:~# service
-ash: service: not found
root@Repeater_WZ:~#
That is why i am asking ...
Interestingly, when I type service
, I see the following (Routerstation Pro + OpenWrt 21.02.0)
root@openwrt:~# service
Usage: service <service> [command]
The following services are available:
/etc/init.d/avahi-daemon enabled running
/etc/init.d/boot enabled stopped
/etc/init.d/bootcount enabled stopped
/etc/init.d/cron enabled stopped
/etc/init.d/dbus enabled stopped
/etc/init.d/ddns enabled stopped
/etc/init.d/dnsmasq enabled running
/etc/init.d/done enabled stopped
/etc/init.d/dropbear enabled running
...
hi,
service
is a function defined in /etc/shinit
. could you please check if this file exists and copy the content here?
Hi,
this is my content of /etc/shinit:
root@Repeater_WZ:~# cat /etc/shinit
[ -x /bin/more ] || [ -x /usr/bin/more ] || alias more=less
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
alias ll='ls -alF --color=auto'
[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
[ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; }
[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
service() {
if [ -f "/etc/init.d/$1" ]; then
/etc/init.d/$@
else
echo "Usage: service <service> [command]"
if [ -n "$1" ]; then
echo "Service "'"'"$1"'"'" not found, the following services are available:"
else
echo "The following services are available:"
fi
for F in /etc/init.d/* ; do
printf "%-30s\t%10s\t%10s\n" "$F" \
$( $($F enabled) && echo "enabled" || echo "disabled" ) \
$( [ "$(ubus call service list "{ 'verbose': true, 'name': '$(basename $F)' }" \
| jsonfilter -q -e "@['$(basename $F)'].instances[*].running" | uniq)" = "true" ] \
&& echo "running" || echo "stopped" )
done;
return 1
fi
}
[ -n "$KSH_VERSION" -o \! -s "$HOME/.shinit" ] || . "$HOME/.shinit"
[ -z "$KSH_VERSION" -o \! -s "$HOME/.mkshrc" ] || . "$HOME/.mkshrc"
attributes ?
root@Repeater_WZ:~# ls -ali /etc/shinit
286 -rw-r--r-- 1 root root 1120 Sep 1 00:20 /etc/shinit
root@Repeater_WZ:~#
That looks normal.
That error message typically shows up with executable binaries linked with different musl C library, or something similar.
Just check that your path does not contain a "service" app.
'which service
' should produce empty results.
Other possibility:
you have restored wrong version of /etc/shinit from an older backup.
Like suggested here:
That output is not like it should be on 21.02 or master.
You might try copying the default /etc/shinit from /rom
cp /rom/etc/shinit /etc/shinit
EDIT:
Your output above is from the old "/etc/shinit" version that was deprecated already in December 2020, already before openwrt-21.02 was branched.
Note the small "s" (like you have) in the beginning of the sentence in the deprecated script part:
root@Repeater_WZ:~# which services
root@Repeater_WZ:~#
root@Repeater_HW:~# cp /rom/etc/shinit /etc/shinit
root@Repeater_HW:~# service
service "" not found, the following services are available:
boot dropbear network sysfixtime umount
bootcount firewall odhcpd sysntpd urandom_seed
cron gpio_switch relayd system urngd
dnsmasq led rpcd ucitrack wpad
done log sysctl uhttpd
root@Repeater_HW:~#
It sounds good, but what can do to get service ?
You probably need a reboot, or at least a new shell session, after the copying. (service is an alias in you shell, and the new initialisation does not get applied to the current shell...
The above copy worked, the output is as expected. It wants some further input, as per your OP for the working device.
Edit:
root@mamba:/etc# service
service "" not found, the following services are available:
adblock gpio_switch sysfixtime
banip irqbalance sysntpd
bcp38 led system
boot log ucitrack
bootcount network umount
cron nginx unbound
dnsmasq nlbwmon urandom_seed
done odhcpd urngd
dropbear openvpn uwsgi
etherwake rpcd vpn-policy-routing
fan_control sqm wpad
firewall sysctl
root@mamba:/etc# service wpad
Syntax: /etc/init.d/wpad [command]
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
enabled Check if service is started on boot
running Check if service is running
status Service status
trace Start with syscall trace
root@mamba:/etc# service wpad status
running
you do not see same
Ok. i have done a reboot:
BusyBox v1.33.1 (2021-09-09 19:21:11 UTC) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt 21.02.0, r16279-5cc0535800
-----------------------------------------------------
root@Repeater_HW:~# service
service "" not found, the following services are available:
boot dropbear network sysfixtime umount
bootcount firewall odhcpd sysntpd urandom_seed
cron gpio_switch relayd system urngd
dnsmasq led rpcd ucitrack wpad
done log sysctl uhttpd
root@Repeater_HW:~# which services
root@Repeater_HW:~# cat /etc/shinit
[ -x /bin/more ] || [ -x /usr/bin/more ] || alias more=less
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
alias ll='ls -alF --color=auto'
[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
[ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; }
[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
service() {
if [ -f "/etc/init.d/$1" ]; then
/etc/init.d/$@
else
echo "Usage: service <service> [command]"
if [ -n "$1" ]; then
echo "Service "'"'"$1"'"'" not found, the following services are available:"
else
echo "The following services are available:"
fi
for F in /etc/init.d/* ; do
printf "%-30s\t%10s\t%10s\n" "$F" \
$( $($F enabled) && echo "enabled" || echo "disabled" ) \
$( [ "$(ubus call service list "{ 'verbose': true, 'name': '$(basename $F)' }" \
| jsonfilter -q -e "@['$(basename $F)'].instances[*].running" | uniq)" = "true" ] \
&& echo "running" || echo "stopped" )
done;
return 1
fi
}
[ -n "$KSH_VERSION" -o \! -s "$HOME/.shinit" ] || . "$HOME/.shinit"
[ -z "$KSH_VERSION" -o \! -s "$HOME/.mkshrc" ] || . "$HOME/.mkshrc"
root@Repeater_HW:~#
Thank you for your investigation
But still no services ..
I have copied profile...
cp /rom/etc/profile /etc/profile
Now it works !!
Thanks for your help !!
Old Content:
#!/bin/sh
[ -f /etc/banner ] && cat /etc/banner
[ -e /tmp/.failsafe ] && cat /etc/banner.failsafe
fgrep -sq '/ overlay ro,' /proc/mounts && {
echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.'
echo 'Please try to remove files from /overlay/upper/... and reboot!'
}
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
export HOME=${HOME:-/root}
export PS1='\u@\h:\w\$ '
[ "$TERM" = "xterm" ] && export PS1='\[\e]0;\u@\h: \w\a\]'$PS1
[ -x /bin/more ] || alias more=less
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
alias ll='ls -alF --color=auto'
[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
[ -n "$FAILSAFE" ] || {
for FILE in /etc/profile.d/*.sh; do
[ -e "$FILE" ] && . "$FILE"
done
unset FILE
}
New content:
[ -e /tmp/.failsafe ] && export FAILSAFE=1
[ -f /etc/banner ] && cat /etc/banner
[ -n "$FAILSAFE" ] && cat /etc/banner.failsafe
fgrep -sq '/ overlay ro,' /proc/mounts && {
echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.'
echo 'Please try to remove files from /overlay/upper/... and reboot!'
}
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
export HOME=${HOME:-/root}
export PS1='\u@\h:\w\$ '
export ENV=/etc/shinit
case "$TERM" in
xterm*|rxvt*)
export PS1='\[\e]0;\u@\h: \w\a\]'$PS1
;;
esac
[ -n "$FAILSAFE" ] || {
for FILE in /etc/profile.d/*.sh; do
[ -e "$FILE" ] && . "$FILE"
done
unset FILE
}
if ( grep -qs '^root::' /etc/shadow && \
[ -z "$FAILSAFE" ] )
then
cat << EOF
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
EOF
fi
Thanks again for your investigations
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.