but when I try that I get
"-ash: service: not found"
their is no executable file name service in the filesystem.
I create my own image so what am I not including?
The service command on OpenWrt is a convenience wrapper around the usual init script machinery, it is defined as shell alias in /etc/profile. Maybe you customized your profile in the past without ever rebasing it.
You have sysupgraded from an old version that did not yet contain the relevant part in /etc/profile. Sysupgrade with "keep settings" preserves /etc/profile. It makes sense to build all settings from scratch every now and then.
/rom/etc/profile contains the current default, while /etc/profile contains old defaults with your personal modifications (or likely just the old default profile).
Easiest for you is to just copy the new version from /rom
from scratch?
you mean tell it to not keep the setting and then add them manually?
that would take a long time I think.
but thanks for the answer. I thought that the /etc/config file were only kept.
is there a list of files that are kept?
No. /etc/config contains only the uci config files, but there are lots of other permanent config-like files.
Files in other places are kept if they are declared to be config files by some package (e.g. SSH keys for dropbear, personal package feeds for opkg, etc.) or by system (like /etc/profile, /etc/hosts, /etc/passwd).
I've created a user account to add an extra layer of security and blocked SSH by root. I now find that that /etc/profileisn't being sourced on su to root. I've tried creating /root/.profile and adding source /etc/profile but that doesn't get sourced either.
Can anyone advise how to get /etc/profile sourced after su into root?
...doesn't work either manually nor when added to roots ~/.profile (for either of the above). I've tried searching through the posts in 2019 on openwrt-devel but couldn't find anything relevant. Is that the mailing list you refer to or is there another one? Do you have a link to the posts on patches you refer to please?
Also, I don't believe that sudo will start a shell unless that is the command you execute. The environment of the "calling" user is generally wiped intentionally. sudo -E will preserve the caller's environment on many systems. sudo env var=value command is another approach that works on many systems.