Mir cannot open a tty when started by lightdm

Bug #1583624 reported by Josh Arenson on 2016-05-19
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Light Display Manager
High
Robert Ancell
1.18
High
Robert Ancell
lightdm (Ubuntu)
High
Robert Ancell
Xenial
High
Robert Ancell

Bug Description

[Impact]
LightDM reports the system compositor socket to Mir clients using the MIR_SOCKET variable. This stopped working in Mir 0.21. The Mir team says the correct variable is MIR_SERVER_HOST_SOCKET and MIR_SOCKET was a fallback to that.

[Test Case]
1. Start LightDM with a Mir greeter

Expected result:
Greeter starts

Observed result:
Mir greeter fails to start. It is attempting to access the video drivers directly (i.e. not through a compositor).

[Regression Potential]
Risk of using LightDM with older version of Mir that doesn't support MIR_SERVER_HOST_SOCKET. Risk of behaviour change in Mir using MIR_SERVER_HOST_SOCKET.

From mir-greeter.log (and with minor instrumentation from RAOF)

ERROR: QMirServer - Mir failed to start
qtmir.screens: ScreenController::ScreenController
qtmir.mir: MirServer created
qtmir.mir: Command line arguments passed to Qt: ("/usr/bin/unity8", "--mode=greeter")
ERROR: /home/josh/Documents/mir/verbose-error-for-vt-finding/src/server/graphics/default_configuration.cpp(133): Throw in function mir::DefaultServerConfiguration::the_graphics_platform()::<lambda()>
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >
std::exception::what: Exception while creating graphics platform
ERROR: /home/josh/Documents/mir/verbose-error-for-vt-finding/src/platforms/mesa/server/kms/linux_virtual_terminal.cpp(238): Throw in function int mir::graphics::mesa::LinuxVirtualTerminal::find_active_vt_number()
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >
std::exception::what: Failed to find the current VT. Tried:
 /dev/tty0:
  Failed to open read-only: Permission denied
  Failed to open write-only: Permission denied
 /dev/tty:
  Failed to open read-only: No such device or address
  Failed to open write-only: No such device or address

This occurs when trying to start the unity8 greeter under unity system compositor

Related branches

Robert Ancell (robert-ancell) wrote :

According to my system:
$ ls -l /dev/tty0
crw--w---- 1 root tty 4, 0 May 20 14:08 /dev/tty0

That makes sense. The greeter is running as the lightdm user so it shouldn't be able to open it.

Why is it trying? It should be running inside unity-system-compositor right?

Changed in lightdm:
status: New → Incomplete
Josh Arenson (josharenson) wrote :

Here is what I'm using to kick off the session

/usr/share/lightdm/lightdm.conf.d/51-unity8-greeter.conf
http://pastebin.ubuntu.com/16642766/

# Desktop file
http://pastebin.ubuntu.com/16642824/

# unity8-greeter-wrapper as called by the .desktop file
http://pastebin.ubuntu.com/16642769/

This _used_ to (kind of) work just fine :-/ and I can probably get it running under X. I'll take a look later today, but I'm pretty sure USC is running when the logs I provided were taken.

Will Cooke (willcooke) on 2016-05-25
Changed in lightdm:
assignee: nobody → Robert Ancell (robert-ancell)
Robert Ancell (robert-ancell) wrote :

What appears to be happening is the greeter is not aware it is running inside Unity System Compositor and so it trying to directly access the video drivers. This fails because it is not running as root.

The cause seems to be LightDM is setting MIR_SOCKET to the name of the U-S-C socket but this no longer works (possibly due to a change in bug 1290345).

The solution is to set MIR_SERVER_HOST_SOCKET instead, which is the recommended/correct variable to tell a Mir server the socket of the parent server (U-S-C in this case) to connect to.

Changed in lightdm:
importance: Undecided → High
Changed in lightdm (Ubuntu):
importance: Undecided → High
assignee: nobody → Robert Ancell (robert-ancell)
Robert Ancell (robert-ancell) wrote :

Josh, could you try building LightDM from lp:~robert-ancell/lightdm/new-mir-socket-variable and confirm if that fixes the issue?

Changed in lightdm (Ubuntu Xenial):
importance: Undecided → High
assignee: nobody → Robert Ancell (robert-ancell)
Changed in lightdm:
status: Incomplete → In Progress
Changed in lightdm (Ubuntu):
status: New → In Progress
Changed in lightdm (Ubuntu Xenial):
status: New → Confirmed
status: Confirmed → Triaged
Changed in lightdm (Ubuntu):
status: In Progress → Triaged
Changed in lightdm:
milestone: none → 1.19.1
Josh Arenson (josharenson) wrote :

I get

[+0.01s] CRITICAL: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

in the logs (or when running in test mode). This only happens when trying to run under Mir. Meaning I can delete 51-unity8-greeter.conf and lightdm starts just fine. The error happens before usc/mir are able to log anything.

Josh Arenson (josharenson) wrote :

Here is mir-greeter.log using your instrumented lightdm and changing the unity8 seat type to unity.

http://pastebin.ubuntu.com/16932129/

Thoughts?

Josh Arenson (josharenson) wrote :

I got the greeter working, but there are 2 other issues. The following assumes you are using the unity8 greeter to launch a unity7 session

if (seat-type == unity)
   The greeter loads, authenticates, a black screen is briefly shown, and the greeter comes back up. My theory here is that lightdm is trying to start unity7 on the same VT as the greeter, and this is making USC mad. I believe this will be fixed in USC in the future, but is there a work around we could have for the time being?

if (seat-type == xlocal)
   The log in /var/log/lightdm for the greeter is called (null)-greeter.log. I think this is because the code path taken doesn't call display_server_set_name in time. I used to know the answer to this, but I've since forgotten. I'm going to dig into this part further today, but if you have input, let me know.

Robert Ancell (robert-ancell) wrote :

There's some VT issues reported in bug 1589550 which I'm working on at the same time with this issue.

The (null) issue was an ordering bug. Please fix (I've been meaning to fix it at some point)!

The code I'm working on is (WIP) lp:~robert-ancell/lightdm/local-seat-refactor. This merges the unity and xlocal seats into just a 'local' seat that handles both cases and should fix some issues.

Josh Arenson (josharenson) wrote :

The root cause is the fd that pipe gives to USC is 0. The compositor starts and begins drawing frames, and lightdm eventually tries writing to fd=0 (also known as STDIN) which causes an Opperation not permitted error (see lp:1590447). I wrote a nasty patch that forces lightdm to keep obtaining file descriptors until fd[0]!=0 and it solved all the (known) issues that we are seeing.

 Mterry and I are workin on a fix for this ^^ and I'll work on the log name issue right after. I think we can close this bug, as the original issue has long since been resolved. Thanks.

Josh Arenson (josharenson) wrote :

Forgive my incoherent ramble in #9... Keep this open until lp:~robert-ancell/lightdm/new-mir-socket-variable lands :-p Also, the new issue is probably best explained by looking at lp:~mterry/lightdm/initialize-more/+merge/296836

Changed in lightdm:
status: In Progress → Fix Committed
Changed in lightdm:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lightdm - 1.19.1-0ubuntu1

---------------
lightdm (1.19.1-0ubuntu1) yakkety; urgency=medium

  * New upstream release:
  * debian/lightdm.dirs:
    - Rename "xlocal" seat type to "local". Using "xlocal" will continue to work
      but report a warning.
    - Ensure user configuration directories /etc/lightdm/lightdm.conf.d and
      /etc/guest-session exist
    - Use MIR_SERVER_HOST_SOCKET instead of MIR_SOCKET to report compositor
      socket to sessions. This used to work but no longer works in Mir 0.21
      (LP: #1583624)
    - Allow XMir to run on the xlocal seat using the new x-server-backend=mir
      option
    - Use only a single compositor on local seats (LP: #1594229)
    - Fix Mir greeter log filename having "(null)" in the name (LP: #1590582)
    - Copy fcitx/mozc rules so session works when these aren't installed
      (LP #1581187)
    - Revert lxsession change - it caused the AppArmor to fail to compile
  * debian/rules:
    - Revert dh_installinit change - we don't want to start LightDM on install
      (LP: #1581106)
  * debian/guest-account.sh:
  * debian/guest-session-setup.sh:
    - Source prefs.sh as privileged user to allow user modification
      (LP: #1581853)

 -- Robert Ancell <email address hidden> Mon, 20 Jun 2016 16:18:36 +1200

Changed in lightdm (Ubuntu):
status: Triaged → Fix Released
Changed in lightdm (Ubuntu Xenial):
status: Triaged → Fix Committed
description: updated

Hello Josh, or anyone else affected,

Accepted lightdm into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/lightdm/1.18.2-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lightdm - 1.18.2-0ubuntu1

---------------
lightdm (1.18.2-0ubuntu1) xenial; urgency=medium

  * New upstream release:
    - Don't quit on SIGUSR1, SIGUSR2 or SIGHUP (LP: #960157)
    - Use MIR_SERVER_HOST_SOCKET instead of MIR_SOCKET to report compositor
      socket to sessions. This used to work but no longer works in Mir 0.21
      (LP: #1583624)
    - Use only a single compositor on xlocal seats (LP: #1594229)
    - Fix Mir greeter log filename having "(null)" in the name (LP: #1590582)
    - Set XDMCP hostname field in to system hostname or configured value
      (LP: #1578442)
    - Improve XDMCP IPv6 address selection (LP: #1575200)
    - Allow fcitx and mozc to run in guest session (LP: #1509829)
    - Fix uninitialized memory errors
  * debian/lightdm.dirs:
    - Ensure user configuration directories /etc/lightdm/lightdm.conf.d and
      /etc/guest-session exist
  * debian/guest-account.sh:
  * debian/guest-session-setup.sh:
    - Source prefs.sh as privileged user to allow user modification
      (LP: #1581853)

 -- Robert Ancell <email address hidden> Tue, 21 Jun 2016 12:49:01 +1200

Changed in lightdm (Ubuntu Xenial):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers