Bug 13854 - xserver-nodm.service failed with xf86OpenConsole: Switching VT failed
Summary: xserver-nodm.service failed with xf86OpenConsole: Switching VT failed
Status: RESOLVED FIXED
Alias: None
Product: General Runtime
Classification: Runtime
Component: General Runtime (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ minor
Target Milestone: 4.1 M3
Assignee: Pavel Zhukov
QA Contact:
URL:
Whiteboard:
: 13855 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-04-03 06:45 UTC by Changqing Li
Modified: 2022-08-25 19:44 UTC (History)
1 user (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
failed xorg log (20.76 KB, application/x-trash)
2020-04-03 06:45 UTC, Changqing Li
no flags Details
second time xorg success log (19.71 KB, text/x-log)
2020-04-03 06:46 UTC, Changqing Li
no flags Details
daemon.log (26.63 KB, text/x-log)
2020-04-03 06:47 UTC, Changqing Li
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Changqing Li 2020-04-03 06:45:55 UTC
Created attachment 4655 [details]
failed xorg log

Reproduce steps:
1. add below info in local.conf
DISTRO_FEATURES_append = " systemd pam"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
KERNEL_FEATURES_append = " cfg/systemd.scc"


INHERIT += 'testimage'
TEST_QEMUBOOT_TIMEOUT = "1500"

VIRTUAL-RUNTIME_syslog ?= "${@bb.utils.contains('INCOMPATIBLE_LICENSE', 'GPLv3', 'sysklogd', 'rsyslog', d)}"
VIRTUAL-RUNTIME_base-utils-syslog ?= "${VIRTUAL-RUNTIME_syslog}"

2. bitbake core-image-sato
3. runqemu snapshot nographic core-image-sato
4. check daemon.log. xserver-nodm.service start failed at the first time. then
restart automatically, and then start successfully.


More info:
1.  runqemu kvm nographic core-image-sato without this problem, seems related to snapshot???
2.  this failure caused bitbake core-image-sato -c testimage failed
Comment 1 Changqing Li 2020-04-03 06:46:33 UTC
Created attachment 4656 [details]
second time  xorg success log
Comment 2 Changqing Li 2020-04-03 06:47:01 UTC
Created attachment 4657 [details]
daemon.log
Comment 3 Randy MacLeod 2020-04-09 14:37:28 UTC
Can you please explain why this is a bug.
You are running with nographic so the error is expected.
Comment 4 Changqing Li 2020-04-10 00:56:43 UTC
I also think some X related error is expected, so I tried to add them into whitelist of parselogs.py  And RP suggested to check if it is a problem, if we can fix them or open a bug to track.

I had add other errors which I'm sure not a problem into parselogs.py,  but for 13852/13854/13855,  I am not very sure if it is ok to whitelist these errors.
so I opened the bug and hope who is good at X can have a look at this.
Comment 5 Randy MacLeod 2020-04-16 07:48:11 UTC
We need to agree on how a given image can find out if graphics is needed.
Please brainstorm and send a proposal to the list for discussion.
Comment 6 Randy MacLeod 2020-04-16 07:49:32 UTC
*** Bug 13855 has been marked as a duplicate of this bug. ***
Comment 7 Pavel Zhukov 2022-08-23 11:40:14 UTC
The issue is xserver-nodm failed to start on first attempt and successfully starts on second by systemd. Looks like unit dependencies should be adjusted
Comment 8 Pavel Zhukov 2022-08-23 12:46:18 UTC
The exact issue is the fact that getty@tty1 service is running. Xorg tries to bind to VT1 and it causes Input/Output error then it binds to VT2 and starts.

hardcoding old good VT7 solves the problem. looking for better solution.
Comment 9 Pavel Zhukov 2022-08-23 14:14:40 UTC
(In reply to comment #5)
> We need to agree on how a given image can find out if graphics is needed.
> Please brainstorm and send a proposal to the list for discussion.

That's not related to "nographic" unfortunately. Same behaviour can be reproduced with runqemu seriastdio/serial/nographic option or qemuparams. 
In other words any option which adds "console=/dev/tty1" will trigger this.

Systemd creates getty instance for this console (VT1), Xorg tries VT1 and fails because it's taken already. Next start of Xorg will try VT2 (and so on) and succeed if at least one virtual terminal can be found.
Comment 11 Pavel Zhukov 2022-08-25 19:44:22 UTC
The patch is merged https://git.openembedded.org/openembedded-core/commit/?id=d047f493e0c7f341dd307a4d8dd0db08a22824f1

It adds the error message to ignore list and should mitigate the issue with testimage. 
The issue itself is harmless and caused by the fact that VT1 is taken by getty if qemu is running with serial console. 
Different approach may be to bind Xorg to VT7 as it was done before but it'd be more invasive change and may break some use cases or tests.