mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
core,vconsole-setup: treat locking failure as non-fatal
Locking of the tty device and then /dev/console was added to synchronize vconsole-setup with other writers to the console. But it turns out that often the locking doesn't work and we carved out various cases where we ignore failure: - lack of permissions (in the user manager) - missing device node It turns out that there's at least one more failure mode: we get -EIO when the console is (mis-)configured to point to an invalid device. E.g. in rhbug#2273069 the reporter has a VM in Proxmox without a virtual console configured and has 'console=tty console=ttyS0' on the kernel cmdline. I couldn't reproduce this under libvirt, but failure with EIO has been reported by at least four users in #30501. Note that in systemd-vconsole-setup we report this is a hard failure, while in the manager, we only do a debug line. So it's possible that the failure also occured there, causing the rest of the setup of the tty to be skipped without further notice. Ignore the locking failure, since there's just too many ways it can fail. If we proceed without a lock, we're back to the situation before we started locking, which wasn't too bad. OTOH, skipping setup of the console is problematic for users, and it seems better to try to do the setup without locking. Fixes https://github.com/systemd/systemd/issues/30501, https://bugzilla.redhat.com/show_bug.cgi?id=2273069.
This commit is contained in:
parent
9e262ef92e
commit
e9bdbb6bbc
@ -162,11 +162,11 @@ void exec_context_tty_reset(const ExecContext *context, const ExecParameters *p)
|
||||
* that will be closed automatically, and operate on it for convenience. */
|
||||
lock_fd = lock_dev_console();
|
||||
if (ERRNO_IS_NEG_PRIVILEGE(lock_fd))
|
||||
log_debug_errno(lock_fd, "No privileges to lock /dev/console, proceeding without: %m");
|
||||
log_debug_errno(lock_fd, "No privileges to lock /dev/console, proceeding without lock: %m");
|
||||
else if (ERRNO_IS_NEG_DEVICE_ABSENT(lock_fd))
|
||||
log_debug_errno(lock_fd, "Device /dev/console does not exist, proceeding without locking it: %m");
|
||||
log_debug_errno(lock_fd, "Device /dev/console does not exist, proceeding without lock: %m");
|
||||
else if (lock_fd < 0)
|
||||
return (void) log_debug_errno(lock_fd, "Failed to lock /dev/console: %m");
|
||||
log_warning_errno(lock_fd, "Failed to lock /dev/console, proceeding without lock: %m");
|
||||
|
||||
if (context->tty_vhangup)
|
||||
(void) terminal_vhangup_fd(fd);
|
||||
|
@ -650,9 +650,9 @@ static int run(int argc, char **argv) {
|
||||
* performed for services with TTYVHangup=yes. */
|
||||
lock_fd = lock_dev_console();
|
||||
if (ERRNO_IS_NEG_DEVICE_ABSENT(lock_fd))
|
||||
log_debug_errno(lock_fd, "Device /dev/console does not exist, proceeding without locking it: %m");
|
||||
log_debug_errno(lock_fd, "Device /dev/console does not exist, proceeding without lock: %m");
|
||||
else if (lock_fd < 0)
|
||||
return log_error_errno(lock_fd, "Failed to lock /dev/console: %m");
|
||||
log_warning_errno(lock_fd, "Failed to lock /dev/console, proceeding without lock: %m");
|
||||
|
||||
(void) toggle_utf8_vc(vc, fd, utf8);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user