Commit Graph
2971 Commits
Author SHA1 Message Date
Joachim Wiberg e7516f2b63 Bump version for v4.3-rc1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-17 11:08:15 +02:00
Joachim Wiberg d18167fe1d Update ChangeLog, ref cmdline.doc and fix libuEv linking
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-17 11:07:13 +02:00
Joachim Wiberg 7d3f95c0a9 doc: minor, emphasize 'debug' like all other kernel cmdline keywords
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-17 11:06:31 +02:00
Joachim Wiberg 86c5bbb03d doc: fix markdown syntax
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-17 11:06:07 +02:00
Joachim Wiberg 7530bb74f6 Update ChangeLog for upcoming v4.3 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-17 00:56:54 +02:00
Joachim Wiberg 54dd726d16 Follow-up to bd9bb92, missing API change
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-17 00:01:10 +02:00
Joachim Wiberg bd9bb92ca0 Replace reboot(RB_SW_SUSPEND) w/ internal /sys/power/state API
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-16 23:59:32 +02:00
Joachim Wiberg 01cb088e51 Fix initctl debug toggle regression introduced in ae09272b
Calling `initctl debug` is supposed to toggle Finit debug messages on
the boot console.  This broke in ae09272b when improving support for
running Finit in containers.

Part of this change is a slight refactor of who calles log_init() when
starting up, and when to call ttinit().  We now call ttinit() every time
we toggle debug.

Also, toggling back to normal logging had a bug.  The new default log
level for Finit is LOG_INFO, but toggling back set it to LOG_NOTICE.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 11:55:17 +02:00
Joachim Wiberg 3d91112e0d Rename finit command line option finit.show_status -> finit.status
Usability.

Remains backwards compatible for now, but finit.show_status is as of 4.3
deprecated.  Likely to be removed int 5.0

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 10:55:48 +02:00
Joachim Wiberg 16aef80682 Silence Coverity Scan NULL ptr deref warning
Explicitly set arg to non-NULL value.  The call to conf() later will
steer up the value to point to the full path of the user's finit.conf

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 10:02:11 +02:00
Joachim Wiberg fd34914936 Fix unchecked return value, found by Coverity Scan
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 09:57:04 +02:00
Joachim Wiberg 21a890a04e Fix NULL ptr deref, introduced in 8e2d0060 for issue #189
Found by Coverity Scan.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 09:53:58 +02:00
Joachim Wiberg 7f5f7e8ef6 Fix resource leak in shutdown, found by Coverity Scan
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 09:48:42 +02:00
Joachim Wiberg ff937576ea Fix possible NULL deref in run() error handling
When we added support for using popen() to run(), to log the output, we
forgot to update the error handling path.  Found by Coverity Scan.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 09:45:41 +02:00
Joachim Wiberg 7d831170ae plugins: close/exit iwatch *after* event loop has been detached
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 08:33:24 +02:00
Joachim Wiberg 6a21ac55ad Enable more printf format attributes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 08:32:18 +02:00
Joachim Wiberg a0820c7f20 Fix printf format specifier and formatting issues in use of log fns
Almost all related to and (less likely) possible causes of issue #236.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 00:26:14 +02:00
Joachim Wiberg 6d58c9ed0b Enable printf format attributes to logit() and flog()
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>
2022-04-14 00:17:15 +02:00
Joachim Wiberg bc2ffbc767 Fix printf style function missing argument to %s
This is very likely the root cause of issue #236, let's see.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-14 00:10:30 +02:00
Joachim Wiberg 4c1fc2410e Show progress output also for unmount
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-12 22:41:12 +02:00
Joachim Wiberg 70e1aa889a Ignore errors from the first two remount,ro they are just decoys
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-12 22:28:10 +02:00
Joachim Wiberg c8c5e4e88a Revert "Simplify shutdown, no need for workarounds to remount / read-only"
This reverts commit 7c42986800 since we
seem to still need this werid thing on some systems.  The key seems
to use 'any' device at remount[1].  Anyway, the key issue before was
the noisy output, but like Debian we'll just redirect to /dev/null.

[1]: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/29187

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-12 22:22:18 +02:00
Joachim Wiberg 86c1398778 Run swapoff interactively, let user know what's happening.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-12 22:21:52 +02:00
Joachim Wiberg b37fa2b417 Silence process killer at shutdown, too noisy on regular systems
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>
2022-04-12 22:16:57 +02:00
Joachim Wiberg a91e197553 Avoid looping forever trying to unmount busy tmpfs
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>
2022-04-12 21:57:14 +02:00
Joachim Wiberg 5adb92ca1b Catch and print any errors when unmounting filesystems at reboot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-12 21:45:37 +02:00
Joachim Wiberg cfc99c4e8b Follow-up to ef9e9ec, run ifdown also in background, with --force
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>
2022-04-12 21:45:37 +02:00
Joachim Wiberg 3e51ed1c55 Run swapon interactively, let user know what's happening.
Let's try this, should be OK for all types of systems.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-12 21:45:37 +02:00
Joachim Wiberg b5df0a6274 Fix swapoff at shutdown, does not support -e flag
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-12 21:33:54 +02:00
Joachim Wiberg cbe8d56042 Mention lack of mainline distro testing on non-x86 archs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-12 08:35:13 +02:00
Joachim Wiberg a3ec792b44 doc: minor updates to build script, again
- 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>
2022-04-12 08:33:50 +02:00
Joachim Wiberg c24855d4d5 keventd: add support for toggling debug messages w/ SIGUSR1
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>
2022-04-11 22:38:35 +02:00
Joachim Wiberg 014e457fda doc: note which plugins are enabled by default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-11 21:35:16 +02:00
Joachim Wiberg 21d89c7e24 doc: mention kernel command line option loglevel=7
This is needed since 5ff27c4f when support for debugging Finit and the
kernel independently was added.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-11 21:32:28 +02:00
Joachim Wiberg 639fb76f5a doc: update build ref, add "or later" to required libraries
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-11 21:14:35 +02:00
Joachim Wiberg 30c189b116 initctl: add helpful hint when showing/editing built-in services
Built-in services, like keventd, do not have a .conf file to edit.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-11 20:51:46 +02:00
Joachim Wiberg e2a8803f7a test: minor, extend log message a bit
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-10 22:46:45 +02:00
Joachim Wiberg 209e140ddd test: let Finit's bootmisc plugin create the /var/run symlink
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-10 22:46:15 +02:00
Joachim Wiberg 2e3fa72924 Revert "plugins: bootmisc: use relative symlink for /var/run"
This reverts commit f0e328edc9.
2022-04-10 22:38:27 +02:00
Joachim Wiberg 1502838a0d Fix regression in _pe() log macro, introduced in 685f332
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-10 12:39:20 +02:00
Joachim Wiberg 377c8bce8c test: fix dist and tenv-root/ regression from refactor
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-09 17:52:48 +02:00
Joachim Wiberg a39d958d25 Follow-up to 7dc7f9a, protect against stalling on non-existing pids
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>
2022-04-08 07:27:42 +02:00
Joachim Wiberg 7f8a96a73e test: refactor test framework to use a rootfs skeleton
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>
2022-04-08 07:22:33 +02:00
Joachim Wiberg 5c2577214d test: ask BusyBox its tools and recommended paths
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>
2022-04-06 22:42:49 +02:00
Joachim Wiberg f03206a694 .github: due to regression in ubuntu-latest, use older ubuntu runner
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>
2022-04-06 21:16:46 +02:00
Joachim Wiberg f0e328edc9 plugins: bootmisc: use relative symlink for /var/run
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>
2022-04-06 21:13:43 +02:00
Joachim Wiberg 13342f2bd9 .github: debug failing tests again, see what setup-root does
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>
2022-04-04 19:43:43 +02:00
Joachim Wiberg c926160853 Issue #223: add type:forking service option, with updated docs
- 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>
2022-04-04 19:13:28 +02:00
Joachim Wiberg 462d5b22b4 Fix parse bug, always set service's respawn flag
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>
2022-04-04 18:06:35 +02:00
Joachim Wiberg b1bfab08f3 Coding style, reverse Christmas tree ordering
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-04 08:26:13 +02:00