How to fix a dpkg broken by the Brother MFC-7340 deb driver
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:
Either edit the
/var/lib/dpkg/info/brmfc7340lpr.postrm
script, and comment out the line that is invoking/etc/init.d/lpd start
(orrestart
orstop
), (e.g., just replace it with/bin/true
). Another option is to just placeexit 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.-
Install
lpr
, purge thebrmfc6340lpr
package, purgelpr
: this requires a bit of attention aslpr
conflicts with the default Ubuntu printer spooling system CUPS:a.
sudo aptitude install lpr
(this will removecups-bsd
andubuntu-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)
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.