Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm getting an apt-get error that says

E: The package brmfc7340lpr needs to be reinstalled, but I can't find an archive for it.

The brmfc7340lpr is a printer driver -- it's a local deb file. Doing a dpkg or apt-get purge doesn't work, neither does apt-get install -f .

How do I reinstall a package from a local deb file?

Output:

box-name% sudo apt-get upgrade
[sudo] password for username: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package brmfc7340lpr needs to be reinstalled, but I can't find an archive for it.
box-name% sudo apt-get purge brmfc7340lpr
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package brmfc7340lpr needs to be reinstalled, but I can't find an archive for it.
box-name% sudo dpkg --purge brmfc7340lpr 
dpkg: error processing brmfc7340lpr (--purge):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Errors were encountered while processing:
 brmfc7340lpr
box-name% sudo dpkg --install brmfc7340lpr-2.0.2-1.i386.deb
Selecting previously deselected package brmfc7340lpr.
(Reading database ... 725204 files and directories currently installed.)
Preparing to replace brmfc7340lpr 2.0.2-1 (using .../brmfc7340lpr-2.0.2-1.i386.deb) ...
Unpacking replacement brmfc7340lpr ...
start: Unknown job: lpd
dpkg: warning: subprocess old post-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
start: Unknown job: lpd
dpkg: error processing brmfc7340lpr-2.0.2-1.i386.deb (--install):
 subprocess new post-removal script returned error exit status 1
start: Unknown job: lpd
dpkg: error while cleaning up:
 subprocess new post-removal script returned error exit status 1
Errors were encountered while processing:
brmfc7340lpr-2.0.2-1.i386.deb
box-name% sudo apt-get install -f                                     
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package brmfc7340lpr needs to be reinstalled, but I can't find an archive for it.
box-name% 
share|improve this question
    
You might want to rename your question. It makes your problem sound a bit too generic. You're real question isn't how to reinstall just any local deb, but how to handle a very specific problem. –  andrewsomething Oct 6 '10 at 4:41

5 Answers 5

up vote 13 down vote accepted
+100

You can always (re)install a package using dpkg:

dpkg --install local-file.deb

In order to make a "clean room" installation, you can first purge the package and then install it again:

dpkg --purge brmfc7340lpr
dpkg --install brmfc7340lpr*.deb

You might need to add option --force-depends during purge, if some other package depends on brmfc7340lpr.

Update: Based on the transcript you posted, it seems that the brmfc7340lpr package cannot be (re)installed because its post-removal script is erroring out.

Those files are stored in directory /var/lib/dpkg/info; for each package X, there can be any one of these scripts:

  • X.postinst run after the package has been installed, e.g., to start services provided by the package.

  • X.prerm run before removing/purging the package, e.g., to ensure that daemons provided by the package are stopped.

  • X.postrm run after the package has been removed, e.g., to signal any service optionally using the package that it is no longer available. (For instance, a printer driver package might want to signal cpus/lpr to remove printers depending on that specific driver.)

Now, this brmfc7340lpr package seems to try to (re)start the lpd printer daemon upon removal, which won't work as Ubuntu uses CUPS instead: you should definitely look for a CUPS-compatible printer driver -- see the link in Jorge Castro's answer. (I think this is a bug in the package, as it should not restart the lpd service unconditionally, but just reload it if it's already running.)

The best option to go forward comes from this launchpad answer:

ln -s /etc/init.d/cpus /etc/init.d/lpd

This will effectively (re)start CUPS when the lpd service is instead searched for.

Otherwise, I only see two options, both rather unpleasant:

  1. Either edit the /var/lib/dpkg/info/brmfc7340lpr.postrm script, and comment out the line that is invoking /etc/init.d/lpd start (or restart or stop), (e.g., just replace it with /bin/true). Another option is to just place exit 0 as the first non-comment line in the script. This would be my favorite, but requires a bit of confidence with editing shell scripts.

  2. Install lpr, purge the brmfc6340lpr package, purge lpr: this requires a bit of attention as lpr conflicts with the default Ubuntu printer spooling system CUPS:

    a. sudo aptitude install lpr (this will remove cups-bsd and ubuntu-desktop as a side effect)

    b. sudo aptitude purge brmfc7340lpr lpr (should work now)

    c. sudo aptitude install cups-bsd ubuntu-desktop (restore system to its original state)

share|improve this answer
    
dpkg --install doesn't work –  Roman A. Taycher Oct 2 '10 at 22:47
1  
@Roman What error message do you get? Does --purge first and then --install work? –  Riccardo Murri Oct 3 '10 at 9:57
    
@Roman updated with some specific instructions that might help. I agree with andrewsomething's comment that this no longer looks a generic question and should be renamed. –  Riccardo Murri Oct 6 '10 at 10:27
1  
I ended up renaming lpd to nlpdn temporarily to install it. –  Roman A. Taycher Oct 7 '10 at 11:23

Matt's answer above deleting the /etc/init.d/lpd softlink solved similar problem with broken dpkg after installing a Brother DCP-J715W printer following this installation procedure.

share|improve this answer

Actually, I ran into the same problem. Turns out I followed some irrelevant information and created a /etc/init.d/lpd file as a softlink to /etc/init.d/cups The .postrm script checks for lpd and if it exists, tries to start the service. After I deleted the softlinked lpd file in the init.d directory, the package installation and removal went back to normal.

share|improve this answer

The problem here appears to be that the package has managed to get itself half-installed, but now its maintainer scripts are all faililng (due to being unable to start the lpd service).

You should be able to resolve this by editing the /var/lib/dpkg/info/brmfc7340lpr.postrm file and commenting out (by adding # to the start of the line) the line which is trying to start lpd (or just comment out everything). You should then be able to run dpkg --configure -a to get the package properly installed before you can remove it.

You might need to edit more of the packages maintainer scripts in order to remove the package - they'll all be in /var/lib/dpkg/info/, and they'll be named something like brmfc7340lpr.X where X can be one of preinst, postinst, prerm, postrm.

This is an example of the sort of havoc a poorly written package can wreak.

share|improve this answer

Riccardo's solution should work, I am guessing the problem lies here:

start: Unknown job: lpd

Guess 1: It looks like the deb is trying to restart a service which isn't running and erroring out. Try installing the lpr package from the repositories and then installing the deb and see if that works.

Guess 2: It sounds like you're trying to install a deb from a website for a brother 7340 printer: This page might be a good starting point if you want to split it off into another question.

share|improve this answer
    
/etc/init.d/lpd start start: Unknown job: lpd –  Roman A. Taycher Oct 5 '10 at 3:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.