When set to 0 this will stop tools like the backlight and rfkill tools to
restore state from previous boot. This is useful in case the stored state
is bogus to the extent that it is preventing you from resetting it (e.g.,
the backlight settings cause the screen to be off on boot on a system where
the backlight can not be adjusted directly from the keyboard).
</listitem>
</varlistentry>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>systemd.restore_state=</varname></term>
+ <listitem>
+ <para>Parameter understood by
+ several system tools to control
+ whether or not they should restore
+ system state from the previous boot.
+ For details, see
+ <citerefentry><refentrytitle>systemd-backlight@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ and
+ <citerefentry><refentrytitle>systemd-rfkill@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><varname>quiet</varname></term>
<listitem>
<varlistentry>
<term><varname>quiet</varname></term>
<listitem>
<citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-modules-load.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
<citerefentry><refentrytitle>systemd-cryptsetup-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-modules-load.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd-backlight@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd-rfkill@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
<filename>/var/lib/systemd/backlight/</filename>.</para>
</refsect1>
<filename>/var/lib/systemd/backlight/</filename>.</para>
</refsect1>
+ <refsect1>
+ <title>Kernel Command Line</title>
+
+ <para><filename>systemd-backlight</filename> understands
+ the following kernel command line parameter:</para>
+
+ <variablelist class='kernel-commandline-options'>
+ <varlistentry>
+ <term><varname>systemd.restore_state=</varname></term>
+
+ <listitem><para>Takes a boolean
+ argument. Defaults to
+ <literal>1</literal>. If
+ <literal>0</literal>, does not restore
+ the backlight settings on boot. However,
+ settings will still be stored on shutdown.
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para>
<refsect1>
<title>See Also</title>
<para>
<filename>/var/lib/systemd/rfkill/</filename>.</para>
</refsect1>
<filename>/var/lib/systemd/rfkill/</filename>.</para>
</refsect1>
+ <refsect1>
+ <title>Kernel Command Line</title>
+
+ <para><filename>systemd-rfkill</filename> understands
+ the following kernel command line parameter:</para>
+
+ <variablelist class='kernel-commandline-options'>
+ <varlistentry>
+ <term><varname>systemd.restore_state=</varname></term>
+
+ <listitem><para>Takes a boolean
+ argument. Defaults to
+ <literal>1</literal>. If
+ <literal>0</literal>, does not restore
+ the rfkill settings on boot. However,
+ settings will still be stored on shutdown.
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
<refsect1>
<title>See Also</title>
<para>
<refsect1>
<title>See Also</title>
<para>
#include "fileio.h"
#include "libudev.h"
#include "udev-util.h"
#include "fileio.h"
#include "libudev.h"
#include "udev-util.h"
static struct udev_device *find_pci_or_platform_parent(struct udev_device *device) {
struct udev_device *parent;
static struct udev_device *find_pci_or_platform_parent(struct udev_device *device) {
struct udev_device *parent;
* device probing should be complete), so that the validity
* check at boot time doesn't have to be reliable. */
* device probing should be complete), so that the validity
* check at boot time doesn't have to be reliable. */
- if (streq(argv[1], "load")) {
+ if (streq(argv[1], "load") && restore_state()) {
_cleanup_free_ char *value = NULL;
if (!validate_device(udev, device))
_cleanup_free_ char *value = NULL;
if (!validate_device(udev, device))
#include "fileio.h"
#include "libudev.h"
#include "udev-util.h"
#include "fileio.h"
#include "libudev.h"
#include "udev-util.h"
int main(int argc, char *argv[]) {
_cleanup_udev_unref_ struct udev *udev = NULL;
int main(int argc, char *argv[]) {
_cleanup_udev_unref_ struct udev *udev = NULL;
- if (streq(argv[1], "load")) {
+ if (streq(argv[1], "load") && restore_state()) {
_cleanup_free_ char *value = NULL;
r = read_one_line_file(saved, &value);
_cleanup_free_ char *value = NULL;
r = read_one_line_file(saved, &value);
#include "device-nodes.h"
#include "utf8.h"
#include "gunicode.h"
#include "device-nodes.h"
#include "utf8.h"
#include "gunicode.h"
int saved_argc = 0;
char **saved_argv = NULL;
int saved_argc = 0;
char **saved_argv = NULL;
+
+bool restore_state(void) {
+ _cleanup_free_ char *line;
+ char *w, *state;
+ int r;
+ size_t l;
+
+ if (detect_container(NULL) > 0)
+ return true;
+
+ r = read_one_line_file("/proc/cmdline", &line);
+ if (r < 0) {
+ log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r));
+ return 0;
+ }
+
+ FOREACH_WORD_QUOTED(w, l, line, state)
+ if (strneq(w, "systemd.restore_state=0", l))
+ return false;
+
+ return true;
+}
int split_pair(const char *s, const char *sep, char **l, char **r);
int split_pair(const char *s, const char *sep, char **l, char **r);
+bool restore_state(void);
+
/**
* Normal qsort requires base to be nonnull. Here were require
* that only if nmemb > 0.
/**
* Normal qsort requires base to be nonnull. Here were require
* that only if nmemb > 0.