Breadstick Get it on Google Play

Documentation

Linux services

Run Debian packages that come as systemd services, such as web servers, databases and sync tools, with systemctl and journalctl (Pro).

Many Debian packages run as a service: a web server, a database, a sync tool, something on a timer. On a computer, systemd starts them. Breadstick's Linux is not a booted computer and has no systemd of its own, so before 3.0 such a package installed and then never ran.

Linux services fix that. Breadstick runs its own service manager in Linux, which reads the same unit files systemd does, starts and watches the services, keeps their logs and runs their timers. systemctl and journalctl work the way they do on Debian, and so do the packages that call them when they install.

Linux services are part of Breadstick Pro.

Turning them on

Settings > Linux system > Linux services has three switches:

  • Run Linux services starts the service manager. Services that are enabled start with it.
  • Keep services running when Breadstick is closed keeps them going after you close Breadstick, with a notification that says how many are running. Off, they stop when you close Breadstick.
  • Start Linux services when the device starts starts them after the device restarts, once you have unlocked it. It is off unless you turn it on.

Service manager, below them, lists the services with their state, whether they start with Linux and how many processes each one uses. Filters show what is running, enabled or failed, or timers. Tap a service for its status, Start, Stop and Restart, whether it starts with Linux, and its log as it is written.

From the Terminal

The usual commands work:

sudo apt install nginx
sudo systemctl enable --now nginx
systemctl status nginx
journalctl -u nginx -f

Logs are kept per service under /var/log/breadstick-journal/, and journalctl reads them.

Without Pro, or with Run Linux services off, systemctl enable still records what should start, so it takes effect once services run, and systemctl start says the service manager is not running. Installing a package never fails because of it.

What works and what does not

Services, targets and timers work, with the parts of their unit files most packages use: the ways a service can start, its environment, the user it runs as, its folders under /run, /var/lib, /var/cache and /var/log, restarting when it stops, and dependencies between units. Timers take the common calendar forms, such as daily, weekly or a time of day.

Some things systemd does cannot work here, and the service manager ignores them:

  • Sandboxing and resource limits, such as private folders, protected system paths, memory or processor limits. A service runs with the access a program of that user would have. The service's page lists what was ignored.
  • Socket, mount, path and device units. A service that waits for a connection on a socket before it starts does not start that way; start the service itself instead.
  • Debian's SSH service. Breadstick has its own SSH server, on port 2222, under Settings > Network and remote access. See Remote access.

Processes

Every running service counts against Android's process limit, together with the desktop and your apps, and the service manager itself takes one more. Where Android enforces the limit, the Service manager shows how many processes services use, and warns before starting or enabling one that would bring Linux close to it. Past the limit, Android closes Linux, desktop and services together.

Services run apart from the desktop, so stopping the desktop leaves them running, and they keep going while Breadstick shows nothing on screen.