We don't want repeats of issue #236, so let's start by tracking down any
bugs hidden in logging functions.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
On regular desktop systems, like Debian, the dbus-daemon forks off a
dbus-launch process to start up things like your desktop for you. This
process is not known to Finit and lingers in the background since it's
been reparented to init, and to top things off it seems to ignore any
SIGTERMs send to it.
Obviously this makes a shutdown on such systems very noisy, so this
patch changes the print() to a _d() so anyone debugging a system can see
it with `-- finit.debug` on the kernel command line, or `initctl debug`.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This split unmount is a bit crude, unfortunately. A user may have set
up a bind or overlayfs mount on top of a tmpfs -- so unmounting tmpfs
first will then always result in EBUSY.
Avoid logging busy errors and fake OK. We'll catch it later in the
second stage unmount.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Turns out that on Debian `ifdown -a` can block for quite a while at
shutdown/reboot. So we'd like to use the --force option. However,
the BusyBox ifdown tool doesn't support --force, only -f, which in
turn the regular ifdown tool doesn't support.
Regardless, we can allow network shutdown to run in the background
like bring-up, at reboot we want to reboot quickly and don't care
so much, and on runlevel change to single-user mode we can allow
for some lagging behind in the background.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Mention why configure script is missing from GIT
- Adjust command line for enabling Finit debug
- Plus some minor formatting issues
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Useful to debug system events after the system has started up and you
don't want to rebuild Finit to add the `-d` command line flag.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This is needed since 5ff27c4f when support for debugging Finit and the
kernel independently was added.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A forking service, e.g. a SysV init script, that returns is no longer
running, even though the monitored service may still be starting. We
must mark the svc->pid as terminated until we know more -- otherwise
we may stall on a shutdown at that exact point.
Also, when shutting down, and stopping all services, ensure we do not
start the carousel for non-existing PIDs. This might also cause our
stalling at shutdown.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Instead of having to create files, and copying them in place for each
test, we move all static test files to a skeleton rootfs. This makes
it a lot easier to get an overview of how things and how they work.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Note: we need to add /usr/bin and /usr/sbin to the standard PATH
for tests and the test environment itself.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
In https://github.com/actions/virtual-environments/commit/12fa229 the
ubuntu-latest runner was updated to Ubuntu 20.04.4, with Linux kernel
version: 5.13.0-1014-azure. This broke the Finit tests completely
and the only possible solution, for now, seems to be reverting back
to the ubuntu-18.04 runner instead.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
In an upside world, much like the Finit test cases, the root may be
relocated. This make /var/run relative to /var, instead of /. Which
hopefully is safer and covers more use-cases.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
All tests except the first two now suddenly started failing. Might be
the new caching support for the busybox binary, but that works on other
clean clones -- working theory now is that there's something subtle
with the setup-root.sh test -- which PASSes ...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Add `type:forking` service option to trigger guessing pidfile to
watch for, instead of `pid:!foo` option, which is not intuitive.
This option may likely also survive into the new file format :)
- Update docs and add examples
- Update start-stop-serv.sh test case with this new variant
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Before this fix, a service declared with respawn could not be changed at
runtime to remove the respawn flag.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
While without a working Internet connection today I ran into the issue
of not being able to run the tests. This adds a basic caching mechanism
to setup-root.sh which saves busybox-x86_64 in ~/.cache, if available.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
serv: add support for foregrounding, running with and without PID file,
including custom PID filename.
test: verify Finit can start & monitor services that:
1) Fork and creates a PID file in a known location
2) Don't fork and don't create a PID file, but Finit does
3) Don't fork but create a PID file
4) Don't fork and create custom named PID file
Note: Finit cannot support a service that forks and doesn't create a PID
file. This combination is impossible to support without tracking
all processes created in /proc -- which Finit does not do atm.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Calling sync is not needed, remount does this for us.
Remount with 'dummydev' causes warnings and is not needed. It appears
sysvinit used this to try and fix a sparc related bug. Instead, use the
rootfs keyword to ensure we don't accidentally remount a bind mounted /.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Coding style for shell scripts:
- Tabs for indent (change in Emacs needed)
- Braces on their own line, like C functions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>