Software installation or update doesn't block session exit

Bug #842799 reported by Matthew Paul Thomas on 2011-09-06
54
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Unity
Confirmed
Undecided
Unassigned
aptdaemon (Ubuntu)
Medium
Unassigned
software-center (Ubuntu)
Medium
Unassigned
unity (Ubuntu)
Undecided
Unassigned
update-manager (Ubuntu)
Undecided
Unassigned
update-notifier (Ubuntu)
Undecided
Unassigned

Bug Description

software-center trunk r2261, aptdaemon 0.43+bzr691, Ubuntu 11.10 beta 1

1. In USC, start installing something big and complicated, like Ardour.
2. While it is installing, choose "Shut Down" and confirm it.

What happens:
2. The computer shuts down immediately.
3. Ardour is not installed.
4. After restarting, and trying to install it again, errors at the console:
------------
2011-09-06 16:03:11,918 - softwarecenter.backend - ERROR - error in _on_trans_finished 'Error: Package operation failed
The installation or removal of a software package failed.

Setting up liblo7 (0.26~repack-7) ...
Setting up libgnomecanvasmm-2.6-1c2a (2.26.0-1build1) ...
dpkg: error processing libvamp-sdk2 (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
------------

What should happen:
2. A dialog appears explaining that you can't log out until Ubuntu Software Center is finished.
3. Once the installation finishes, the computer shuts down.

<https://wiki.ubuntu.com/SoftwarePackageOperations#general>: "2. Session exit should be inhibited."

Changed in software-center (Ubuntu):
importance: Undecided → Medium
description: updated
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in aptdaemon (Ubuntu):
status: New → Confirmed
Changed in software-center (Ubuntu):
status: New → Confirmed
Sebastian Heinlein (glatzor) wrote :

Since this bug has a nicer summary I marked the old bug as a duplicate of this one. Thanks.

Actually unity should check the ActiveTransactions property of aptdaemon before shutting down, since the transaction can continue even if the client is arround anymore.

Changed in aptdaemon (Ubuntu):
status: Confirmed → Won't Fix
Sebastian Heinlein (glatzor) wrote :

I closed the bug for aptdaemon since the infrastructure should be already available.

Matthew Paul Thomas (mpt) wrote :

I just discussed this with Michael. I may have messed up the details, but here's what I understand.

There are many different kinds of tasks for which you should be prompted to wait before a logout goes ahead. This already happens when you have an unsaved document in a well-behaved application (like GEdit or LibreOffice). Other examples include burning a CD, syncing an audio player, defragmenting a disk, or sculpting something with a 3D printer.

It shouldn't be Unity's job to detect all of these. It shouldn't be Unity's job even to know about any of them in particular; that wouldn't scale. That's why there's a gnome-session API for individual applications to announce that now would not be a good time to log out ... not yet ... not yet ... okay, now's good. http://live.gnome.org/SessionManagement/GnomeSession#A8._QueryEndSession

However, for package installation and removal, it's not so simple. As you point out, Sebastian, Ubuntu Software Center may not be running any more while an installation or removal completes. But beyond that, aptdaemon is running on the system bus, not the session bus. This has the advantage that you don't even need to be logged in *at all* for a task to complete. But it has two disadvantages. First, if a Debconf question occurs, there's no-one to answer it. And second, there is, apparently, no system-level equivalent to the gnome-session API for aptdaemon to inhibit shutdown -- so the machine just shuts down and leaves us with this corrupt package state.

So unless a system-level shutdown inhibit API is implemented, there are two ways to prevent the corruption problem here.
(1) In the short term, inhibit logout when there are any tasks. Michael says update-notifier is an appropriate place to do this, so I'm moving this report there.
(2) In the long term, add a check to the shutdown script so that it waits until all tasks are completed. I'm skeptical about how good this would look (and what happens if a maintainer script hangs?), but we can consider that in more detail later.

affects: aptdaemon (Ubuntu) → update-notifier (Ubuntu)
Changed in update-notifier (Ubuntu):
status: Won't Fix → New
Robert Roth (evfool) on 2012-01-13
Changed in update-manager (Ubuntu):
status: New → Confirmed
Changed in update-notifier (Ubuntu):
status: New → Confirmed
summary: - Software installation doesn't block session exit
+ Software installation or update doesn't block session exit
description: updated
Sebastian Heinlein (glatzor) wrote :

Systemd's logind introduced a new DBus interface to inhibit shutdown or suspend.

http://www.freedesktop.org/wiki/Software/systemd/inhibit

We would need support in unity.

Changed in aptdaemon (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity (Ubuntu):
status: New → Confirmed
Matthew Paul Thomas (mpt) wrote :

<seb128> http://www.freedesktop.org/wiki/Software/systemd/inhibit/
<seb128> "shutdown inhibits high-level system power-off and reboot requested by (unprivileged) users"
<seb128> that's part of logind
<seb128> (e.g it's already being used, not part of changing pid 1)
<seb128> like that page has an example of pseudo code
<seb128> "fd = Inhibit("shutdown:idle", "Package Manager", "Upgrade in progress...", "block");"
<seb128> that's basically what we want

Changed in unity:
status: New → Confirmed
Alex Baggott (alex-baggott) wrote :

As part of the big bug review for 16.04 LTS I have tested this on 15.10 and the bug is still there.

tags: added: desktop-bugscrub-triaged
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers