[systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

Ramkumar Ramachandra artagnon at gmail.com
Sun Jul 21 06:13:42 PDT 2013


Kay Sievers wrote:
> Where do you see any "specific exceptions for broken hacks"?
>
> We surely support different forms of virtualizations, and support
> reasonable custom behavior. But we do not support providing a tty0 and
> have no working VT. It's just madness we don't want to see anywhere,
> and we which we don't want to collect quirks for.

So it has to do with classifying uml's behavior as "broken";
therefore, you want systemd to support only the general case of
"broken-ness", and not the specific case of uml.

Fine.  Enough talk.  Are you happy with these? (rough, untested)

diff --git a/src/getty-generator/getty-generator.c
b/src/getty-generator/getty-generator.c
index 9c7ed1a..d9881d5 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -97,6 +97,7 @@ int main(int argc, char *argv[]) {
         char *active;
         const char *j;
         const char *id = NULL;
+        int fd = -1;

         if (argc > 1 && argc != 4) {
                 log_error("This program takes three or no arguments.");
@@ -112,7 +113,8 @@ int main(int argc, char *argv[]) {

         umask(0022);

-        if (detect_container(NULL) > 0 || (detect_vm(&id) > 0 &&
!strcmp(id, "uml"))) {
+        fd = open_terminal("/dev/tty0", O_RDWR|O_CLOEXEC);
+        if (detect_container(NULL) > 0 || !is_vconsole(fd)) {
                 log_debug("Automatically adding console shell.");

                 if (add_symlink("console-getty.service",
"console-getty.service") < 0)


diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index bffc632..77d73fb 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -246,9 +246,8 @@ 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;
+                /* don't fail the service on broken ttys */
+                r = EXIT_SUCCESS;

                 log_error("Device %s is not a virtual console.", vc);
                 goto finish;


More information about the systemd-devel mailing list