如何在没有 systemd 的 termux 上运行的系统上启动服务?

如何在没有 systemd 的 termux 上运行的系统上启动服务?

Xubuntu 20.04

系统启动时没有 systemd,因此所有使用 systemctl 的命令都以错误结束:

#systemctl status snapd.service
System has not been booted with sysmtemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

我如何管理服务(例如运行 snapd,如果没有它,大量的软件包就无法安装)?

该系统安装在智能手机上,并使用脚本启动:

#!/data/data/com.termux/files/usr/bin/bash
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1
cd $(dirname $0)
## unset LD_PRELOAD in case termux-exec is installed
unset LD_PRELOAD
command="proot"
command+=" --kill-on-exit"
command+=" --link2symlink"
command+=" -0"
command+=" -r ubuntu20-fs"
if [ -n "$(ls -A ubuntu20-binds)" ]; then
    for f in ubuntu20-binds/* ;do
      . $f
    done
fi
command+=" -b /dev"
command+=" -b /proc"
command+=" -b /sys"
command+=" -b /data"
command+=" -b ubuntu20-fs/root:/dev/shm"
command+=" -b /proc/self/fd/2:/dev/stderr"
command+=" -b /proc/self/fd/1:/dev/stdout"
command+=" -b /proc/self/fd/0:/dev/stdin"
command+=" -b /dev/urandom:/dev/random"
command+=" -b /proc/self/fd:/dev/fd"
command+=" -b /data/data/com.termux/files/home/ubuntu20-fs/proc/fakethings/stat:/proc/stat"
command+=" -b /data/data/com.termux/files/home/ubuntu20-fs/proc/fakethings/vmstat:/proc/vmstat"
command+=" -b /data/data/com.termux/files/home/ubuntu20-fs/proc/fakethings/version:/proc/version"
command+=" -w /home/semen"
command+=" /usr/bin/env -i"
command+=" MOZ_FAKE_NO_SANDBOX=1"
command+=" HOME=/home/semen"
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
command+=" TERM=$TERM"
#command+=" LANG=C.UTF-8"
command+=" LANG=en_US.UTF-8"
command+=" LANGUAGE=en_US.UTF-8"
command+=" LC_ALL=en_US.UTF-8"
command+=" /bin/bash --login"
com="$@"
if [ -z "$1" ];then
    exec $command
else
    $command -c "$com"
fi

相关内容