systemd-logind upstart script breaks if libpam-systemd is installed for more than one arch

Bug #1382510 reported by Grzegorz Gutowski
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released
Undecided
Unassigned
Trusty
Fix Released
High
Martin Pitt

Bug Description

/etc/init/systemd-logind.conf contains the following:

    # only start if PAM module is actually available, not if libpam-systemd is
    # removed but not purged
    [ -e /lib/*/security/pam_systemd.so ] || { stop; exit 0; }

Which is a wrongly written script. It assumes that there is at most one file matching the wildcard. It is not true in my system.
If your system have both libpam-systemd:amd64 and libpam-systemd:i386 then:

# ls /lib/*/security/pam_systemd.so
/lib/i386-linux-gnu/security/pam_systemd.so /lib/x86_64-linux-gnu/security/pam_systemd.so

and you get the following:

# cat /var/log/upstart/systemd-logind.log
/proc/self/fd/9: 4: [: /lib/i386-linux-gnu/security/pam_systemd.so: unexpected operator
systemd-logind stop/pre-start, process 2462

systemd-logind does not start at all. This causes many bad things to happen later.

There are many ways to fix this. For my purposes I removed the faulty line from the file. I don't know what is the expected behaviour. Maybe this one:

ls /lib/*/security/pam_systemd.so &> /dev/null || { stop; exit 0; }

This bug might be the root cause of other bugs. Like this one: #1372187 (and #1377727)

SRU TEST CASE
=============
- On an amd64 system, run "sudo apt-get install libpam-systemd:i386"
- Then run "sudo restart systemd-logind"
- On current trusty this will result in stop/waiting, with the error in /var/log/upstart/systemd-logind.log as above.
- With this fix this will result in start/running and no error.

My system info:

# lsb_release -rd
Description: Ubuntu 14.04.1 LTS
Release: 14.04
# apt-cache policy libpam-systemd
libpam-systemd:
  Installed: 204-5ubuntu20.7
  Candidate: 204-5ubuntu20.7

Revision history for this message
Martin Pitt (pitti) wrote :

Argh, many thanks for pointing this out! What an obvious and silly error.

This does not affect 14.10 as the upstart job for logind is gone entirely in favor of D-BUS activation. But this must be fixed for 14.04.

Changed in systemd (Ubuntu):
status: New → Fix Released
Changed in systemd (Ubuntu Trusty):
status: New → Triaged
importance: Undecided → High
assignee: nobody → Martin Pitt (pitti)
milestone: none → ubuntu-14.04.2
summary: - systemd-logind upstart script is flawed
+ systemd-logind upstart script breaks if libpam-systemd is installed for
+ more than one arch
Martin Pitt (pitti)
description: updated
Revision history for this message
Martin Pitt (pitti) wrote :

Fix uploaded to the trusty SRU review queue.

Changed in systemd (Ubuntu Trusty):
status: Triaged → In Progress
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Grzegorz, or anyone else affected,

Accepted systemd into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/systemd/204-5ubuntu20.8 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!

Changed in systemd (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Mathew Hodson (mhodson) wrote :

Fixed with libpam-systemd 204-5ubuntu20.8 in trusty-proposed.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Grzegorz Gutowski (grzegorz-gutowski) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 204-5ubuntu20.8

---------------
systemd (204-5ubuntu20.8) trusty; urgency=medium

  [ Ben Howard ]
  * 75-persistent-net-generator.rules: Add new Microsoft net rule
    (LP: #1367883)

  [ Martin Pitt ]
  * debian/libpam-systemd.systemd-logind.upstart: Fix "PAM module installed"
    check for the case when there is more than one library installed, which
    can happen on multi-arch systems. Thanks Grzegorz Gutowski! (LP: #1382510)
 -- Martin Pitt <email address hidden> Wed, 29 Oct 2014 08:05:16 +0100

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.