SD Core Solo for Linux LS2.0-0

Running SD

How SD starts, stopping it, the command line, and what to do when the last shutdown was not a clean one.

SD is your own systemd user service, and it is already running. You do not type sd-solo -start after every sign-in.

Unit sd-solo.service starts SD, and sd-solo-lnxd.service runs the clean-up daemon sdlnxd and starts it again if it dies; with an API, sd-solo-api.socket is the listener and sd-solo-api@.service runs one API session per connection
Where ~/.config/systemd/user/ — user units, started by your own systemd user manager and running as you
Start type enabled — your systemd user manager starts them when it starts
Created by the installer (tools/solo-service.sh install)
Removed by the uninstaller

The user manager starts when you first sign in and stops when your last session ends — unless linger is on. With linger enabled, SD starts at boot and keeps running while you are signed out, which is what remote access (ssh or the API when nobody is at the keyboard) needs. The installer turns it on by default (--no-linger or the control file's enable-linger=no leaves it off). It is a persistent setting of your account; sudo loginctl disable-linger $USER turns it off. To turn it on later, as an administrator of the computer:

sudo loginctl enable-linger $USER

Without linger, sd-solo still works while you are signed in — SD is started with your user manager — but a scheduled job or an API client that arrives after you have signed out finds nothing running.

Starting and stopping#

systemctl --user stop sd-solo.service
systemctl --user start sd-solo.service
sd-solo -stop
sd-solo -start

Stopping SD ends every session, including API and ssh sessions. Neither needs sudo: SD, its data and its programs are yours. If you stop it with sd-solo -stop while systemd thinks it is running, systemctl --user status still says active (the unit is a one-shot that remains after exit); use systemctl --user stop when you want systemd to know.

sd-solo -start and sd-solo -stop check the real process, not just the segment#

SD's shared state lives in a System V shared-memory segment, which — unlike a file — can outlive the daemon process that created it if SD is killed rather than stopped cleanly. sd-solo -start and sd-solo -stop validate the daemon's actual process id rather than trusting the segment's mere existence:

"SD is already started" is only said when the daemon really is running, and it names the process id — the one ps and kill use.

If the segment is there but the daemon is not — what a killed or crashed SD leaves behind — sd-solo -start says so rather than silently reporting success against a segment nothing is serving. Clearing it is sd-solo -stop's job.

Check the daemon by hand at any time:

ps -u $USER -o pid,cmd | grep '[s]dlnxd'

A session still attached ten seconds after the stop is ended. sd-solo -stop and sd-solo -restart send every session the termination signal, wait up to ten seconds for them to leave, and end any process still attached to SD's shared memory with SIGKILL; they say how many they ended, for example 1 process(es) still attached after ten seconds were ended with SIGKILL. Only a process that is attached to SD's own segment is touched, and a session ended this way does not run its own logout.

The clean-up daemon is started again if it dies. sdlnxd is the process that notices a session whose process has gone and clears it down. It runs as its own user unit, sd-solo-lnxd.service, and systemd starts it again two seconds after a failure (kill -9, a crash, the process being killed for memory). A stop with sd-solo -stop or systemctl --user stop sd-solo.service is not a failure and is not restarted. Systemd allows five starts of the unit in a minute and refuses the sixth; every start counts, a restart after a crash and your own systemctl --user restart sd-solo.service alike, so five restarts of your own followed by a crash leave the daemon down. systemctl --user reset-failed sd-solo-lnxd and systemctl --user start sd-solo-lnxd take it from there. A plain sd-solo -start, and sd-solo -restart, still fork a daemon of their own, which nothing watches; use systemctl --user restart sd-solo.service when you want the unit to run it. Only one daemon runs at a time: a second sdlnxd finds the first and ends.

A script may capture what sd-solo -start prints. x=$(sd-solo -start) or sd-solo -start | tee start.log returns as soon as SD has started. The daemon it leaves running does not keep the script's pipe: it writes to /dev/null instead, so anything it prints after the start is not seen there. Sent to a file or a terminal, its output goes there as before.

A System V segment does not survive a reboot — the kernel clears its IPC state on every restart. A reboot always leaves a clean slate; the "segment present, daemon dead" case above is about a crash the computer did not restart from.

Only one SD Core Solo for Linux can run on a computer. The shared-memory name is machine-wide, so a second Solo, for another Linux user, would attach to the first one's segment. SD Core for Linux uses a different shared-memory name and different ports, so the two products can be installed and run on the same computer; the command names (sd and sd-solo) say which one you start.

sh runs as you, when the shell switch is on#

It needs the shell switch (set.os.access sh on), which is off as delivered; with it, the command runs as your own Linux user. See Operating system access.

Starting sd-solo from inside sh is refused. The shell that sh and os.execute start is marked as SD's own, and sd-solo typed there answers "SD is already running in this session - type exit to return to it." in every form of the command. It keeps a second session from being nested inside the first; it is not a wall, because the mark is an environment variable of that shell.

The command line#

sd-solo                  enter the account, after the account password
sd-solo <command>        run one command and return, using the kept password
sd-solo -a               the same as sd-solo: there is one account
sd-solo -asduser         enter that account (any other name is refused)
sd-solo -quiet           suppress the displays on entry
sd-solo -u               list current sessions
sd-solo -k <n> | -k all  end session n, or every session
sd-solo -start           start SD
sd-solo -stop            stop SD
sd-solo --version        report the version
sd-solo --help           a summary of these

sd-solo <command> runs and exits, with no prompt. It uses a copy of the account password kept for you (see The account and its passwords), which is what lets a script or a scheduled job use SD. If that copy is missing or no longer matches, what happens depends on where the input comes from:

typed at a terminal refused: A command given on the sd command line needs the account password on its input
piped in the first line of the input is taken as the password, once — so a job can supply it itself

set.password keeps the copy up to date when you change the password.

sd-solo -a and sd-solo -a<name> have nothing to choose between: there is one account, sduser, and every session lands in it. sd-solo -asdsys is refused, saying that SDSYS is not entered in Solo.

sd-solo -u, sd-solo -k and sd-solo -cleanup need no admin. They are switches on the program, outside any SD session, and like -start and -stop they are the business of the user who owns SD, who is the only user: Solo has no sdsys user and no second user whose sessions they could show or remove. -cleanup clears the entries of sessions whose process has gone from the user table. Inside a session, the same jobs are LISTU and LOGOUT, which do need admin — see Sessions and locks.

sd-solo refuses to run as root, and says so before anything else. Solo has no use for root; running it as root would leave files in your tree that you could not then manage.

Where things are#

Everything is under ~/SDCoreSolo (or the --home you gave the installer):

Programs bin/ — sd-solo, sdlnxd (the daemon), sdtic, sdconv (22), sdfix (20), sdidx (21), sdclilib.so
The changelog changelog
Configuration sd.conf
SD's own files the rest of the directory: gcat/, messages/, voc, $cred/…
Your account user_accounts/sduser/
Audit trail audit
Error log errlog
What was installed .sdcore-install

The whole directory can be moved; its parts cannot be separated. SD finds its files from where its programs are (the directory that holds bin/, and that holds the marker file .sdcoresolo), so a copied tree works from another place — but the service units, the ~/.local/bin/sd-solo link and Solo's ssh configuration (sshd/sshd_config, written by solo-ssh.sh setup) name the old path and must be redone.

Checking the service#

systemctl --user status sd-solo.service
journalctl --user -u sd-solo.service

systemctl reports whether systemd thinks the unit is running; sd-solo -u reports who is actually connected.