Score:2

How to start services on a system running without systemd on termux?

ss flag

Xubuntu 20.04

The system starts without systemd, so all commands using systemctl end with the error:

#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

How can I manage services (and for example run snapd, without which a large number of packages are not installed)?

The system is installed on a smartphone and launched using a script:

#!/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
ru flag
How was Ubuntu 20.04 installed? I see references to 'termux' which is an *emulator* but not a full Ubuntu install, so it wouldn't be able to run services automatically like systemd and init systems would do as it's not a full Ubuntu install. It's not capable of running services because the parent `init` system that emulates everything is the Android device itself, which is not Ubuntu
BeautifulKostya avatar
ss flag
In Termux I ran script, which installed Ubuntu in separated folder.
ru flag
**Termux is an emulator**. It does **NOT** run a full Ubuntu system. The underlying 'init' system is the Android init system. It's like a Docker container, it doesn't have any init system available in the base Ubuntu 22.04 Docker image, commands are executed within it by docker, and it does NOT have the full init stack within it for the services that run in the container. There is no functional way in Termux or similar emulation mechanisms like Docker containers, etc. to have SystemD or any init system work - this literally is impossible. Termux is basically 'containers' and that's it.
BeautifulKostya avatar
ss flag
Why Termux proccess in own folder can't full initialize guest system? All actions of the guest OS are performed only in its folder.
ru flag
Don't confuse 'folders' for 'full system stack in memory including init and service processes'. You can do **file operations** independent from the main system, that does NOT equate to being able to run the init stack or services with an actual monitoring/init daemon. You would have to launch services yourself manually on the command line with proper users, etc. and most services won't bind properly because **you're using emulation and not an actual Virtual Machine**. The only way to have a full stack is Virtualization / CGroups, which Android doesn't provide either.
BeautifulKostya avatar
ss flag
How to start service snap?
ru flag
**you don't**. you won't get snaps working properly in a Ttermux emulated environment. It's not a VM and it's not a full Ubuntu install.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.