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
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(!)
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
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.
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
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.
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
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
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
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.
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
The following return codes are returned by mount -a:
0: all file systems mounted.
32: no file systems mounted.
64: some file systems mounted.
The localmount/netmount services should fail if all file systems that
should mount did not mount.
This adds the -systemd-nspawn keyword to service scripts which are not
intended to run in systemd-nspawn containers.
This fixes#52.
X-Gentoo-Bug: 548058
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=548058
This changes the mtab service in the following way:
- If /etc/mtab is a symbolic link, success is returned.
- If /etc is not writable, we warn that we could not update /etc/mtab
and return success.
- If /etc/mtab does not exist, we create a symbolic link from
/etc/mtab to /proc/self/mounts.
- Otherwise, we warn that updating /etc/mtab as a file is
deprecated and continue to update it after outputting instructions to
the user for how to move it to a symbolic link.
The cache directory should be created via mkdir -p instead of
mkdir. This makes sure all parent directories are created.
Also, we now display an error message explaining that we were unable to
create the cache directory if creation fails.
We were originally checking to see if $RC_LIBEXECDIR/cache was writable. For
a new install, this check will fail since this path does not exist. This
is also incorrect because later we create $RC_LIBEXECDIR/cache.
The correct check is checkpath -W $RC_LIBEXECDIR, and this fixes the
issue.
X-Gentoo-Bug: 544632
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=544632
This makes binfmt processing behave like tmpfiles processing which
follows the same specification as systemd.
This fixes#48.
X-Gentoo-Bug: 545162
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=545162
It appears that the only reason we were force loading the usbcore
module was to facilitate mounting usbfs. Since we no longer mount
usbfs, this is no longer necessary.
X-Gentoo-Bug: 480312
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=480312
The usbfs and usbdevfs file systems have been deprecated since
Linux-2.6.32, so we remove the code to automount them.
X-Gentoo-Bug: 480312
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=480312
The selinux file system is mounted under /sys, so move the code for it
to the appropriate service.
X-Gentoo-Bug: 546290
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=546290
The local service should use eval when it executes scripts since it has
the redirection set up in a variable.
This fixes#50.
X-Gentoo-Bug: 545012
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=545012
checkpath -W can fail if the specified path doesn't actually exist yet.
In this case savecache script should attempt to create the path if it is
missing, however it is pre-empted by the checkpath call. This patch adds
an explicit existence test before executing checkpath.
This fixes#36.
If /tmp or / are read-only, the clean_run function can fail in some very
bad ways.
1. dir=$(mktemp -d) returns an EMPTY string on error.
2. "mount -o bind / $dir", and don't check the result of that,
3. "rm -rf $dir/run/*", which removes the REAL /run contents
4. box gets very weird from this point forward
Signed-Off-By: Robin H. Johnson <robbat2@gentoo.org>
Signed-Off-By: Chip Parker <infowolfe@gmail.com>
Reported-by: Chip Parker <infowolfe@gmail.com>
Tested-by: Chip Parker <infowolfe@gmail.com>
The local service now redirects stdout and stderr for the scripts it
runs to /dev/null unless it is run in verbose mode.
X-Gentoo-Bug: 537444
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=537444
sysfs now mounts all related sysfs file systems and returns success,
like netmount and localmount.
Also, we now check to make sure the cgroups are not mounted before we
mount them.
X-Gentoo-Bug: 530138
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=530138
Fix gentoo bug #427996 correctly.
We should attempt to mount the file systems, but not try to start the
daemons. The previous fix removed mounting the file systems as well as
starting the daemons.
X-Gentoo-Bug: 508574
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=508574
Originally, we aborted all of the cgroup setup if /sys/fs/cgroup/openrc
was already mounted. This caused an issue in lxc containers, so we
should always allow the subsystems to be mounted.
X-Gentoo-Bug: 520606
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=520606
According to the sysctl man page, the --system option causes sysctl to
process all system configuration files, which include the following:
/run/sysctl.d/*.conf
/etc/sysctl.d/*.conf
/usr/local/lib/sysctl.d/*.conf
/usr/lib/sysctl.d/*.conf
/lib/sysctl.d/*.conf
/etc/sysctl.conf
X-Gentoo-Bug: 484796
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=484796
- Rename the static_dev switch in conf.d/devfs to skip_mount_dev since
this is a better description of what the switch does.
- Clarify the error messages in the devfs service script based on the
new name of the switch.
The hwclock service should set the time zone regardless of the setting
of the clock_hctosys variable. This needs to be done to prevent issues
when the system time is being synchronized using ntp.
X-Gentoo-Bug: 434410
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434410
- remove the has_executables variable since it isn't used.
- Convert the conditional calls to ewend/vewend to a single call to veend.
- Always call eend after all scripts are executed passing the appropriate
error code.
Because of this change, you will see only an overall status when
starting or stopping local unless you are using verbose mode.
With this patch, the "local" service runscript will be verbose like the
"sysctl" service when 'rc_verbose="yes"' is set.
Example output successful start:
* Stopping local ...
* Executing "/etc/local.d/00will-stop.stop" ... [ ok ]
* Starting local ...
* Executing "/etc/local.d/00will-start.start" ... [ ok ]
* Executing "/etc/local.d/01 test.start" ... [ ok ]
Example output with failing executables:
* Stopping local ...
* Executing "/etc/local.d/00will-stop.stop" ... [ ok ]
* Executing "/etc/local.d/will-fail.stop" ...
mount: can't find foo in /etc/fstab
* Execution of "/etc/local.d/will-fail.stop" failed. [ !! ]
* Starting local ...
* Executing "/etc/local.d/00will-start.start" ... [ ok ]
* Executing "/etc/local.d/01 test.start" ... [ ok ]
* Executing "/etc/local.d/will-fail2.start" ...
mount: can't find bar in /etc/fstab
* Execution of "/etc/local.d/will-fail2.start" failed. [ !! ]
* Executing "/etc/local.d/will-fail.start" ...
mount: can't find foo in /etc/fstab
* Execution of "/etc/local.d/will-fail.start" failed. [ !! ]
X-Gentoo-Bug: 489274
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=489274
We were not checking to see if /sys/fs/cgroup/openrc was already mounted
before we mounted it. This fixes that issue.
Thanks to Robin Johnson <robbat2@gentoo.org> for pointing this out.
The SELinux filesystem has been moved to /sys/fs/selinux for quite some
time. We kept supporting /selinux for backwards compatibility, but it's
time to move forward on this.
X-Gentoo-Bug: 511718
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=511718
Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
The current code relies on the tmpfs mount defaulting to 1777
permissions. If it doesn't, things break badly.
This can come up when tmpfs is disabled in the kernel and ramfs
is being used instead (the kernel will alias tmpfs to ramfs).
The default permissions for ramfs is 0755.
All Linux systems need /dev to be set up,so add code to devfs to do
this. The process devfs follows is below.
1. If static_dev is yes, nothing is done.
2. if /dev is an entry in fstab it is mounted or remounted based on that
entry.
3. If /dev is not in fstab, it attempts to mount /dev as a devtmpfs or
tmpfs depending on which is defined in the kernel; devtmpfs is
preferred.
4. If neither devtmpfs nor tmpfs is defined, it assumes the user wants
static /dev and prints a warning.
X-Gentoo-Bug: 492694
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=492694
This was requested by Debian, because the minicom software, which is
available on Debian and other distros, has a binary named runscript. We
are keeping a backward compatibility symlink for now, but this allows
Debian or any other distro to safely remove the symlink.
X-Gentoo-Bug: 494220
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=494220
Bootmisc was running before the root file system was remounted rw in
some situations. This fixes that issue.
X-Gentoo-Bug: 493442
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=493442
The loopback interface is supposed to be handled by the loopback
service, but sys_interfaces includes it. This causes network to try to
start it and means that network provides net even if lo is the only
interface configured.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
The posix equivalent of the type command is "command -v", so now we use
that. Thanks to Jonathan Callen <jcallen@gentoo.org> for informing me
wrt the fix.
The localmount and mount-ro scripts were flushing pending disk writes by
calling sync twice in succession. This is no longer necessary; see the
bug report and blog post for reasons we were still doing this.
Reported-by: Patrick Lauer <patrick@gentoo.org>
X-Gentoo-Bug: 487382
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=487382
It has been determined that it will be best for gentoo's net.* scripts
to be in a separate package to allow independent development.
This package will be called netifrc and maintained by Gentoo.
In the 3.10 kernel, EFI variables are now provided by a dedicated
filesystem that needs to be mounted.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Free BSD's ifconfig outputs a netmask in the form 0xffffff00, which
was translating to 0xff.0xff.0xff.0x00,. Now we convert this to decimal
numbers before we convert it to cidr notation.
Reported-by: 4glitch@gmail.com
X-Gentoo-Bug: 460268
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=460268
SBINDIR and BINDIR can be set independently of PREFIX. This fixes
broken shebangs in service files when SBINDIR is set to something other
than PREFIX/sbin
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This makes binfmt.d consistent with tmpfiles.d and systemd which uses
hard coded paths for both.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Using setfont directly to save the font prevents breakage
when a distro stores consolefonts in a location other than
/usr/share/consolefonts such as Arch which stores them in
/usr/share/kbd/consolefonts
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
The loadkeys man page states that if you don't pass a filename loadkeys
will read from stdin. However, this is not correct, so we now pass "-"
as the filename to explicitly request stdin.
Reported-by: andi@grois.info
X-Gentoo-Bug: 457524
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=457524
We were telling users that setting shutdown_network=YES would shut down
the network interfaces during shutdown, but this was exactly the
opposite of what we were doing. The default was YES, which was keeping
the interfaces active.
This keeps the default behavior, but renames the setting to keep_network
which more accurately describes its function, and instructs users to set
it to NO if they want the network interfaces to go down.
This setting, already in use in newnet, allows the user to control
whether network interfaces are stopped when the system shuts down. By
default, under newnet, they are not, so I am making oldnet have the same
default.
A side-affect of this is that in the default configuration this fixes
bugs like the one below.
Reported-by: jerryfleming2006@gmail.com
X-Gentoo-Bug: 259183
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=259183
rkhunter thinks OpenRC is a rootkit because of the hidefirstrout
variable. This has been renamed to hideFirstroute in order to get past
rkhunter.
I realize this is not an openrc bug. In this case though I do not have a
problem renaming the variable.
Reported-by: ago@gentoo.org
X-Gentoo-Bug: 339714
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=339714
The /run directory is a mount point for a tmpfs and should not contain
any files or directories. This cleans out the /run/openrc
symlink and any other files which were incorrectly placed in /run.
Thanks to Ian Stakenvicius for pointing out this solution.