Commit Graph

684 Commits

Author SHA1 Message Date
Jason A. Donenfeld
076c2552ae Use seedrng for seeding the random number generator
The RNG can't actually be seeded from a shell script, due to the
reliance on ioctls. For this reason, the seedrng project provides a
basic script meant to be copy and pasted into projects like OpenRC and
tweaked as needed: https://git.zx2c4.com/seedrng/about/

This commit imports it into OpenRC and wires up /etc/init.d/urandom to
call it. It shouldn't be called by other things on the system, so it
lives in rc_sbindir.

Closes #506.
Closes #507.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-03-26 19:16:27 -05:00
omnivagant
e045591845 init.d/devfs: default mount /dev noexec 2022-01-30 01:53:25 -05:00
Dermot Bradley
98feac173e init.d/bootmisc.in: prevent error due to nonexistant file
During boot if the "previous_dmesg" setting is enabled in
/etc/conf.d/bootmisc then during the 1st boot of a machine the
bootmisc init.d script will attempt to move a nonexistant dmesg
file, so generating an error on the console.

Modify the script to only move an existing file.
2022-01-30 01:53:10 -05:00
William Hubbs
c045d33a40 fix filename in FreeBSD meson build 2021-12-30 18:41:38 -06:00
Aaditya Bagga
703bdbf88e supervise runsvdir daemon
This fixes #254.
2021-12-20 22:32:36 -06:00
Mike Frysinger
301161a7a4 use HEAD in git URIs to point to the default branch
This makes the URIs shorter and dynamic: whatever the default branch
the repo uses will be used.
2021-12-20 20:07:00 -05:00
iucoen
e21b01b97e net-online: add missing sleep 1 in ping loop
Currently the ping loop instantly times out because timeout is decremented by 1 without actually going to sleep.

This fixes #480.
2021-12-12 19:17:16 -06:00
William Hubbs
0eb11e7db6 killprocs: add kill_delay setting
This allows containers using OpenRC based services to be configured to
allow open tcp connections to be closed before they are shut down.

This fixes #476.
2021-12-07 13:40:15 -06:00
Kerin Millar
cd4bbdcd62 init.d/s6-svscan.in: make sure $command exists
While the s6-svscan runscript belongs to OpenRC, the user is required to
install s6 before it can actually be used, potentially leading to
confusion. Check for the existence of $command in start_pre and, if it does not
exist, bail out with an error that makes this observation.

X-Gentoo-Bug: 816978
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=816978
2021-10-14 23:03:32 -05:00
hosxy
c6a037e9dd fix agetty can be start directly
This fixes #320.
2021-09-15 17:01:19 -05:00
Natanael Copa
7faa48ae04 hide error when migrating /var/run to /run
The script tries to copy non-existing files. We simply hide the error

http://bugs.alpinelinux.org/issues/3160
This fixes #451.
2021-09-15 10:21:12 -05:00
Natanael Copa
93d600c0a4 force root to be rw before localmount
The original service that pulled in root remount was mtab which
is not part of OpenRC.

This fixes #449.
2021-09-14 11:28:41 -05:00
William Hubbs
d6622a1156 add meson build files
Closes #116.
Closes #171.
Closes #172.
Closes #175.
2021-09-04 16:01:29 -05:00
Lars Wendler
0d86c4903b init.d/modules.in: Avoid loading modules twice in Linux with dash shell
Since commit 6b475ab269, openrc tries to load
modules twice which have been defined in /etc/conf.d/modules via modules=
variable when /bin/sh points to dash shell.
The reason is that when the "modules-load" service was merged into "modules"
service, the "modules" variable name got used in both, load_modules()
function and in Linux_modules() function which both get called when modules
service is started. Although "modules" variable is marked as local in
load_modules(), dash simply ignores this.

Avoid the issue by renaming "modules" variable to "_modules" in
load_modules() function.

This fixes #419.
2021-05-12 18:20:43 -05:00
Thomas Deutschmann
1878a74a12 numlock: Don't disable numlock on shutdown
When dealing with remote consoles, a shutdown could disable
host's numlock which is not desired.

This fixes #413.
2021-03-19 10:36:31 -05:00
William Hubbs
4fb4674374 fix unified cgroups v2 setup
The cgroups v2 setup required the rc_cgroups_controllers variable
to be set to the list of controllers to enable regardless of whether the
mode was hybrid or unified.

This makes sense for hybrid mode since the controllers can't be in both
the cgroups v1 and v2 hierarchies, but for unified mode we should enable
all controllers that are configured in the kernel.
2021-02-23 23:08:56 -06:00
William Hubbs
12ee72a9b3 allow devfs to run on lxc
X-Gentoo-Bug: 761918
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=761918
Closes #272.
2021-01-28 12:32:09 -06:00
Gaël PORTAY
bf9af1fb23 net-online: fix process of symlinks in sysfs
The test `[ -h "${ifname}" ] && continue` skips the symlinks while it is
the opposite that is the expected: ignoring files that are not symlinks.

Fixes commit f42ec82f21.
This fixes #391.
2020-12-22 12:49:48 -06:00
Dermot Bradley
57d9528a0b Remove warning when osclock init.d script runs
Currently when osclock is enabled as a init.d service the following
messages appear during boot when osclock starts:

  * The command variable is undefined.
  * There is nothing for osclock to start.
  * If this is what you intend, please write a start function.
  * This will become a failure in a future release.

osclock is activated whenever a machine's system clock is automatically
configured from a RTC by the kernel and the osclock's only purpose is to
satisfy the "clock" dependency defined by other init.d services.

Adding a stub start() function prevents OpenRC from showing warnings but
continues to ensure that the osclock service still does not actually do
anything.

This fixes #377.
2020-11-27 18:06:38 -06:00
William Hubbs
0fab3e837b bootmisc: allow sysvinit compatibility during shutdown
Use "halt -w" to write the halt record if it exists.
Otherwise use openrc-shutdown.

This fixes #336.
2020-11-27 15:18:57 -06:00
William Hubbs
a71aebcae1 init.d/agetty: provide the getty virtual service 2019-07-29 17:39:11 -05:00
William Hubbs
76420d9849 init.d/agetty: set default respawn period to 60 seconds
Without a respawn period setting, the supervisor will give up on
respawning agetty after it is respawned respawn_max times. For most
daemons giving up like this is reasonable, but not for agettys. Agettys
should always be respawned unless they are respawning too fafst,.

If an agetty is respawning faster than 10 times in 60 seconds, this
seems to be too fast.
2018-12-06 16:37:40 -06:00
William Hubbs
7eb3975543 Create save-keymaps and save-ktermencoding services
These services represent the parts of the keymaps and termencoding
services which saved the settings back to the root file system so they
can be loaded very early in the boot process.
These are needed to allow keymaps and termencoding to run earlier in the
boot sequence.

X-Gentoo-Bug: 446018
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=446018
2018-11-07 08:55:44 -06:00
William Hubbs
d70b1c55b6 modules: Add --first-time switch to modprobe commands
On Linux, kernel modules should be loaded once during boot, either in an
initramfs or by this service.

This does not change anything other than printing out messages if a
module is loaded more than once.

X-Gentoo-Bug: 659530
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=659530
2018-10-23 16:47:37 -05:00
Austin English
02af093043 misc: whitespace fixes 2018-10-13 12:53:54 -04:00
William Hubbs
7cb8d94323 Stop mounting efivarfs read-only
We do not need to do this any longer since all supported linux kernels
make efivarfs immutable and the tools that manipulate it are aware of
this feature.

This fixes https://github.com/openrc/openrc/issues/238.
2018-08-14 10:21:27 -05:00
William Hubbs
a571a42421 modules: remove the ability to rename modules on the fly
Kmod doesn't support the -o switch, so if you have been using this your
module loads have been failing.
2018-06-29 15:29:46 -05:00
William Hubbs
f0ad647303 Revert "savecache: stop saving the dependency tree"
It is safe to save the deptree, but we also need to regenerate it at
boot time.
2018-05-11 11:54:48 -05:00
William Hubbs
a3d0e293ee Remove localmount from dependencies for linux-only services
This removes localmount from the dependencies of the consolefont,
keymaps, numlock and procfs services.

These services are Linux only and the default modern linux system has /
and /usr on the same file system.

This also fixes the following issue.

X-Gentoo-Bug: 651998
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=651998
2018-05-07 18:12:55 -05:00
William Hubbs
6b475ab269 init.d/modules: add code from modules-load service
There is no reason for these to be separate services. I did add a
provide so that we don't break backward compatibility.
2018-03-16 14:33:01 -05:00
William Hubbs
b302b0c094 net-online: always start after net
X-Gentoo-Bug: 650600
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=650600
2018-03-16 13:53:02 -05:00
William Hubbs
40aa69cf3a agetty.in: allow status to be displayed 2018-03-14 20:37:02 -05:00
Scall
3e68013631 init.d: swap should always be started after root
Otherwise if a swap file is being used, and swap is started before
root, swapon may fail because of a read-only filesystem.
2018-03-05 20:16:26 -05:00
William Hubbs
e51dc29e2f cgroups: fix indentation 2018-02-27 15:56:54 -06:00
William Hubbs
c6047f887a cgroups: add rc_cgroup_memory_use_hierarchy setting for cgroups v1 2018-02-26 14:33:15 -06:00
William Hubbs
38032626a6 improve cgroup configuration checks
make the base/controller functions return successfully if cgroups v1/v2
are not configured in the kernel
2018-02-23 15:07:04 -06:00
3PO
f42ec82f21 net-online: only process symbolic links in /sys/class/net
The /sys/class/net directory contains files which are not symlinks if
the system has bonded devices [1].  We should ignore these files.

This fixes #196.

[1] https://elkano.org/blog/manage-interface-bondings-sysfs-interface/
2018-01-05 14:56:33 -06:00
William Hubbs
4f750933fd procfs: remove the @sysconfdir@ reference 2017-12-14 17:31:57 -06:00
William Hubbs
50b69d564a hostname: replace @SYSCONFDIR@ references with /etc
I do not know of any situation where /etc/hostname is at any other
location. Also, this does not run on prefix.
2017-12-14 17:07:31 -06:00
William Hubbs
eb18f4f348 hwclock: use shell variables for configuration file path
This removes a reference to @SYSCONFDIR@.
2017-12-14 16:38:09 -06:00
William Hubbs
d5f3fe52c8 sysctl: hard code paths for sysctl files on *bsd
For *BSD,the sysctl*.conf files are always in /etc.
2017-12-14 14:18:39 -06:00
William Hubbs
bb1bc6eeb7 local: misc cleanups
Remove references to @SYSCONFDIR@ since these can be calculated at
runtime.
Also style fixes.
2017-12-14 12:52:03 -06:00
William Hubbs
53844fd0dc devfs: cleanup
clean up local definitions. Also remove @SYSCONFDIR@ substitutions since
they can be calculated at runtime.
2017-12-14 12:08:38 -06:00
bell07
14938c29ce net-online: wait for ping_test_host
The script should wait till the ping host is available or timeout reached
Closes : #179
Closes : #191
2017-12-12 16:29:34 -06:00
William Hubbs
8bf501aaf2 network: use 'command -v ip' to test for the ip executable
This is an improved test because it doesn't require the ip executable to be
in a specific path.
2017-12-12 14:23:04 -06:00
William Hubbs
9d05f68b51 Do not use file tests in net-online
https://unix.stackexchange.com/questions/252002/help-testing-special-file-in-sys-class-net

This is for #189
2017-12-12 12:45:52 -06:00
William Hubbs
ee2524cd1d net-online: clean up quoting and test for existence
This is for #178.
2017-12-11 17:41:04 -06:00
Marcel Greter
5c81661d47 Gracefully handle unreadable /sys/class/net/dev/ nodes
Fixes https://bugs.gentoo.org/629228
Fixes #189
Fixes #185
Fixes #178
2017-12-11 14:46:16 -06:00
William Hubbs
3de6395ae3 split cgroups mounting out of sysfs
This is neceessary to allow cgroups to be mounted in an lxc/lxd
container.

Fixes https://github.com/openrc/openrc/issues/187
2017-11-28 17:14:33 -06:00
William Hubbs
318e873481 strongly encourage Linux users to not make /etc/mtab a flat file
The OpenRC team does not currently know of any modern linux tools that
require /etc/mtab to be a flat file, so this puts users on notice that
the mtab service will be removed in the future.
2017-11-14 15:41:03 -06:00