Merge pull request #27703 from keszybz/systemd-vconsole-ordering
Order systemd-vconsole-setup before getty units
This commit is contained in:
@@ -70,8 +70,12 @@
|
|||||||
|
|
||||||
<listitem><para>Units whose standard output or error output is connected to <option>journal</option> or
|
<listitem><para>Units whose standard output or error output is connected to <option>journal</option> or
|
||||||
<option>kmsg</option> (or their combinations with console output, see below) automatically acquire
|
<option>kmsg</option> (or their combinations with console output, see below) automatically acquire
|
||||||
dependencies of type <varname>After=</varname> on
|
dependencies of type <varname>After=</varname> on <filename>systemd-journald.socket</filename>.
|
||||||
<filename>systemd-journald.socket</filename>.</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
|
<listitem><para>Units using the terminal (standard input, output, or error are connected to a terminal
|
||||||
|
or <varname>TTYPath=</varname> is used) automatically acquire an <varname>After=</varname> dependency
|
||||||
|
on <filename>systemd-vconsole-setup.service</filename>.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Units using <varname>LogNamespace=</varname> will automatically gain ordering and
|
<listitem><para>Units using <varname>LogNamespace=</varname> will automatically gain ordering and
|
||||||
requirement dependencies on the two socket units associated with
|
requirement dependencies on the two socket units associated with
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
# Each vtcon keeps its own state of fonts.
|
# Each vtcon keeps its own state of fonts.
|
||||||
#
|
#
|
||||||
ACTION=="add", SUBSYSTEM=="vtconsole", KERNEL=="vtcon*", RUN+="{{ROOTLIBEXECDIR}}/systemd-vconsole-setup"
|
ACTION=="add", SUBSYSTEM=="vtconsole", KERNEL=="vtcon*", RUN+="{{SYSTEMCTL_BINARY_PATH}} --no-block restart systemd-vconsole-setup.service"
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
#define SPECIAL_QUOTACHECK_SERVICE "systemd-quotacheck.service"
|
#define SPECIAL_QUOTACHECK_SERVICE "systemd-quotacheck.service"
|
||||||
#define SPECIAL_QUOTAON_SERVICE "quotaon.service"
|
#define SPECIAL_QUOTAON_SERVICE "quotaon.service"
|
||||||
#define SPECIAL_REMOUNT_FS_SERVICE "systemd-remount-fs.service"
|
#define SPECIAL_REMOUNT_FS_SERVICE "systemd-remount-fs.service"
|
||||||
|
#define SPECIAL_VCONSOLE_SETUP_SERVICE "systemd-vconsole-setup.service"
|
||||||
#define SPECIAL_VOLATILE_ROOT_SERVICE "systemd-volatile-root.service"
|
#define SPECIAL_VOLATILE_ROOT_SERVICE "systemd-volatile-root.service"
|
||||||
#define SPECIAL_UDEVD_SERVICE "systemd-udevd.service"
|
#define SPECIAL_UDEVD_SERVICE "systemd-udevd.service"
|
||||||
#define SPECIAL_GROWFS_SERVICE "systemd-growfs@.service"
|
#define SPECIAL_GROWFS_SERVICE "systemd-growfs@.service"
|
||||||
|
|||||||
@@ -6870,6 +6870,16 @@ bool exec_context_has_encrypted_credentials(ExecContext *c) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int exec_context_add_default_dependencies(Unit *u, const ExecContext *c) {
|
||||||
|
assert(u);
|
||||||
|
assert(u->default_dependencies);
|
||||||
|
|
||||||
|
if (c && exec_context_needs_term(c))
|
||||||
|
return unit_add_dependency_by_name(u, UNIT_AFTER, SPECIAL_VCONSOLE_SETUP_SERVICE,
|
||||||
|
/* add_reference= */ true, UNIT_DEPENDENCY_DEFAULT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void exec_status_start(ExecStatus *s, pid_t pid) {
|
void exec_status_start(ExecStatus *s, pid_t pid) {
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
||||||
|
|||||||
@@ -486,6 +486,7 @@ void exec_context_revert_tty(ExecContext *c);
|
|||||||
|
|
||||||
int exec_context_get_clean_directories(ExecContext *c, char **prefix, ExecCleanMask mask, char ***ret);
|
int exec_context_get_clean_directories(ExecContext *c, char **prefix, ExecCleanMask mask, char ***ret);
|
||||||
int exec_context_get_clean_mask(ExecContext *c, ExecCleanMask *ret);
|
int exec_context_get_clean_mask(ExecContext *c, ExecCleanMask *ret);
|
||||||
|
int exec_context_add_default_dependencies(Unit *u, const ExecContext *c);
|
||||||
|
|
||||||
void exec_status_start(ExecStatus *s, pid_t pid);
|
void exec_status_start(ExecStatus *s, pid_t pid);
|
||||||
void exec_status_exit(ExecStatus *s, const ExecContext *context, pid_t pid, int code, int status);
|
void exec_status_exit(ExecStatus *s, const ExecContext *context, pid_t pid, int code, int status);
|
||||||
|
|||||||
+1
-1
@@ -575,7 +575,7 @@ static int mount_add_default_dependencies(Mount *m) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return exec_context_add_default_dependencies(UNIT(m), &m->exec_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mount_verify(Mount *m) {
|
static int mount_verify(Mount *m) {
|
||||||
|
|||||||
+6
-1
@@ -740,7 +740,12 @@ static int service_add_default_dependencies(Service *s) {
|
|||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* Third, add us in for normal shutdown. */
|
/* Third, add us in for normal shutdown. */
|
||||||
return unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
|
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
/* Fourth, add generic dependencies */
|
||||||
|
return exec_context_add_default_dependencies(UNIT(s), &s->exec_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void service_fix_stdio(Service *s) {
|
static void service_fix_stdio(Service *s) {
|
||||||
|
|||||||
+5
-1
@@ -276,7 +276,11 @@ static int socket_add_default_dependencies(Socket *s) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
|
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
return exec_context_add_default_dependencies(UNIT(s), &s->exec_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
_pure_ static bool socket_has_exec(Socket *s) {
|
_pure_ static bool socket_has_exec(Socket *s) {
|
||||||
|
|||||||
+5
-1
@@ -270,7 +270,11 @@ static int swap_add_default_dependencies(Swap *s) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
return unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
|
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
return exec_context_add_default_dependencies(UNIT(s), &s->exec_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int swap_verify(Swap *s) {
|
static int swap_verify(Swap *s) {
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ typedef struct Context {
|
|||||||
} Context;
|
} Context;
|
||||||
|
|
||||||
static const char * const vc_meta_names[_VC_META_MAX] = {
|
static const char * const vc_meta_names[_VC_META_MAX] = {
|
||||||
[VC_KEYMAP] = "vconsole.keymap",
|
[VC_KEYMAP] = "vconsole.keymap",
|
||||||
[VC_KEYMAP_TOGGLE] = "vconsole.keymap_toggle",
|
[VC_KEYMAP_TOGGLE] = "vconsole.keymap_toggle",
|
||||||
[VC_FONT] = "vconsole.font",
|
[VC_FONT] = "vconsole.font",
|
||||||
[VC_FONT_MAP] = "vconsole.font_map",
|
[VC_FONT_MAP] = "vconsole.font_map",
|
||||||
[VC_FONT_UNIMAP] = "vconsole.font_unimap",
|
[VC_FONT_UNIMAP] = "vconsole.font_unimap",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* compatibility with obsolete multiple-dot scheme */
|
/* compatibility with obsolete multiple-dot scheme */
|
||||||
@@ -380,17 +380,12 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) {
|
|||||||
struct unimapdesc unimapd;
|
struct unimapdesc unimapd;
|
||||||
_cleanup_free_ struct unipair* unipairs = NULL;
|
_cleanup_free_ struct unipair* unipairs = NULL;
|
||||||
_cleanup_free_ void *fontbuf = NULL;
|
_cleanup_free_ void *fontbuf = NULL;
|
||||||
unsigned i;
|
int log_level = LOG_WARNING;
|
||||||
int log_level;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
unipairs = new(struct unipair, USHRT_MAX);
|
unipairs = new(struct unipair, USHRT_MAX);
|
||||||
if (!unipairs) {
|
if (!unipairs)
|
||||||
log_oom();
|
return (void) log_oom();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_level = LOG_WARNING;
|
|
||||||
|
|
||||||
/* get metadata of the current font (width, height, count) */
|
/* get metadata of the current font (width, height, count) */
|
||||||
r = ioctl(src_fd, KDFONTOP, &cfo);
|
r = ioctl(src_fd, KDFONTOP, &cfo);
|
||||||
@@ -440,7 +435,7 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) {
|
|||||||
if (cfo.op != KD_FONT_OP_SET)
|
if (cfo.op != KD_FONT_OP_SET)
|
||||||
log_full(log_level, "Fonts will not be copied to remaining consoles");
|
log_full(log_level, "Fonts will not be copied to remaining consoles");
|
||||||
|
|
||||||
for (i = 1; i <= 63; i++) {
|
for (unsigned i = 1; i <= 63; i++) {
|
||||||
char ttyname[sizeof("/dev/tty63")];
|
char ttyname[sizeof("/dev/tty63")];
|
||||||
_cleanup_close_ int fd_d = -EBADF;
|
_cleanup_close_ int fd_d = -EBADF;
|
||||||
|
|
||||||
@@ -484,10 +479,8 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Copy unicode translation table unimapd is a ushort count and a pointer
|
||||||
* copy unicode translation table unimapd is a ushort count and a pointer
|
* to an array of struct unipair { ushort, ushort }. */
|
||||||
* to an array of struct unipair { ushort, ushort }
|
|
||||||
*/
|
|
||||||
r = ioctl(fd_d, PIO_UNIMAPCLR, &adv);
|
r = ioctl(fd_d, PIO_UNIMAPCLR, &adv);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_warning_errno(errno, "PIO_UNIMAPCLR failed, unimaps might be incorrect for tty%u: %m", i);
|
log_warning_errno(errno, "PIO_UNIMAPCLR failed, unimaps might be incorrect for tty%u: %m", i);
|
||||||
@@ -505,15 +498,13 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int find_source_vc(char **ret_path, unsigned *ret_idx) {
|
static int find_source_vc(char **ret_path, unsigned *ret_idx) {
|
||||||
_cleanup_free_ char *path = NULL;
|
|
||||||
int r, err = 0;
|
int r, err = 0;
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
path = new(char, sizeof("/dev/tty63"));
|
_cleanup_free_ char *path = new(char, sizeof("/dev/tty63"));
|
||||||
if (!path)
|
if (!path)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
for (i = 1; i <= 63; i++) {
|
for (unsigned i = 1; i <= 63; i++) {
|
||||||
_cleanup_close_ int fd = -EBADF;
|
_cleanup_close_ int fd = -EBADF;
|
||||||
|
|
||||||
r = verify_vc_allocation(i);
|
r = verify_vc_allocation(i);
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Console Getty
|
Description=Console Getty
|
||||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||||
After=systemd-user-sessions.service plymouth-quit-wait.service
|
After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
|
||||||
{% if HAVE_SYSV_COMPAT %}
|
{% if HAVE_SYSV_COMPAT %}
|
||||||
After=rc-local.service getty-pre.target
|
After=rc-local.service
|
||||||
{% endif %}
|
{% endif %}
|
||||||
Before=getty.target
|
Before=getty.target
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
Description=Container Getty on /dev/pts/%I
|
Description=Container Getty on /dev/pts/%I
|
||||||
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
Documentation=man:agetty(8) man:systemd-getty-generator(8)
|
||||||
Documentation=man:machinectl(1)
|
Documentation=man:machinectl(1)
|
||||||
After=systemd-user-sessions.service plymouth-quit-wait.service
|
After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
|
||||||
{% if HAVE_SYSV_COMPAT %}
|
{% if HAVE_SYSV_COMPAT %}
|
||||||
After=rc-local.service getty-pre.target
|
After=rc-local.service
|
||||||
{% endif %}
|
{% endif %}
|
||||||
Before=getty.target
|
Before=getty.target
|
||||||
IgnoreOnIsolate=yes
|
IgnoreOnIsolate=yes
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Documentation=man:systemd-debug-generator(8)
|
|||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
IgnoreOnIsolate=yes
|
IgnoreOnIsolate=yes
|
||||||
ConditionPathExists={{DEBUGTTY}}
|
ConditionPathExists={{DEBUGTTY}}
|
||||||
|
After=systemd-vconsole-setup.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment=TERM=linux
|
Environment=TERM=linux
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
Description=Setup Virtual Console
|
Description=Setup Virtual Console
|
||||||
Documentation=man:systemd-vconsole-setup.service(8) man:vconsole.conf(5)
|
Documentation=man:systemd-vconsole-setup.service(8) man:vconsole.conf(5)
|
||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
|
Before=sysinit.target
|
||||||
Before=initrd-switch-root.target shutdown.target
|
Before=initrd-switch-root.target shutdown.target
|
||||||
ConditionPathExists=/dev/tty0
|
ConditionPathExists=/dev/tty0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user