The package cannot be removed if the daemon fails to start

Bug #242635 reported by Denis Rut'kov
14
Affects Status Importance Assigned to Milestone
trousers (Debian)
Fix Released
Unknown
trousers (Ubuntu)
Fix Released
Undecided
Unassigned
Hardy
Fix Released
Undecided
Unassigned
Intrepid
Fix Released
Undecided
Unassigned

Bug Description

TEST CASE:

A simple test case is defined here:

1. In Hardy, install the trousers (0.3.1-4ubuntu0.1) package with your preferred package manager. The hardy-updates repo must be enabled for you to be able to do this. You can also test this if you have a previous update from hardy-proposed (0.3.1-4ubuntu0.2) already installed.

2. Make sure that the daemon is not running (it won't if you don't have a tpm chip and/or a tpm kernel module loaded).

3. Try to remove the package with your preferred package-manager (for instance with the command: sudo apt-get remove trousers).
This should fail with the following message:

Removing trousers ...
 Stopping Trusted Computing daemon: invoke-rc.d: initscript trousers, action "stop" failed.
 dpkg: error processing trousers (--remove):
  subprocess pre-removal script returned error exit status 1
 Starting Trusted Computing daemon: device driver not loaded, aborting.
 Errors were encountered while processing:
  trousers
 E: Sub-process /usr/bin/dpkg returned an error code (1)

4. Enable the hardy-proposed repository. For instance, you can do this by adding the following line to /etc/apt/sources.list:

  deb http://archive.ubuntu.com/ubuntu/ hardy-proposed universe

Update your local cache and upgrade.

5. Try again to remove the package. This time it should succeed.

6. Disable the hardy-proposed repository.

WARNING: Any user willing to help with testing is more than welcome. Please be aware that there might be some time before the updated packages will be available in your mirror. The sru needs to be approved and the package manually copied by an archive admin, this may take from 1 to several days to be processed.

-------

I tried installing tpm-tools package, but it seems it won't work with my hardware. When I tried to remove this package, this happens:

Removing trousers ...
Stopping Trusted Computing daemon: invoke-rc.d: initscript trousers, action "stop" failed.
dpkg: error processing trousers (--remove):
 subprocess pre-removal script returned error exit status 1
Starting Trusted Computing daemon: device driver not loaded, aborting.
Errors were encountered while processing:
 trousers
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

Can you open a terminal and give this command:

apt-cache policy trousers

Please paste the results here.

Changed in trousers:
status: New → Incomplete
Revision history for this message
Denis Rut'kov (dendron2000) wrote : apt-cache policy trousers

Here you are.

trousers:
  Installed: 0.3.1-4ubuntu0.1
  Candidate: 0.3.1-4ubuntu0.1
  Version table:
 *** 0.3.1-4ubuntu0.1 0
        500 http://ru.archive.ubuntu.com hardy-updates/universe Packages
        100 /var/lib/dpkg/status
     0.3.1-4 0
        500 http://ru.archive.ubuntu.com hardy/universe Packages
     0.2.9.1-0ubuntu2 0
        500 http://ru.archive.ubuntu.com gutsy/universe Packages

Changed in trousers:
assignee: nobody → norsetto
status: Incomplete → In Progress
assignee: nobody → norsetto
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package trousers - 0.3.1-6ubuntu2

---------------
trousers (0.3.1-6ubuntu2) intrepid; urgency=low

  * Add --oknodo to the stop action of the init script (LP: #242635).
    This will prevent failing the removal of the package if the daemon
    is not running (for instance because the device driver is not loaded).

 -- Cesare Tirabassi <email address hidden> Wed, 25 Jun 2008 23:55:25 +0200

Changed in trousers:
status: Fix Committed → Fix Released
Changed in trousers:
assignee: norsetto → nobody
status: In Progress → Fix Committed
Revision history for this message
Denis Rut'kov (dendron2000) wrote :

Phew, that was fast. Nice work guys!

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

motu-sru is subscribed to give clearance for uploading the fix to hardy-proposed:

1. The trousers package cannot be removed in Hardy if the tpm driver is missing. This is a mistake from the user's side since the tpm driver is required for the package to work properly, but we obviously have to cater for it.

2. The bug has been fixed in the release version by adding the --oknodo option to the start-stop-daemon stop action.

3. A minimal patch applicable to the stable version of the package is attached.

4. TEST CASE:

A simple test case is defined here.

4.1 In Hardy, install the trousers (0.3.1-4ubuntu0.1) package with your preferred package manager. The hardy-updates repo must be enabled for you to be able to do this.

4.2 Make sure that the daemon is not running (it won't if you don't have a tpm chip and/or a tpm kernel module loaded).

4.3 Try to remove the package with your preferred package-manager (for instance with the command: sudo apt-get remove trousers).
This should fail with the following message:

Removing trousers ...
Stopping Trusted Computing daemon: invoke-rc.d: initscript trousers, action "stop" failed.
dpkg: error processing trousers (--remove):
 subprocess pre-removal script returned error exit status 1
Starting Trusted Computing daemon: device driver not loaded, aborting.
Errors were encountered while processing:
 trousers
E: Sub-process /usr/bin/dpkg returned an error code (1)

4.4 Enable the hardy-proposed repository. For instance, you can do this by adding the following line to /etc/apt/sources.list:

  deb http://archive.ubuntu.com/ubuntu/ hardy-proposed universe

Update your local cache and INSTALL trousers again.

4.5 During the installation you will be asked what you want to do about the configuration file `/etc/init.d/trousers. Answer Y or I (which means install the package maintainer's version).

4.6 Try again to remove the package. This time it should succeed.

4.7 Disable the hardy-proposed repository.

WARNING: Any user willing to help with testing is more than welcome. Please be aware that there might be some time before the updated packages will be available in your mirror. The sru needs to be approved and the package manually copied by an archive admin, this may take from 1 to several days to be processed.

Changed in trousers:
assignee: norsetto → nobody
status: In Progress → Confirmed
Revision history for this message
Cesare Tirabassi (norsetto) wrote :
Revision history for this message
Luca Falavigna (dktrkranz) wrote :

ACK from motu-sru to upload version 0.3.1-4ubuntu0.2 to hardy-proposed.

Changed in trousers:
status: Unknown → New
Revision history for this message
Jonathan Riddell (jr) wrote :

Accepted 0.3.1-4ubuntu0.2 into hardy-proposed, please test.

Revision history for this message
Cosmin L. Neagu (clneagu) wrote :

I still can't upgrade/uninstall
---
(Reading database ... 125631 files and directories currently installed.)
Preparing to replace trousers 0.3.1-4ubuntu0.1 (using .../trousers_0.3.1-4ubuntu0.2_i386.deb) ...
Stopping Trusted Computing daemon: invoke-rc.d: initscript trousers, action "stop" failed.
dpkg: warning - old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
Stopping Trusted Computing daemon: invoke-rc.d: initscript trousers, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/trousers_0.3.1-4ubuntu0.2_i386.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Starting Trusted Computing daemon: device driver not loaded, aborting.
Errors were encountered while processing:
 /var/cache/apt/archives/trousers_0.3.1-4ubuntu0.2_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

That's why I specifically mention in my test case that you have to INSTALL the new package. The problem is in the init file so you can't just upgrade.

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

As a workaround solution, you can add (with su rights) the --oknodo option to the init script. This should allow you to at least install the new package (the old one will still fail to remove though since the postrm is still wrong). In /etc/init.d/trousers Just change the line:

  start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid --exec ${DAEMON}

to

  start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/${NAME}.pid --exec ${DAEMON}

After you have installed the new package, you should be able to remove it. Please confirm it here (or otherwise).

Thanks.

Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 242635] Re: The package cannot be removed if the daemon fails to start

Can't we come up with a better solution than this?

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

How? Feel free to propose one, as far as I know there is no clean way to change a faulty init script.

Revision history for this message
Cesare Tirabassi (norsetto) wrote :
Download full text (5.8 KiB)

Thanks to steelclad ScottK, attached here is a (hopefully final) update that should also allow users that have mistakenly installed trousers to upgrade and eventually remove it.
This is a log showing it:

root@norsetto:/root/debian# apt-get install trousers
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  trousers
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/142kB of archives.
After this operation, 487kB of additional disk space will be used.
Can not write log, openpty() failed (/dev/pts not mounted?)
Selecting previously deselected package trousers.
(Reading database ... 381419 files and directories currently installed.)
Unpacking trousers (from .../trousers_0.3.1-4ubuntu0.1_amd64.deb) ...
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up trousers (0.3.1-4ubuntu0.1) ...
Adding system user `tss' (UID 118) ...
Adding new group `tss' (GID 129) ...
Adding new user `tss' (UID 118) with group `tss' ...
Not creating home directory `/var/lib/tpm'.
Starting Trusted Computing daemon: device driver not loaded, aborting.

root@norsetto:/root/debian# apt-get remove --purge trousers
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  trousers*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 487kB disk space will be freed.
Do you want to continue [Y/n]?
Can not write log, openpty() failed (/dev/pts not mounted?)
(Reading database ... 381441 files and directories currently installed.)
Removing trousers ...
Stopping Trusted Computing daemon: invoke-rc.d: initscript trousers, action "stop" failed.
dpkg: error processing trousers (--purge):
 subprocess pre-removal script returned error exit status 1
Starting Trusted Computing daemon: device driver not loaded, aborting.
Errors were encountered while processing:
 trousers
E: Sub-process /usr/bin/dpkg returned an error code (1)

root@norsetto:/root/debian# apt-get update && apt-get upgrade
Ign file: ./ Release.gpg
Ign file: ./ Translation-en_US
Ign file: ./ Release
Ign file: ./ Packages
Hit http://archive.ubuntu.com hardy Release.gpg
Ign http://archive.ubuntu.com hardy/main Translation-en_US
Ign http://archive.ubuntu.com hardy/restricted Translation-en_US
Ign http://archive.ubuntu.com hardy/universe Translation-en_US
Ign http://archive.ubuntu.com hardy/multiverse Translation-en_US
Hit http://archive.ubuntu.com intrepid Release.gpg
Hit http://archive.ubuntu.com hardy-updates Release.gpg
Ign http://archive.ubuntu.com hardy-updates/main Translation-en_US
Ign http://archive.ubuntu.com hardy-updates/restricted Translation-en_US
Ign http://archive.ubuntu.com hardy-updates/universe Translation-en_US
Ign http://archive.ubuntu.com hardy-updates/multiverse Translation-en_US
Hit http://archive.ubuntu.com hardy Release
Hit http://archive.ubuntu.com intrepid Release
Hit http://archive.ubuntu.com hardy-updates Release
Hit http://archive.ubuntu.com hardy/main Packages
Hit http://archive.ubuntu.com hardy/restricted Packages
Hit http://archive.ubuntu.com hardy/universe Package...

Read more...

Revision history for this message
Scott Kitterman (kitterman) wrote :

Ack from motu-sru.

description: updated
Changed in trousers:
status: New → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into -proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in trousers:
status: Confirmed → Fix Committed
Revision history for this message
Andrea Colangelo (warp10) wrote :

Works fine for me in Hardy.

Revision history for this message
Albert Damen (albrt) wrote :

+1
Verified trousers from hardy-updates (ubuntu0.1) cannot be removed.
Upgrade to hardy-proposed version went fine.
Removal of hardy-proposed version went fine as well.

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

Thanks to all that tested so far.
We still need another positive test, so, if anyone can help us get this into hardy, please step in and test it.

Revision history for this message
Denis Rut'kov (dendron2000) wrote : Fixed

Reporting as fixed. I upgraded to the new version and then I was able to remove the package.

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

Thanks Denis and everybody else for testing.
We have 3 positives and no negatives, can we please move this to hardy-updates?

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

Copied to hardy-updates.

Changed in trousers:
status: Fix Committed → Fix Released
Revision history for this message
chet (chester-f-johnson) wrote :

I was able to start it after a few manual interventions. Shouldn't this be handled by the installer? Ultimately I had to intervene ahead of the install with the following few bits.

#I created /dev/tpm manually with:
mknod /dev/tpm c 10 224

#Then added:
chown ssd:ssd /dev/tpm

#re-run:
/etc/init.d/trousers start

#finally:
/etc/init.d/trousers status

#Ok, tcsd seems to be running. I don't know if it works yet, but it's running.

Now I want to figure out how to get the mozilla libraries to talk to tpm. Working on it.

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.