1SYSTEMD-FIRSTBOOT(1) systemd-firstboot SYSTEMD-FIRSTBOOT(1)
2
3
4
6 systemd-firstboot, systemd-firstboot.service - Initialize basic system
7 settings on or before the first boot-up of a system
8
10 systemd-firstboot [OPTIONS...]
11
12 systemd-firstboot.service
13
15 systemd-firstboot initializes the most basic system settings
16 interactively on the first boot, or optionally non-interactively when a
17 system image is created. The service is started if
18 ConditionFirstBoot=yes is satisfied. This essentially means that /etc/
19 is empty, see systemd.unit(5) for details.
20
21 The following settings may be set up:
22
23 • The system locale, more specifically the two locale variables LANG=
24 and LC_MESSAGES
25
26 • The system keyboard map
27
28 • The system time zone
29
30 • The system hostname
31
32 • The machine ID of the system
33
34 • The root user's password
35
36 Each of the fields may either be queried interactively by users, set
37 non-interactively on the tool's command line, or be copied from a host
38 system that is used to set up the system image.
39
40 If a setting is already initialized, it will not be overwritten and the
41 user will not be prompted for the setting.
42
43 Note that this tool operates directly on the file system and does not
44 involve any running system services, unlike localectl(1),
45 timedatectl(1) or hostnamectl(1). This allows systemd-firstboot to
46 operate on mounted but not booted disk images and in early boot. It is
47 not recommended to use systemd-firstboot on the running system while it
48 is up.
49
51 The following options are understood:
52
53 --root=root
54 Takes a directory path as an argument. All paths will be prefixed
55 with the given alternate root path, including config search paths.
56 This is useful to operate on a system image mounted to the
57 specified directory instead of the host system itself.
58
59 --image=path
60 Takes a path to a disk image file or block device node. If
61 specified all operations are applied to file system in the
62 indicated disk image. This is similar to --root= but operates on
63 file systems stored in disk images or block devices. The disk image
64 should either contain just a file system or a set of file systems
65 within a GPT partition table, following the Discoverable Partitions
66 Specification[1]. For further information on supported disk images,
67 see systemd-nspawn(1)'s switch of the same name.
68
69 --locale=LOCALE, --locale-messages=LOCALE
70 Sets the system locale, more specifically the LANG= and LC_MESSAGES
71 settings. The argument should be a valid locale identifier, such as
72 "de_DE.UTF-8". This controls the locale.conf(5) configuration file.
73
74 --keymap=KEYMAP
75 Sets the system keyboard layout. The argument should be a valid
76 keyboard map, such as "de-latin1". This controls the "KEYMAP" entry
77 in the vconsole.conf(5) configuration file.
78
79 --timezone=TIMEZONE
80 Sets the system time zone. The argument should be a valid time zone
81 identifier, such as "Europe/Berlin". This controls the localtime(5)
82 symlink.
83
84 --hostname=HOSTNAME
85 Sets the system hostname. The argument should be a hostname,
86 compatible with DNS. This controls the hostname(5) configuration
87 file.
88
89 --machine-id=ID
90 Sets the system's machine ID. This controls the machine-id(5) file.
91
92 --root-password=PASSWORD, --root-password-file=PATH,
93 --root-password-hashed=HASHED_PASSWORD
94 Sets the password of the system's root user. This creates/modifies
95 the passwd(5) and shadow(5) files. This setting exists in three
96 forms: --root-password= accepts the password to set directly on the
97 command line, --root-password-file= reads it from a file and
98 --root-password-hashed= accepts an already hashed password on the
99 command line. See shadow(5) for more information on the format of
100 the hashed password. Note that it is not recommended to specify
101 plaintext passwords on the command line, as other users might be
102 able to see them simply by invoking ps(1).
103
104 --root-shell=SHELL
105 Sets the shell of the system's root user. This creates/modifies the
106 passwd(5) file.
107
108 --kernel-command-line=CMDLINE
109 Sets the system's kernel command line. This controls the
110 /etc/kernel/cmdline file which is used by kernel-install(8).
111
112 --prompt-locale, --prompt-keymap, --prompt-timezone, --prompt-hostname,
113 --prompt-root-password, --prompt-root-shell
114 Prompt the user interactively for a specific basic setting. Note
115 that any explicit configuration settings specified on the command
116 line take precedence, and the user is not prompted for it.
117
118 --prompt
119 Query the user for locale, keymap, timezone, hostname, root's
120 password, and root's shell. This is equivalent to specifying
121 --prompt-locale, --prompt-keymap, --prompt-timezone,
122 --prompt-hostname, --prompt-root-password, --prompt-root-shell in
123 combination.
124
125 --copy-locale, --copy-keymap, --copy-timezone, --copy-root-password,
126 --copy-root-shell
127 Copy a specific basic setting from the host. This only works in
128 combination with --root= (see above).
129
130 --copy
131 Copy locale, keymap, time zone, root password and shell from the
132 host. This is equivalent to specifying --copy-locale,
133 --copy-keymap, --copy-timezone, --copy-root-password,
134 --copy-root-shell in combination.
135
136 --setup-machine-id
137 Initialize the system's machine ID to a random ID. This only works
138 in combination with --root=.
139
140 --force
141 systemd-firstboot doesn't modify existing files unless --force is
142 specified. For modifications to /etc/passwd and /etc/shadow,
143 systemd-firstboot only modifies the entry of the "root" user
144 instead of overwriting the entire file.
145
146 --delete-root-password
147 Removes the password of the system's root user, enabling login as
148 root without a password unless the root account is locked. Note
149 that this is extremely insecure and hence this option should not be
150 used lightly.
151
152 --welcome=
153 Takes a boolean argument. By default when prompting the user for
154 configuration options a brief welcome text is shown before the
155 first question is asked. Pass false to this option to turn off the
156 welcome text.
157
158 -h, --help
159 Print a short help text and exit.
160
161 --version
162 Print a short version string and exit.
163
165 systemd-firstboot supports the service credentials logic as implemented
166 by LoadCredential=/SetCredential= (see systemd.exec(1) for details).
167 The following credentials are used when passed in:
168
169 "passwd.hashed-password.root", "passwd.plaintext-password.root"
170 A hashed or plaintext version of the root password to use, in place
171 of prompting the user. These credentials are equivalent to the same
172 ones defined for the systemd-sysusers.service(8) service.
173
174 "passwd.shell.root"
175 Specifies the shell binary to use for the specified account.
176 Equivalent to the credential of the same name defined for the
177 systemd-sysusers.service(8) service.
178
179 "firstboot.locale", "firstboot.locale-messages"
180 These credentials specify the locale settings to set during first
181 boot, in place of prompting the user.
182
183 "firstboot.keymap"
184 This credential specifies the keyboard setting to set during first
185 boot, in place of prompting the user.
186
187 "firstboot.timezone"
188 This credential specifies the system timezone setting to set during
189 first boot, in place of prompting the user.
190
191 Note that by default the systemd-firstboot.service unit file is set up
192 to inherit the listed credentials from the service manager. Thus, when
193 invoking a container with an unpopulated /etc/ for the first time it is
194 possible to configure the root user's password to be "systemd" like
195 this:
196
197 # systemd-nspawn --image=... --set-credential=firstboot.locale:de_DE.UTF-8 ...
198
199 Note that these credentials are only read and applied during the first
200 boot process. Once they are applied they remain applied for subsequent
201 boots, and the credentials are not considered anymore.
202
204 On success, 0 is returned, a non-zero failure code otherwise.
205
207 systemd.firstboot=
208 Takes a boolean argument, defaults to on. If off,
209 systemd-firstboot.service won't interactively query the user for
210 basic settings at first boot, even if those settings are not
211 initialized yet.
212
214 systemd(1), locale.conf(5), vconsole.conf(5), localtime(5),
215 hostname(5), machine-id(5), shadow(5), systemd-machine-id-setup(1),
216 localectl(1), timedatectl(1), hostnamectl(1)
217
219 1. Discoverable Partitions Specification
220 https://systemd.io/DISCOVERABLE_PARTITIONS
221
222
223
224systemd 250 SYSTEMD-FIRSTBOOT(1)