[systemd-devel] [PATCH] vconsole-setup: pass when uml is detected

Ramkumar Ramachandra artagnon at gmail.com
Sat Jul 20 10:35:50 PDT 2013


User-Mode Linux does not do VT102 emulation, and

  $ systemd-vconsole-setup /dev/tty0

will always fail on it.  In order to prevent vconsole-setup.service from
always failing, write an exception for it in vconsole-setup.c.  Now,
vconsole-setup.service will pass on um Linux, and the logs will indicate
that /dev/tty0 is not a virtual console.

Cc: Kay Sievers <kay at vrfy.org>
Cc: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Cc: Lennart Poettering <lennart at poettering.net>
Signed-off-by: Ramkumar Ramachandra <artagnon at gmail.com>
---
 I didn't cut corners: I built it with abs, and tested it properly :)

 Kay: You like this?

 src/vconsole/vconsole-setup.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 1bbf737..bffc632 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -224,6 +224,7 @@ int main(int argc, char **argv) {
         pid_t font_pid = 0, keymap_pid = 0;
         bool font_copy = false;
         int r = EXIT_FAILURE;
+        const char *id = NULL;
 
         log_set_target(LOG_TARGET_AUTO);
         log_parse_environment();
@@ -245,6 +246,10 @@ int main(int argc, char **argv) {
         }
 
         if (!is_vconsole(fd)) {
+                /* uml does not do VT102 emulation */
+                if (detect_vm(&id) > 0 && !strcmp(id, "uml"))
+                        r = EXIT_SUCCESS;
+
                 log_error("Device %s is not a virtual console.", vc);
                 goto finish;
         }
-- 
1.8.3.3.820.ge3d4493.dirty



More information about the systemd-devel mailing list