2021-05-15
md
Scanning with the Brother DCP-7040 Multifunction Printer in Mint 20.1 or Ubuntu 20.04
python-is-python Pain-> <-Installation de Ubuntu 18.04.1 - Imprimante multifonction Brother DCP-7040
<-Installing the DCP-7040 Scanner in Ubuntu 17.10

It seems each new version of Ubuntu brings additional hurdles that make scanning with the Brother DCP-7040 printer impossible until a fix is found. I ran into this problem when upgrading from Ubuntu 14.04 to 16.04. The same solution that worked in version 17.1 was no longer sufficient when I upgraded to Ubuntu 18.04.3. And now there is an additional problem with Mint 20.1 based on Ubuntu version 20.04.

Table of Contents

  1. Brother DCP-7040 Multifunction Printer
  2. Obtaining Drivers for the Scanner
  3. Installing the Drivers for the Scanner
  4. The Fix
    1. Adding Symbolic Links
    2. Adding a udev Rule
    3. Installing the Missing Library
  5. Reference
  6. In VirtualBox

Brother DCP-7040 Multifunction Printer toc

The CUPS printing system is installed by default.

michel@hp:~$ sudo apt-cache policy cups cups: Installé : 2.3.1-9ubuntu1.1 Candidat : 2.3.1-9ubuntu1.1

As before, the printer is managed by the system without the need to install a driver. Just connect the printer to the computer with a USB cable and turn it on.

Because there was no other hardware printer, the DCP-7040 is selected as the default printer as can be seen in the Printers utility. By double-clicking on its icon, to optionally modify the printer properties, one can also print a test page to verify that everything is working correctly.

Obtaining Drivers for the Scanner toc

If like me you've had this printer for years, you probably have the scanner driver: brscan3-0.2.13-1.amd64.deb (or brscan3-0.2.13-1.i386.deb for 32-bit systems). In that case, go to the next step, otherwise is here is the manufacturer's website from where the scanner driver can be obtained: DCP-7040 Downloads.

Remember to select Linux (deb) and then click on the OK

Scroll down to Scanner Drivers and then click on Scanner driver 32bit (deb package) or Scanner driver 64bit (deb package) depending on the system.

It is necessary to click on the Agree to the EULA and Download, but only do that after a careful review of the license... right?

If, as shown above, a choice is offered, I suggest saving the package to be able to reinstall it in the future if necessary.

Finally, some instructions will be displaye. As is usual, I more or less ignored these.

Installing the Drivers for the Scanner toc

No doubt, the driver can be installed with dpkg as suggested above. Just open a terminal and remember that the utility only works with administrator privileges and adjust the path to the package if necessary.

michel@hp:~$ sudo dpkg -i --force-all Downloads/brscan3-0.2.13-1.amd64.deb

Installation can also be done with the GDebi utility.

Select Open with GDebi Package Installer from the context menu obtained with a click of the right mouse button on the package name in the file navigator.

Click on the Install Package button. No error is reported and sane-find-scanner does locate the DCP-7040. Unfortunately scanimage cannot find the device.

michel@hp:~$ sudo sane-find-scanner # sane-find-scanner will now attempt to detect your scanner. If the found USB scanner (vendor=0x0471 [ ], product=0x060c [BB+ Dongle(e.d)]) at libusb:003:004 found USB scanner (vendor=0x04f9, product=0x01e9) at libusb:003:009 found USB scanner (vendor=0x0a5c [Broadcom Corp], product=0x21f1 [BCM20702A0]) at libusb:003:006 michel@hp:~$ sudo scanimage -L No scanners were identified. If you were expecting something different, check that the scanner is plugged in, turned on and detected by the sane-find-scanner tool (if appropriate). Please read the documentation which came with this software (README, FAQ, manpages).

Obviously, any attempt to scan with the Document Scanner fails.


The Fix toc

The drivers for the scanner have not been updated since 2015. Its files are located in directories that are no longer supported by the SANE interface which manages the scanning hardware in Linux. Previously, an increasing number of symbolic links fixed the problem. Then a udev rule had to be added. Now a needed library has to be installed because it is no longer installed by default.

Symbolic links to the drivers have to be installed in the directories used by SANE since version 17.10 of Ubuntu.

michel@hp:~$ sudo ln -sfr /usr/lib64/libbr* /usr/lib/x86_64-linux-gnu michel@hp:~$ sudo ln -sfr /usr/lib64/sane/libsane-brother* /usr/lib/x86_64-linux-gnu/sane

Adding a udev Rule toc

A new rule for the device manager, udev, must be created. With this rule, a node (/dev/usb/lp0) belonging to the scanner group will be created when a USB device with an idVendor of 04F9 is plugged in.

michel@hp:~$ sudo nano /etc/udev/rules.d/59-udev-local.rules

# Brother brscan devices ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="*", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"

Installing the Missing Library toc

The Brother drivers use the libusb-0.1 library, which has been supplanted by libusb-1.0 for at least a dozen years. Even if the old library is no longer included in the most recent version of Ubuntu, it remains available in the repository from where it must be downloaded.

michel@hp:~$ apt install libusb-0.1-4

With these three steps the scanner can be used. Note that the udev service must be restarted using the udevadm for the changes to take effect, but I prefer to restart the system completely.

The Brother network printer configuration file /usr/bin/brsaneconfig3 can be deleted as it contains no information about the DCP-7040.

Reference toc

The reference for these fixes is a page called sane_Troubleshooting in the Ubuntu Community Help Wiki. The section entitled The symlink and udev tricks explains how changes to the directory structure containing third-party drivers are the source of the problem. The next section, Known Workarounds / Brother, contains the first two steps described above. I followed one of the tips at the very beginning of the wiki when these two steps proved insufficient with the latest version of Ubuntu.

michel@hp:~$ SANE_DEBUG_DLL=5 scanimage -L ... 21:19:10.781999] [dll] load: searching backend `brother3' in `/usr/lib/x86_64-linux-gnu/sane:/usr/lib/sane:/usr/lib64/sane' [21:19:10.782009] [dll] load: trying to load `/usr/lib/x86_64-linux- gnu/sane/libsane-brother3.so.1' [21:19:10.782038] [dll] load: dlopen()ing `/usr/lib/x86_64-linux- gnu/sane/libsane-brother3.so.1' [21:19:10.782247] [dll] load: dlopen() failed (libusb-0.1.so.4: cannot open shared object file: No such file or directory)

That is how it became evident that the old libusb-0.1 had to be installed.

In Virtual Box toc

When translating this post, which was originally written in French, to English the scanner package was installed in a Mint 20.1 virtual machine (VM) running on VirtualBox. The process was almost the same in the VM as it had been on the real hardware. Downloading the scanner driver from the English language Brother US support site was a little simpler as there was no need to choose a language as described in the original post. However, contrary to what was said in section 1, the printer was not automatically installed and it had to be installed manually .

This is easily done. From the main menu select the Control Centre and then click on Printers in the Administration group. The following window will pop up.

Click on the Add button. A message about a search being conducted will pop up for a few seconds and then the following window will be displayed.

The printer was in the list of devices, so it was simply a matter of selecting it as shown above and then clicking on the Forward button.

Finally clicking on the Apply button completed the installation.

As stated at the top of the section, installing the scanner driver was very much the same in the VM as it had been previously on the desktop. When performing a first scan, Document Scanner did find the scanner,

but it seemed incapable of reaching the scanner after the Scan button was pressed.

The problem partially resolved itself after stopping the virtual machine, updating the virtual machine and rebooting the desktop. To be honest, scanning from the VM is not always successful, but I would hazard a guess that the problem has to do with passing through the USB connection to the VM more than with the Brother driver. Since I don't really need this functionality, I will not be investigating this any further.

python-is-python Pain-> <-Installation de Ubuntu 18.04.1 - Imprimante multifonction Brother DCP-7040
<-Installing the DCP-7040 Scanner in Ubuntu 17.10