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 Note the relationship to the "vconsole.keymap" credential
188 understood by systemd-vconsole-setup.service(8): both ultimately
189 affect the same setting, but firstboot.keymap is written into
190 /etc/vconsole.conf on first boot (if not already configured), and
191 then read from there by systemd-vconsole-setup, while
192 vconsole.keymap is read on every boot, and is not persisted to disk
193 (but any configuration in vconsole.conf will take precedence if
194 present).
195
196 "firstboot.timezone"
197 This credential specifies the system timezone setting to set during
198 first boot, in place of prompting the user.
199
200 Note that by default the systemd-firstboot.service unit file is set up
201 to inherit the listed credentials from the service manager. Thus, when
202 invoking a container with an unpopulated /etc/ for the first time it is
203 possible to configure the root user's password to be "systemd" like
204 this:
205
206 # systemd-nspawn --image=... --set-credential=firstboot.locale:de_DE.UTF-8 ...
207
208 Note that these credentials are only read and applied during the first
209 boot process. Once they are applied they remain applied for subsequent
210 boots, and the credentials are not considered anymore.
211
213 On success, 0 is returned, a non-zero failure code otherwise.
214
216 systemd.firstboot=
217 Takes a boolean argument, defaults to on. If off,
218 systemd-firstboot.service won't interactively query the user for
219 basic settings at first boot, even if those settings are not
220 initialized yet.
221
223 systemd(1), locale.conf(5), vconsole.conf(5), localtime(5),
224 hostname(5), machine-id(5), shadow(5), systemd-machine-id-setup(1),
225 localectl(1), timedatectl(1), hostnamectl(1)
226
228 1. Discoverable Partitions Specification
229 https://uapi-group.org/specifications/specs/discoverable_partitions_specification
230
231
232
233systemd 253 SYSTEMD-FIRSTBOOT(1)