summaryrefslogtreecommitdiffstats
path: root/src/vconsole
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-05-14 20:00:48 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2024-05-14 23:22:41 +0200
commite9bdbb6bbcd4725171ca1fd0bb4fff83e5338acf (patch)
tree1e72c15f5691310272e2654484fbf6ba8534d347 /src/vconsole
parenttest: Enable TEST-54-CREDS on mkosi (diff)
downloadsystemd-e9bdbb6bbcd4725171ca1fd0bb4fff83e5338acf.tar.xz
systemd-e9bdbb6bbcd4725171ca1fd0bb4fff83e5338acf.zip
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.
Diffstat (limited to 'src/vconsole')
-rw-r--r--src/vconsole/vconsole-setup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index e0b1621461..ba742dda69 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -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);