Commit Graph
2041 Commits
Author SHA1 Message Date
Joachim Wiberg 5d7ce3a92b configure: drop remaining --with-console, auto-probed now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 20:20:08 +01:00
Joachim Wiberg 82664396d6 Refactor 3e8d63c: use consoles from /sys/class/tty/console/active
As documented in the kernel docs and systemd[1], the default system
console is the first listed in /sys/class/tty/console/active, which
is the reverse order of console= given on the kernel cmdline.

Some distros don't have console= on their default command line in
their bootloader, e.g. Alpine Linux, some multiple, e.g Buildroot.
Instead of relying on the value given at configure time we probe
sysfs and open all (at most three) consoles listed.  This way we
at least get the default console for our progress output.

- drop old --with-console from configure script
- drop /proc/cmdline fishing in favor of sysfs
- replace CONSOLE from configure with new console()

[1]: http://0pointer.de/blog/projects/serial-console.html

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 20:09:49 +01:00
Joachim Wiberg 3fb700c17d Deprecation warning: inetd removal, update TODO accordingly
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 17:39:13 +01:00
Joachim Wiberg 1a5aabc034 Update configure examples and build scripts with correct paths
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 17:27:05 +01:00
Joachim Wiberg aa4addfa86 configure: drop note at bottom, we use std gnu defaults now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 09:28:36 +01:00
Joachim Wiberg 06fdcf51b9 configure: revert to using GNU defaults, update summary
- Changing the GNU defaults is messy.  The best way is to leave them
  alone and let the user set their install locations themselves.
- Show --exec-prefix in config Summary, that's where the binaries go

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 07:58:25 +01:00
Joachim Wiberg 7d6eb2b59b initctl: use same headings for ls as show
From the start, the output from the 'list' command has been different
from the output of the 'show' command.  No longer.

Also, drop the 'AVAILABLE', 'ENABLED', and 'STATIC' prefixes.  They were
a bit screamy and superfluous.  'STATIC' wasn't even a good name for the
locally administered ones.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-08 07:29:05 +01:00
Joachim Wiberg 5c2ba8ef3a Adapt ifupdown support to new world, run 'ifup -a' in the background
All Debian based distros are moving towards a /etc/network/interfaces.d/
world.  Adding support for that is too complex, so we're reverting back
to calling 'ifup -a' or 'ifdown -a'.  We still guard this by checking
both for 'ifup' and the existence of /etc/network/interfaces (which in
the new world only contains a line to source per-interface files).

By popular demand, this patch also changes to bring up/down networking
in the background.  Useful for embedded system bringup and containers.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-07 14:54:53 +01:00
Joachim Wiberg fccba7cd4c Replace %m GNUism with strerror(errno)
Even musl libc supports %m today, as well as most syslog daemons, but
that's no excuse to use this.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-07 13:21:55 +01:00
Joachim Wiberg 3e8d63c29c Support for multiple (3) console= on kernel cmdline
Some targets, like Raspberry Pi, have both serial and HDMI console
enabled.  Depending on the order of arguments on the kernel cmdline
either one were selected the default 'stderr', which finit used.

This patch adds support for parsing the console= string(s) and
opening multiple outputs for system startup/progress.  In the
end, however, a getty still needs to be started on each of the
consoles to use.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-07 13:15:46 +01:00
Joachim Wiberg 18359ef448 Follow-up to 4febd28: bring back /dev, /proc, and /sys
We need /proc for rs_remount_root() and conf_parse_cmdline(), /dev for
early multi-console support, and /sys for the cgroups support.  All of
these may be in the system /etc/fstab, which fs_mount() later remounts.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-07 12:53:35 +01:00
Joachim Wiberg 0c85f8adfe initctl: add 'ls' alias for 'list'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-06 20:55:09 +01:00
Joachim Wiberg 84c6ab737e Silence kernel output on console when starting up
Many systems have a very verbose kernel by default.  This patch calls
`klogctl(SYSLOG_ACTION_CONSOLE_OFF, NULL, 0)`, which is sysklogd also
calls but later when it starts emptying /dev/kmsg.

We do this to get an undisturbed console while starting up.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-06 20:37:41 +01:00
Joachim Wiberg 9e73fda2ac Follow-up to 4febd28: remount / as rw requires /proc to be mounted
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-06 20:37:41 +01:00
Joachim Wiberg 254d7e0238 Merge pull request #142 from jackuess/sigpwr-handling
Follow-up to eeb59eb: handle SIGPWR like SIGUSR2

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-02 16:10:00 +01:00
Jacques de Laval 022f140b3a Handle SIGPWR like SIGUSR2
This seems to be inline with Busybox init, SysV init and, according
to the comments in code, the intended behaviour of Finit.

The effect is that `SIGPWR` will lead to Finit issuing the syscall `reboot`
with `cmd` parameter set to `RB_POWER_OFF` (rather than `RB_AUTOBOOT`), which
in turn will lead to a halt rather than a reboot.
The effect of the above inside a PID namespace other than the initial PID
namespace is that `wait` inside the parent of Finit will report that Finit was
killed with a `SIGINT` signal rather than `SIGHUP`.
2021-02-02 15:13:16 +01:00
Joachim Wiberg 378456b6bd Merge pull request #138 from wkz/boot-refactor
Bootstrap refactor
2020-10-20 19:21:15 +02:00
Tobias Waldekranz adcc78039e Bring back the hotplug-daemon-heuristic as a plugin
This way, the default behavior stays the same, but users can opt out
by disabling the plugin.
2020-10-20 14:57:10 +02:00
Tobias Waldekranz bdceeb83d5 Ensure that plugins are loaded before the first hook point
We want plugins to be able to register themselves at the banner hook
point, but that requires that we have actually loaded them before
then.
2020-10-20 09:48:33 +02:00
Tobias Waldekranz 100cea5d9f Read configuration after filesystem mount
The contents of /etc/finit.conf and friends could potentially change
after mounting /etc/fstab. If, for example, /etc was to be re-mounted
from ro to rw using an overlay filesystem, we want any user changes to
the configuration to take effect.
2020-10-20 09:31:58 +02:00
Tobias Waldekranz cc655609e2 Do not exempt basefs up hook in rescue mode
No other hook is treated in this fashion, so it seems silly to single
out poor HOOK_BASEFS_UP.
2020-10-20 09:31:58 +02:00
Tobias Waldekranz 18ab7d3183 Remove hard-coded hotplug and watchdog daemons
Instead of heuristically trying to determine the correct hotplug
daemon to use (mdev/udev), defer to the user to specify it in the
configuration.  Same goes for the built-in watchdog.
2020-10-20 09:31:58 +02:00
Tobias Waldekranz 4febd288ef Defer all filesystem setup to the user via /etc/fstab
Traditionally, Finit has setup _some_ filesystems that are Nice To
Have (tm), using options that do the Right Thing (tm).

On the one hand, this is very convenient for users that don't
necessarily know what a reasonable mode= value is for /tmp etc. (pun
intended).  It also means that mountpoints can be created if they
don't exist.

On the other hand it means that all users are forced to submit to the
choices made by Finit.  Also, different filesystems where spread out
at many different points in `main()`, meaning that the fact that
`/proc` was available at a given hook point did not imply that `/sys`
was, for example.

Instead, defer _all_ filesystem setup to the user by simply calling
`mount -a`.  We then ship an example `fstab` that shows how to
re-create the old behavior.
2020-10-20 09:31:58 +02:00
Tobias Waldekranz b280c8a16a Remove comments from fsck 2020-10-13 15:26:51 +02:00
Tobias Waldekranz 9c8df123e8 Always run banner plugin hook
Upcoming external plugin support means that even though there are no
internal plugins that depend on this hook, there might be external
ones.
2020-10-13 15:23:41 +02:00
Tobias Waldekranz e558d5871b Move argument-hiding magic together with argument parsing
Everything else Finit does related to parsing the incoming arguments
is in conf.c, so it makes sense for this block to also reside there.
2020-10-12 13:09:41 +02:00
Joachim Wiberg 2ce1a003d5 Add notice about default paths to configure summary
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-09-16 06:39:47 +02:00
Joachim Wiberg 8a8a51e23c Merge pull request #132 from firasuke/patch-1
Fix styling
2020-09-13 08:31:33 +02:00
Firas Khalil Khana c3e0a205f9 Fix styling 2020-09-12 16:21:13 +03:00
Joachim Wiberg 24a78d3246 Update copyright years and author last name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-09-02 23:38:11 +02:00
Joachim Wiberg 31f6362e2e Update author (my) last name
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2020-09-02 23:38:11 +02:00
Joachim Nilsson 946ca09c54 Merge pull request #130 from roycyt/fix-typo
doc/distro.md: fix typo
2020-07-10 11:07:47 +02:00
Roy Chen 552f52e061 doc/distro.md: fix typo 2020-07-10 14:49:16 +08:00
Joachim Nilsson 57ab42bb7f Final (?) change to banner, use standard unicode bullet U+25CF
This patch to the banner "hello" is hopefully the last in this new style
progress.  Previous efforts have used unicode symbols not available in
all fonts.  This time we standardize on one that looks good both the
default Ubuntu Mono and Source Code Pro fonts.  It's a bit small in my
preferred font, Envy Code R, but that might be a mistake in the font.

Not tested with PuTTY or Windows Hyper Terminal.  I think they use the
Courier font by default, both of them, which I have tested.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 16:27:47 +02:00
Joachim Nilsson b7e4310542 Drop final period '.' in new style progress
Some ppl have their own '.' in service descriptions, adding anther just
messes things up and is confusing.  The old style progress still adds
dots, but thats for padding up to [ OK ].

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 16:12:57 +02:00
Joachim Nilsson 15ee8f172b Skip loopback in ifup if its already up, for containers
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:38:36 +02:00
Joachim Nilsson 9e778aa7e8 Treat finit.conf tty console as /dev/console
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:13:45 +02:00
Joachim Nilsson 16e401f253 Revert "Add support for 'console' as compat alias to '@console'"
Because we want to reserve @console for going dumpster diving in
/sys/class/tty/console/active and 'console' to mean the literal
/dev/console

This reverts commit 217df432d6.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:10:10 +02:00
Joachim Nilsson fdead062cd Support reading --debug et al from process command line
Up until now Finit has only read /proc/cmdline to determine debug level,
single user mode, etc.  This patch is one in a series to make enable it
to run also in containers.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:08:41 +02:00
Joachim Nilsson df54f5a59c plugins: modprobe: Skip for systems without modules
Skip for systems without modules, e.g. small embedded or containers

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-07-01 13:07:57 +02:00
Joachim Nilsson 2dd5d40833 Switch traffic lights to more readily available unicode symbols
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-06-26 07:01:35 +02:00
Joachim Nilsson 0d41ff77be Minor, adjust heading
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-06-26 07:01:35 +02:00
Joachim Nilsson 76c2054fa6 Merge pull request #128 from liuming50/dont-hard-code-etc-hostname
Dont hard code etc hostname
2020-06-09 11:30:37 +02:00
Ming Liu 1fa6a98e79 modules-load.c: allow MODULES_LOAD_PATH to be overridden
Define MODULES_LOAD_PATH only when it's unset, this allows it to be
overridden, for instance, by passing CFLAGS.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
2020-06-09 10:54:09 +02:00
Ming Liu a7adff4c4b helpers.c: dont hard code /etc/hostname
Introduce a macro HOSTNAME_PATH instead.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
2020-06-09 10:51:19 +02:00
Joachim Nilsson af6f71abe4 Create SECURITY.md 2020-05-22 09:39:16 +02:00
Joachim Nilsson 9eb8e8dd99 Only track built-in watchdogd, not external ones
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-03 12:01:41 +02:00
Joachim Nilsson 23461f1ef5 Track built-in watchdogd immediately after registering it
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-03 12:00:35 +02:00
Joachim Nilsson 3b63946973 svc: The 'id' is optional now, lets default it to "" if unset
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-03 12:00:28 +02:00
Joachim Nilsson 1eca65fcda plugins: rtc: Move TZ set/unset to rtc plugin from Finit main
This patch makes the RTC plugin a bit more stand-alone, it is now also
back in the hands of the user to set a default timezone.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-05-03 11:04:48 +02:00