Upgrading from bluez 4.45-0ubuntu{1,2} to 4.45-0ubuntu3 or later fails

Bug #399482 reported by Martin-Éric Racine
304
This bug affects 67 people
Affects Status Importance Assigned to Milestone
bluez (Ubuntu)
Fix Released
High
Alexander Sack

Bug Description

Binary package hint: bluez

Preparing to replace bluez 4.45-0ubuntu1 (using .../bluez_4.45-0ubuntu2_i386.deb) ...
invoke-rc.d: initscript bluetooth, action "stop" failed.
dpkg: warning: old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
invoke-rc.d: initscript bluetooth, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/bluez_4.45-0ubuntu2_i386.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
postinst called with unknown argument `abort-upgrade'
Errors were encountered while processing:
 /var/cache/apt/archives/bluez_4.45-0ubuntu2_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
E: Some packages could not be upgraded.

ProblemType: Bug
Architecture: i386
Date: Tue Jul 14 23:58:34 2009
DistroRelease: Ubuntu 9.10
Package: bluez 4.45-0ubuntu1
ProcEnviron:
 LANGUAGE=fi_FI:fi:en_GB:en
 PATH=(custom, user)
 LANG=fi_FI.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.30-10.12-generic
SourcePackage: bluez
Uname: Linux 2.6.30-10-generic i586

---
It's been decided that this bug won't be fixed due to the large amount of breakage going on in the last 24 hours anyway with other packages.
The problem only happens when upgrading from 4.45-0ubuntu1 or 4.45-0ubuntu2 to 4.45-0ubuntu3 when bluetoothd is *not* already running.

If you are affected, there are two ways that it can be currently worked around:
1) Start bluetoothd before doing the upgrade
2) Add a || true to the pkill line in /etc/init.d/bluetooth

Related branches

Revision history for this message
Martin-Éric Racine (q-funk) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bluez - 4.45-0ubuntu3

---------------
bluez (4.45-0ubuntu3) karmic; urgency=low

  * debian/bluez.bluetooth.init:
    - Guard the stop action in case bluetoothd isn't running. (LP: #399482)

 -- Mario Limonciello <email address hidden> Tue, 14 Jul 2009 17:02:42 -0500

Changed in bluez (Ubuntu):
status: New → Fix Released
Revision history for this message
Martin-Éric Racine (q-funk) wrote :

While I haven't seen what fix was used in 4.45-0ubuntu3 (still waiting for the mirror to be pulsed), I'll point out that the main issue seems to be that prerm misses the case/esac traps to intercept dpkg commands:

# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>

This is what made the upgrade fail.

Revision history for this message
Sebastian Schepens (sebas-schep) wrote :

Upgrade to 4.45-0ubuntu3 from 0ubuntu1 fails as well with same error:
invoke-rc.d: initscript bluetooth, action "stop" failed.
dpkg: warning: old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
invoke-rc.d: initscript bluetooth, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/bluez_4.45-0ubuntu3_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
postinst called with unknown argument `abort-upgrade'

Revision history for this message
Manuel Muradás (dieresys) wrote :

You can 'manually' apply the patch by editing '/etc/init.d/bluetooth':
- Find the 'pkill -TERM bluetoothd' line
- Replace it with 'pkill -TERM bluetoothd || true'

I don't know if there is a better way to solve this problem.

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

Manuel, that "fixes" something which isn't broken. :)

What needs to be fixed are the maintainer scripts, by adding traps to catch command line arguments passed by dpkg. Right now, those scripts are broken.

However, looking more closely, the dh_installinit helper from the Debhelper package is what appears to be broken, because it inserts an if/then loop to stop the daemon, without any case/esac traps to catch dpkg arguments.

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

OK, what's needed are an empty prerm and postrm, each with case/esac cases as follow:

# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see /usr/doc/packaging-manual/

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

This sample script should fix it. It just needs to be merged upstream at Debian.

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

Looks like this one is needed too. Again, should also be merged upstream at Debian.

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

As reported by several people, 4.45-0ubuntu3 did not really fix the issue. Re-opening.

Changed in bluez (Ubuntu):
status: Fix Released → New
Revision history for this message
Martin-Éric Racine (q-funk) wrote :

Mario, can you please check the attachments and merge them in the source package?

Revision history for this message
Bobby McGee (iaskedalice09) wrote :

I found this fix in the Ubuntu Forums and it worked for me:

Open a Terminal

    * sudo gedit /etc/init.d/bluetooth
    * Find the "pkill -TERM bluetoothd" line
    * Replace it with "pkill -TERM bluetoothd || true"
Save it and run sudo apt-get upgrade. It will prompt you if you want to overwrite the /etc/init.d/bluetooth file, hit N to keep your changes. Then hit enter and it should update correctly.

Source: http://ubuntuforums.org/showthread.php?t=1213573

Revision history for this message
Fahim Abdun-Nur (fahim-a) wrote : Re: [Bug 399482] Re: bluez: upgrade from 4.45-0ubuntu1 to 4.45-0ubuntu2 fails

I tried out your instructions and they seem to have done the trick. Thanks!

On Wed, Jul 15, 2009 at 7:08 AM, Bobby McGee <email address hidden>wrote:

> I found this fix in the Ubuntu Forums and it worked for me:
>
> Open a Terminal
>
> * sudo gedit /etc/init.d/bluetooth
> * Find the "pkill -TERM bluetoothd" line
> * Replace it with "pkill -TERM bluetoothd || true"
> Save it and run sudo apt-get upgrade. It will prompt you if you want to
> overwrite the /etc/init.d/bluetooth file, hit N to keep your changes. Then
> hit enter and it should update correctly.
>
> Source: http://ubuntuforums.org/showthread.php?t=1213573
>
> --
> bluez: upgrade from 4.45-0ubuntu1 to 4.45-0ubuntu2 fails
> https://bugs.launchpad.net/bugs/399482
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Matt Zimmerman (mdz)
Changed in bluez (Ubuntu):
status: New → Triaged
importance: Undecided → High
assignee: nobody → Canonical Desktop Team (canonical-desktop-team)
importance: High → Undecided
status: Triaged → New
status: New → Triaged
importance: Undecided → High
Rolf Leggewie (r0lf)
summary: - bluez: upgrade from 4.45-0ubuntu1 to 4.45-0ubuntu2 fails
+ latest karmic bluez packages fail to upgrade
Changed in bluez (Ubuntu):
assignee: Canonical Desktop Team (canonical-desktop-team) → Alexander Sack (asac)
Revision history for this message
Nizar Kerkeni (nizarus) wrote : Re: latest karmic bluez packages fail to upgrade

I confirm that version 4.45-0ubuntu3 can't be installed on karmic 64 bits.

Revision history for this message
Mario Limonciello (superm1) wrote :

The problem only happens when upgrading from 4.45-0ubuntu1 or 4.45-0ubuntu2 to 4.45-0ubuntu3 when bluetoothd is *not* already running.

There are two ways that it can be currently worked around:
1) Start bluetoothd before doing the upgrade
2) Add a || true to the pkill line in /etc/init.d/bluetooth

Martin-Éric Racine :

I don't believe adding skeleton prerm and postrm's will actually solve this problem. The init script is still going to exit with status 1 unless bluetoothd is running.

summary: - latest karmic bluez packages fail to upgrade
+ Upgrading from bluez 4.45-0ubuntu{1,2} to 4.45-0ubuntu3 or later fails
Revision history for this message
Martin-Éric Racine (q-funk) wrote :

Mario: the scripts *do* solve the issue that what's currently shipping fails to react to arguments passed to them.

Revision history for this message
Mario Limonciello (superm1) wrote :

Martin:

I did test with your two additional skeleton scripts in place, and it does not help the problem.

Look at http://women.debian.org/wiki/English/MaintainerScripts for the Upgrading section. Yes after the old prerm fails, it will go into try the prerm for the new one with an argument "failed-upgrade". Unfortunately, there is also still a #DEBHELPER# clause in the prerm that cause it to exit 1 because it still tries to stop the init script. It then proceeds over to postinst with abort-upgrade ( which isn't supported currently ), but that would still lead to a broken package installation.

Changed in bluez (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
Mario Limonciello (superm1) wrote :

Given the amount of breakage outside of bluez that's been happening in the last 24 hours, it's been decided trying to add cases in here to fix upgrades between 4.45-0ubuntu{1,2} and 4.45-0ubuntu3 is not an important scenario. Upgrades work from earlier versions.

description: updated
Revision history for this message
Nate Muench (Mink) (n-muench) wrote :

I did the following fix in Terminal:
    * sudo gedit /etc/init.d/bluetooth
    * Find the "pkill -TERM bluetoothd" line
    * Replace it with "pkill -TERM bluetoothd || true"

After doing this, the update went just fine.

Revision history for this message
Michael Bienia (geser) wrote :

Here is a debdiff with a prerm for bluez catching the error from the old prerm script and exiting with return code 0 (nothing has to be done as the deamon is already stopped else the bug won't occur).

Preparing to replace bluez 4.45-0ubuntu1 (using .../bluez_4.45-0ubuntu4_amd64.deb) ...
invoke-rc.d: initscript bluetooth, action "stop" failed.
dpkg: warning: old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Unpacking replacement bluez ...
Setting up bluez (4.45-0ubuntu4) ...

Revision history for this message
Max Bowsher (maxb) wrote :

Given that that prerm change ignores ALL errors from the old prerm, would it not be better, for safety's sake, to limit it to *just* the two broken versions explicitly, rather than those versions and all earlier versions?

Revision history for this message
Max Bowsher (maxb) wrote :

And probably also comment that it's a workaround for a problem present in packages which were never part of any Ubuntu release, not even an alpha release, so can be dropped again in a month or so.

Revision history for this message
Michael Bienia (geser) wrote :

Updated the debdiff with this suggestions.

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

This bug was fixed in the package bluez - 4.45-0ubuntu4

---------------
bluez (4.45-0ubuntu4) karmic; urgency=low

  * Fix upgrade breakage from 4.45-0ubuntu{1,2} (lp: #399482)

 -- Michael Bienia <email address hidden> Thu, 16 Jul 2009 11:04:02 +0200

Changed in bluez (Ubuntu):
status: Won't Fix → Fix Released
Revision history for this message
Bruno Vitorino (bruno-vitorino) wrote :

I had the same problem upgrading to bluez_4.53.
My /etc/init.d/bluetooth didn't had a "pkill -TERM bluetoothd" line, instead it had a "killall bluetoothd" line, so i did the same as suggested before and changed the line to be "killall bluetoothd || true", restarted bluetooth and then the upgrade worked fine.

Revision history for this message
Seria (andreas-boettger) wrote :

works fine, thank you

Revision history for this message
Anthony Hook (anthonyhook) wrote :

Everything seems alright from here! Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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