package update of bluez 4.98-2ubuntu7 (Precise) to 4.101-0ubuntu10 (Trusty) fails

Bug #1301962 reported by Michael Schaller
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
bluez (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

During an upgrade of a vanilla Precise install to Trusty I've encountered already twice this issue:

$ sudo dpkg --configure bluez
Setting up bluez (4.101-0ubuntu10) ...
reload: Method "Reload" with signature "" on interface "com.ubuntu.Upstart0_6.Instance" doesn't exist

invoke-rc.d: initscript dbus, action "force-reload" failed.
start: Job failed to start
invoke-rc.d: initscript bluetooth, action "start" failed.
dpkg: error processing package bluez (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 bluez

Tags: trusty
Revision history for this message
Michael Schaller (misch-9) wrote :

The problematic part is in the bluez postinst script:
# Automatically added by dh_installinit
if [ -x "/etc/init.d/bluetooth" ] || [ -e "/etc/init/bluetooth.conf" ]; then
 if [ ! -e "/etc/init/bluetooth.conf" ]; then
  update-rc.d bluetooth defaults >/dev/null
 fi
 invoke-rc.d bluetooth start || exit $?
fi

$ sudo invoke-rc.d bluetooth start ; echo "exit code: $?"
start: Job failed to start
invoke-rc.d: initscript bluetooth, action "start" failed.
exit code: 1

$ sudo /etc/init.d/bluetooth start ; echo "exit code: $?"
 * Starting bluetooth [ OK ]
exit code: 0

$ sudo start bluetooth ; echo "exit code: $?"
start: Job failed to start
exit code: 1

So the Upstart job has an issue. Unfortunately after adding 'console output' to the bluetooth Upstart job configuration the job started without issues. Once I encounter this issue again I will further troubleshoot...

Revision history for this message
Michael Schaller (misch-9) wrote :

So it's definitely not only touching the bluetooth Upstart job configuration. 'console output' didn't give me much either. 'console log' gave me this: "Can't open RFCOMM control socket: Address family not supported by protocol"

Revision history for this message
Michael Schaller (misch-9) wrote :

# initctl reload-configuration
# start bluetooth
start: Job failed to start

> A simple reload of the Upstart config isn't enough. Upstart should do this anyway as it gets notified via inotify.

# find /etc/init | xargs grep bluetooth -sl
/etc/init/bluetooth.conf

> No Upstart jobs that use 'starting bluetooth' and that could fail

# ps auxw | grep -v grep | grep bluetoothd
root 622 0.0 0.0 21192 872 ? Ss Apr03 0:00 /usr/sbin/bluetoothd
# killall bluetoothd
# ps auxw | grep -v grep | grep bluetoothd
root 24675 0.0 0.1 19296 1700 ? Ss 09:39 0:00 /usr/sbin/bluetoothd

> bluetoothd is up and running and can be (re)started

# ls -la /usr/sbin/hciattach
-rwxr-xr-x 1 root root 100736 Dec 20 03:43 /usr/sbin/hciattach
# ls -la /etc/bluetooth/uart
ls: cannot access /etc/bluetooth/uart: No such file or directory

> hciattach won't be called

# ls -la /usr/bin/rfcomm
-rwxr-xr-x 1 root root 87288 Dec 20 03:43 /usr/bin/rfcomm
# ls -la /etc/bluetooth/rfcomm.conf
-rw-r--r-- 1 root root 297 Mar 21 2012 /etc/bluetooth/rfcomm.conf
# sh -c "/usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all ; echo exit code: $?"
exit code: 0

> I don't see any obvious issue with the bluetooth Upstart job configuration

Revision history for this message
Michael Schaller (misch-9) wrote :

Looks like we get the error on restart of the bluetooth service because the dbus service reload failed beforehand. Unfortunately the reload error of the dbus service is ignored which makes troubleshooting harder than it would need to be. IMHO this is an error in the bluez.postinst script.

# restart dbus
dbus start/running, process 22184
# start bluetooth
start: Job is already running: bluetooth
# dpkg --configure bluez ; echo "exit code: $?"
Setting up bluez (4.101-0ubuntu11) ...
reload: Method "Reload" with signature "" on interface "com.ubuntu.Upstart0_6.Instance" doesn't exist

invoke-rc.d: initscript dbus, action "force-reload" failed.
exit code: 0

Can we update the bluez.postinst script to not ignore errors if the dbus service reload fails?

Revision history for this message
Michael Schaller (misch-9) wrote :

And another round. This time I can really confirm that the missing reload of the dbus service is the issue at hand.

> Initial state:
# pidof bluetoothd
630

# dpkg --configure bluez
Setting up bluez (4.101-0ubuntu11) ...
reload: Method "Reload" with signature "" on interface "com.ubuntu.Upstart0_6.Instance" doesn't exist

invoke-rc.d: initscript dbus, action "force-reload" failed.
start: Job failed to start
invoke-rc.d: initscript bluetooth, action "start" failed.
dpkg: error processing package bluez (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 bluez

# start bluetooth
start: Job failed to start

# pidof bluetoothd
630

> Try to trigger a reload of the dbus service via invoke-rc.d

# invoke-rc.d dbus force-reload
reload: Method "Reload" with signature "" on interface "com.ubuntu.Upstart0_6.Instance" doesn't exist

invoke-rc.d: initscript dbus, action "force-reload" failed.

# start bluetooth
start: Job failed to start

> Try to trigger a reload of the dbus service via Upstart's initctl

# initctl reload dbus
initctl: Method "Reload" with signature "" on interface "com.ubuntu.Upstart0_6.Instance" doesn't exist

# start bluetooth
start: Job failed to start

> Try to trigger a reload of the dbus service via SIGHUP to the dbus system bus process

# kill -s SIGHUP $(ps ax | grep dbus | grep system | awk '{ print $1 }')
# start bluetooth
bluetooth start/post-stop, process 22101

> Success!

So the method how Upstart reloads services has changed between Precise and Trusty. Trusty's version of initctl doesn't have backwards compatibility with Precise's Upstart version when it comes to reloading services and this is an issue for the dist-upgrade case.

Revision history for this message
Michael Schaller (misch-9) wrote :

One additional note. Sometimes there is an old bluetoothd process lurking around that is not tracked by Upstart which needs to be killed in addition.

Revision history for this message
Michael Schaller (misch-9) wrote :

I've commented on the original bug that introduced the new reload behavior in Upstart:
https://bugs.launchpad.net/upstart/+bug/893021 comment #2

Revision history for this message
Michael Schaller (misch-9) wrote :
Revision history for this message
Michael Schaller (misch-9) wrote :

The Upstart reload bug is resolved but there is still an issue between Upstart and libselinux1 that prevents service reloads:
https://bugs.launchpad.net/ubuntu/+source/libselinux/+bug/1313712

Revision history for this message
AA (aafortinet) wrote :

I encounter the same issue.
Is there a workaround?

I am running Linux Mint 17.1 Rebecca, which is more or less 'similar' to Trusty.

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

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

Changed in bluez (Ubuntu):
status: New → Confirmed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thank you for reporting this bug to Ubuntu. Ubuntu 12.04 (precise) reached end-of-life on April 28, 2017.

See this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases

Please upgrade to the latest version and re-test.

Changed in bluez (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for bluez (Ubuntu) because there has been no activity for 60 days.]

Changed in bluez (Ubuntu):
status: Incomplete → Expired
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.