nvidia-331.postrm calls `stop nvidia-persistenced`, but upstart job has been removed

Bug #1394348 reported by Jason Gerard DeRose
This bug affects 2 people
Affects Status Importance Assigned to Milestone
nvidia-graphics-drivers-331 (Ubuntu)

Bug Description

nvidia-graphics-drivers-331 (331.89-0ubuntu5) will fail to remove/purge nvidia-331 when /usr/bin/nvidia-persistenced is running.

The reason is the nvidia-331.postrm script hasn't been updated to reflect that nvidia-persistenced is now started via udev rather than Upstart (the Upstart job has been removed).

The offending lines in nvidia-331.postrm:

        # Remove the nvidia-persistenced user
        if id "$NVPD_USER" > /dev/null 2>&1; then
            stop nvidia-persistenced || true
            userdel "$NVPD_USER"

When /usr/bin/nvidia-persistenced is running, `userdel "$NVPD_USER"` will cause the postrm script to exit with a non-zero status, leaving dpkg in a broken state.

I believe the correct fix is:

        # Remove the nvidia-persistenced user
        if id "$NVPD_USER" > /dev/null 2>&1; then
            userdel "$NVPD_USER"

Or for extra safety, I like this fix even better:

        # Remove the nvidia-persistenced user
        if id "$NVPD_USER" > /dev/null 2>&1; then
            /usr/bin/stop-nvidia-persistenced || true
            userdel "$NVPD_USER" || true

Although /usr/bin/stop-nvidia-persistenced will exit with 0 even if nvidia-persistenced wasn't running, I don't see any reason to risk a broken dpkg state when there were problems stopping nvidia-persistenced, or problems removing its user.

Same problem exists with nvidia-graphics-drivers-331-updates.

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Ah, one thing I had wrong.... /usr/bin/stop-nvidia-persistenced needs to be called in nvidia-331.prerm, not nvidia-331.postrm

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

This fix seems to be working well. I have test packages here if anyone wants to test them:


Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "possible-fix.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
dino99 (9d9) wrote :

Every time i get a newer driver version, i need first to manually purge the previous installed one, due to that bug.
Wonder when the canonical team will take care of all the graphic issues laying around ?

Changed in nvidia-graphics-drivers-331 (Ubuntu):
status: New → Confirmed
Chad Miller (cmiller)
Changed in nvidia-graphics-drivers-331 (Ubuntu):
importance: Undecided → Critical
Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Thanks, Chad!

Note that I'm almostready with a revised patch, so my current patch shoudl be ignored for now.

My revised patch will incorporate your suggestion for the preinst script.

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

To hopefully make this fix easier for the nvidia driver maintainers to integrate across all affected versions (including those in the xorg-edgers PPA), here's a github pull request for the nvidia-331 branch:


debdiff coming shortly.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nvidia-graphics-drivers-331 - 331.113-0ubuntu2

nvidia-graphics-drivers-331 (331.113-0ubuntu2) vivid; urgency=medium

  [ Jason Gerard DeRose ]
  * debian/templates/nvidia-graphics-drivers.postrm.in:
    - Fix broken postrm script, plus add work-around for upgrading
      from previous broken versions of the same (LP: #1394348).
    - No longer call `stop nvidia-persistenced` as the Upstart job was
      removed in 331.89-0ubuntu3.
    - Remove "nvidia-persistenced" user/group in a failsafe manner
      (ie. even if userdel fails, postrm will not exit with a non-zero
  * debian/templates/nvidia-graphics-drivers.preinst.in:
    - Call `/usr/bin/stop-nvidia-persistenced` to work-around
      the broken postrm script introduced in 331.89-0ubuntu3; without
      this, upgrading between major nvidia driver versions (eg. 331=>343)
      will break.
  * debian/templates/nvidia-graphics-drivers.prerm.in:
    - Call `/usr/bin/stop-nvidia-persistenced` so that the
      nvidia-persistenced process is killed prior to the postrm script
      being called (which means that removing the "nvidia-persistenced"
      user/group can actually succeed).
 -- Alberto Milone <email address hidden> Wed, 10 Dec 2014 10:33:28 +0100

Changed in nvidia-graphics-drivers-331 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers