Commit Graph

699 Commits

Author SHA1 Message Date
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
William Hubbs
0d15898f58 adjust mtab and localmount dependencies
localmount had mtab in its "use" dependencies; however, it makes more
sense to add "before localmount" to the mtab service and remove
"use mtab" from the localmount service.
2017-11-14 13:20:49 -06:00
William Hubbs
a15de23e57 typo fix 2017-10-10 10:56:27 -05:00
William Hubbs
efa9ba485d init.d/sysfs.in: fix reference to RC_LIBEXECDIR
The sysfs init script referred to @LIBEXECDIR@ before this change, but
it is better to refer to RC_LIBEXECDIR so that we get rid of a sed
substitution.
2017-10-09 15:54:06 -05:00
Chris Cromer
d4ddd72701 add option to make agetty startup quiet
This fixes #150
2017-10-06 14:43:59 -05:00
William Hubbs
3fafd7a76e sysfs: fix cgroup hybrid mode
In hybrid mode, we should not try to mount cgroup2 if it is not
available in the kernel.

This fixes #164.
2017-09-16 17:02:52 -05:00
William Hubbs
457f928e79 add support for control groups version 2
This is for #94.
2017-09-14 10:38:10 -05:00
William Hubbs
f87a9eec3d init.d/sysfs: mount efivars read only
This fixes #134.
2017-06-13 13:19:36 -05:00
Nuno Silva
a511a48d77 init.d/hostname: fix default parameter syntax
The syntax for expanding a variable with a default value is
	${parameter:-word}
not
	${parameter-word}
although the latter still works for a reason I could not explain.

This fixes #143.
2017-06-12 10:44:27 -05:00
Nuno Silva
1e5322e5c5 init.d/hostname: fix indentation
This is for #143.
2017-06-12 10:43:55 -05:00
William Hubbs
1801561c2d init.d/bootmisc: use openrc-shutdown instead of halt to write halt record
This fixes #139 and fixes #128.
and fixes #124.
2017-06-05 16:52:50 +00:00
William Hubbs
44bac3c379 Change killprocs to use kill_all instead of killall5
X-Gentoo-Bug:376977
X-Gentoo-Bug-URL:https://bugs.gentoo.org/show_bug.cgi?id=376977
2017-05-30 18:48:33 -05:00
William Hubbs
ec27299f4b typo fix
X-Gentoo-Bug: 618888
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=618888
2017-05-22 12:52:58 -05:00
i.Dark_Templar
6f88ee4ec6 bootmisc: do not remove ld-elf32.so.hints
File /var/run/ld-elf32.so.hints is used on FreeBSD 64bit multilib
This fixes #125.
2017-04-10 10:15:28 -05:00
i.Dark_Templar
79a9edc730
Fix make install on FreeBSD: don't try to install /etc/init.d/modules twice 2017-04-05 16:54:53 +03:00
William Hubbs
55a87a30ec init.d/agetty.in: add -prefix keyword 2017-03-31 16:21:28 -05:00
William Hubbs
a912029462 init.d/mount-ro: change dependency on killprocs and savecache to after
killprocs always succeeds and savecache is not required by mount-ro, so
we can just start after both of these have run.
2017-03-31 13:39:42 -05:00
William Hubbs
51a292e09b init.d: add agetty to ignore patterns 2017-03-28 17:52:53 -05:00
William Hubbs
9bd63b5d4a update dependencies for clock service
The clock services had a very long list of "before" dependencies that
referred to other services within OpenRC. For ease of maintenance,
convert these to "after clock" dependencies in the individual services.
2017-03-16 10:16:39 -05:00
William Hubbs
c333707cba Remove all occurances of 'before *' from dependencies
Using wildcards in dependencies causes issues when rc_parallel is set to
yes because it can lead to deadlocks.
All dependencies need to be explicit rather than implicit.

This is the first stage of moving this direction.
2017-03-14 18:04:31 -05:00
William Hubbs
5f5b1f7cbe init.d/sysfs.in: efivarfs tweaks
Since we check for /sys/firmware/efi/efivars, we do not need to check
for /sys/firmware/efi

Since Failing to mount efivarfs is not critical, we silence the error
message from mount.
2017-03-12 13:55:49 -05:00
William Hubbs
d7bbb0f583 add agetty service
The agetty service is an alternate way to manage gettys with agetty
under Linux which is separate from an external init system.
2017-03-09 15:23:02 -06:00
William Hubbs
21ca2b746c init.d/sysfs: drop modules completely from the dependencies
This is for #112.
2017-03-08 10:44:10 -06:00
William Hubbs
6a79aef015 init.d/sysfs: Do not load efivarfs module
My understanding is that the kernel can autoload this module. If it
doesn't, the module should be built in or loaded from an initramfs.

This fixes https://github.com/openrc/openrc/pulls/112.
2017-03-07 17:49:42 -06:00
William Hubbs
4a269674b7 make sure netmount and localmount start after root 2017-02-28 17:44:06 -06:00
William Hubbs
eea4decdd1 net-online: typo fix 2017-02-26 19:09:56 -06:00
William Hubbs
d4d0f25a48 net-online: updates to make the service more usable
- switch from attempting to ping the default gateway to a host outside
the local network, defaulting to google.com.
- along with this, change the name of the variable that requests a ping
test to include_ping_test so the meaning is more clear.
2017-02-26 13:51:50 -06:00
Doug Freed
d5c3b85e3f loopback: drop explicit route for BSD too 2016-12-21 18:00:02 +00:00
William Hubbs
abe552b969 modules: get rid of printing each module on Linux
Now that we respect the module blacklists, don't print every module we
try to load, because it might not end up loaded due to the blacklist,
and modprobe doesn't consider that a failure.
2016-12-17 19:21:13 -06:00
Doug Freed
72c0824961 localmount: add comment about types variable 2016-12-17 18:39:53 +00:00
Alan Somers
5b7e3490ef Localmount shouldn't mount remote filesystems
The /etc/init.d/localmount script has a syntax error that causes it to
attempt to mount remote filesystems, causing the boot to fail. The
script appends a "no" to each remote filesystem type, but it should only
be append the "no" to the beginning of the list.  This patch fixes
localmount on FreeBSD 12.0.  A review of the mount(8) manpage on Ubuntu
12.04 suggests that this patch is correct for Linux, too.
2016-12-17 13:35:58 -05:00
William Hubbs
e0ac661419 split tmpfiles processing into opentmpfiles
The openntmpfiles package is designed so that it can be used on systems
independently of whether openrc is used.
2016-12-01 12:04:54 -06:00
William Hubbs
4f9bd7e4db init.d/loopback.in: drop the route to the loopback interface on Linux
This is related to #103.
2016-11-03 12:47:01 -05:00
William Hubbs
bf539f2196 init.d/mount-ro: do not remount /usr read only if it is premounted
X-Gentoo-Bug: 573760
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=573760
2016-11-03 12:29:21 -05:00
William Hubbs
f53c8baef3 init.d/net-online: remove interfaces and timeout from local declarations
X-Gentoo-Bug:  598621
X-Gentoo-Bug-URL:  https://bugs.gentoo.org/show_bug.cgi?id=598621
2016-11-03 11:18:20 -05:00
Robin H. Johnson
003657c973 init.d/loopback: drop scope on loopback
Busybox does not support the 'scope' argument on 'ip address add' or 'ip
route add', this is documented in BUSYBOX.md, but is no longer actually
needed, as the kernel does get it right without manual specification,
and the ifconfig variant already relies on the kernel to get it right.
This is part of #103.

X-Gentoo-Bug: 487208
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=487208
2016-10-25 10:49:14 -05:00
William Hubbs
deaae7ab5c init.d/sysfs: load efivarfs module when booting in efi mode:1
The presence of /sys/firmware/efi is used to indicate that the system
was booted in efi mode.
2016-10-05 22:48:17 -05:00
William Hubbs
3d2c2f0b87 init.d/sysfs: fix efivarfs module test 2016-10-04 18:18:17 -05:00
William Hubbs
6a0c033a64 init.d/sysfs: fix efivarfs handling
Separate loading the module, if it isn't built in or loaded, from
mounting the file system.

This also makes sure the warning about configuring the module in
/etc/conf.d/modules or building it in is displayed only if it is loaded
successfully.

X-Gentoo-Bug: 595836
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=595836
2016-10-04 12:06:58 -05:00
Doug Freed
61882821e0 init.d: Clean up some bad ewarn output 2016-09-28 15:00:40 -04:00
William Hubbs
0a76627345 init.d/swap: remove the case for linux
I am removing the separate case for Linux, because we are droppping the
"-e" switch.
2016-09-23 14:17:14 -05:00
William Hubbs
bf73363f22 Add --use-blacklist to modprobe calls in modules and modules-load
This means that we will honor the modprobe black lists.

X-Gentoo-Bug: 594012
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=594012
2016-09-20 13:15:39 -05:00
William Hubbs
b02ff466fa savecache: stop saving the dependency tree
This fixes #85.
2016-09-12 12:58:31 -05:00
William Hubbs
6bd0f2d096 init.d/procfs: typo fix 2016-09-12 12:58:01 -05:00
William Hubbs
841b883825 hwclock: fix module load warning 2016-09-08 13:36:13 -05:00
William Hubbs
ba10793b0b init.d/procfs: fix binfmt_misc module load warning
This reworks the logic so that the warning about configuring the
binfmt_misc module is only displayed if the module actually has to be
loaded.
2016-09-08 11:53:20 -05:00
William Hubbs
d5db5489be init.d/swap: do not unmount all tmpfs file systems
X-Gentoo-Bug: 568162
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=568162
2016-09-05 13:39:51 -05:00
William Hubbs
d06db93d59 remove swapfiles service
The swapfiles service was basically a copy of the swap service, so this
commit consolidates the functionality into the swap service.

X-Funtoo-Bug-URL: https://bugs.funtoo.org/browse/FL-2523
X-Gentoo-Bug: 568162
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=568162
2016-09-05 13:39:51 -05:00
Martin Väth
8c14d0c476 Fix typo in RC_UNAME check of modules-load
The $RC_UNAME "Linux" had been misspelled as "linux".
As a consequence, entries in e.g. /etc/modules-load.d failed to
load any module succesfully under Linux(!)
2016-08-30 19:47:13 +02:00
Doug Freed
c289774b00 modules-load: handle comments better
This handles comments without a trailing space after the comment
character.

Reported-By: josef64
2016-08-26 15:23:54 -04:00
William Hubbs
686e172207 init.d: add modules-load to ignore patterns 2016-08-25 17:04:06 -05:00
William Hubbs
fef6268f8d modules-load.d: cleanups
Move list of directories to a local variable and create the fn variable
to use for an individual file name rather than using path.
2016-08-25 16:12:33 -05:00
William Hubbs
556dbff99d Add modules-load.d support 2016-08-25 12:08:44 -05:00
William Hubbs
4018dfc8de init.d/hostname: do not use localhost as a default hostname
This allows the operating system default hostname to be used if no
hostname is configured.
2016-08-24 13:43:11 -05:00
William Hubbs
353bb9bc9a init.d/hostname: add support for /etc/hostname 2016-08-23 13:22:19 -05:00
William Hubbs
73cdf10f1f Deprecate automatic loading of modules
In the hwclock, procfs and sysfs service scripts, we automatically
attempt to load the kernel modules we need before we take any action. We
shouldn't do this, because there are systems which do not use kernel
modules and do not have the kmod package installed.

With this change, we continue to load the modules ourselves, but we warn
the admin that they need to be added to /etc/conf.d/modules or built
into the kernel.

In the future, this automatic loading will be dropped.

X-Gentoo-Bug: 342313
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=342313
2016-08-19 11:08:27 -05:00
William Hubbs
cae3976ef1 init.d: Add runsvdir to ignore patterns 2016-07-31 14:02:30 -05:00
William Hubbs
da28a3d367 init.d: initial service adjustments for docker support
Add -docker keyword to the same scripts that have -lxc keyword.
2016-07-31 13:01:17 -05:00
William Hubbs
f62253b833 Add support for runit
X-Gentoo-Bug: 501364
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=501364
2016-07-27 16:26:26 -05:00
William Hubbs
f2c2e2dd5a init.d/sysctl.in: typo fix 2016-07-27 14:09:24 -05:00
William Hubbs
b19d0a40d7 init.d/loopback: remove unnecessary stop function 2016-07-26 11:14:50 -05:00
William Hubbs
daf9397764 init.d: combine sysctl scripts
We had separate sysctl scripts for each operating system. However, there
is no need to do this since we can detect the operating system at
runtime with $RC_UNAME.
2016-07-19 16:21:48 -05:00
William Hubbs
314ae3dc78 modules: add support for FreeBSD
This is based on a patch submitted by
Joe Maloney <pkgdemonteam@gmail.com>.

This fixes #91.
2016-07-18 17:09:41 -05:00
William Hubbs
ac8ad169ae hwclock: always use --noadjfile if available
When we use the --utc or --localtime switch, also use --noadjfile if it
is available. This means hwclock will not use a drift file.

X-Gentoo-Bug: 584722
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=584722
2016-07-06 10:40:31 -05:00
William Hubbs
92e2f2c7cc killprocs: remove calls to sleep
X-Gentoo-Bug: 487084
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=487084
2016-05-05 17:02:39 -05:00
William Hubbs
fd80b6fc67 localmount/netmount: clean up critical mount processing
Fix a typo and do not fail if a path in critical_mounts is not listed as
a critical mount does not get mounted.
2016-04-26 12:43:50 -05:00
William Hubbs
5d130cc45c localmount/netmount: allow mount points to be marked critical
In previous releases, we either treated no mount points as critical or
all of them.

Now both localmount and netmount support a critical_mounts setting. If
mount points listed in this setting fail to mount, localmount and
netmount will fail.
2016-04-25 12:04:34 -05:00
William Hubbs
1c3c2cf6d8 netmount: fix mounting on Linux
Before this commit, on Linux, we were always trying to mount file
systems marked with _netdev, even when the previous mount command
failed. Now, we do not run the second mount if the first fails.

X-Gentoo-Bug: 579876
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=579876
2016-04-15 11:30:44 -05:00
Mike Frysinger
2c1f6a16e1 sysfs: mount pstore when available 2016-02-09 15:39:43 -06:00
William Hubbs
e52b5f59c2 savecache: stop saving nettree
Netifrc is no longer part of OpenRC, so we shouldn't save its dep tree
as part of savecache.

This should have been removed when netifrc was split out. also, it
might be related to the following bug.

X-Gentoo-Bug: 563720
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=563720
2016-01-28 17:06:25 -06:00
William Hubbs
e277ae57ef fix tests
X-Gentoo-Bug: 572602
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=572602
2016-01-22 12:07:13 -06:00
William Hubbs
cd7883d25d localmount: Allow users to control whether errors are ignored
X-Gentoo-Bug: 572138
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=572138
2016-01-19 13:34:04 -06:00
joe9
9473ac514c allow the user to decide whether fsck aborts for errors
X-Gentoo-Bug: 564008
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=564008
2016-01-13 10:52:22 -06:00
William Hubbs
5d3e85bc31 add ignore patterns for init.d directory 2016-01-01 09:19:49 -06:00
William Hubbs
000503fad7 Convert OpenRC to a centralized copyright/license structure
In the past, OpenRC was a hybrid of a centralized and file-scope
license/copyright structure.

I followed the instructions from the Software Freedom Law Center [1] to
convert to a Centralized structure where possible, for easier future
maintenance.

[1] https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
2015-12-21 12:16:06 -06:00
Rick Farina (Zero_Chaos)
c45313dfa9 netmount: use want dependency to start nfsclient
add in parsing of fstab to determine if nfsclient should be automatically
started so that netmount can mount nfs without adding nfsclient
to the default runlevel

This fixes #71.
2015-12-11 13:56:03 -06:00
William Hubbs
4cf6b0ecf7 consolefont: add after modules to dependencies
X-Gentoo-Bug: 559540
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=559540
2015-10-29 11:27:27 -05:00
William Hubbs
ee944553a9 bootmisc: optionally save the previous dmesg log
X-Gentoo-Bug: 561204
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=561204
2015-10-21 14:04:28 -05:00
William Hubbs
960881fcfe Add net-online service 2015-10-20 12:13:47 -05:00
William Hubbs
d26013494d mtab: typo fix 2015-10-14 17:48:32 -05:00
William Hubbs
b29b2fb3cb mtab: make /etc/mtab as a file configurable 2015-10-14 12:19:13 -05:00
William Hubbs
9d53d436ae sysfs: consolidate cgroup processing code in a single function 2015-10-13 15:07:53 -05:00
William Hubbs
d5116cc697 localmount: white space cleanup 2015-10-08 13:20:14 -05:00
Ian Stakenvicius
b86d170037 localmount: clean up handling of aufs branches
X-Gentoo-Bug: 560008
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=560008
2015-10-08 12:49:09 -05:00
William Hubbs
6fa0d6318b mtab: fix update logic
This advises users to remove mtab from their runlevels if /etc/mtab is a
symlink, and it creates the symlink if /etc/mtab does not exist on a
system.

X-Gentoo-Bug: 560060
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=560060
2015-10-07 11:35:31 -05:00
William Hubbs
17ef205bc6 sysfs: use printf instead of echo to write to cgroup files
This is needed for compatibility with musl and printf is also posix.

X-Gentoo-Bug: 562334
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=562334
2015-10-06 13:31:43 -05:00