2020-09-30

Ongoing problems connecting a Canon CanoScan 4400F scanner to Linux Mint

This post is about the experiences I've had connecting a Canon CanoScan 4400F scanner to various computers, primarily focusing on my current laptop which, as of the time of first writing this post, ran Linux Mint 19 "Tara" MATE along with Microsoft Windows 10. For context, I am hoping to scan some of my personal & work notebooks for personal archival. I figured that this scanner, which I've had for a long time, does a good job at rendering images, even though it is quite old & slow, so I should continue using it for as long as it continues to work.

I used to use this scanner regularly with my previous laptop, which is an ASUS U30Jc and, when I last ran it regularly, ran Linux Mint 18.3 "Sylvia" along with Microsoft Windows 7; initially when I connected the scanner to the old laptop (a few years ago), it didn't work with Linux Mint out-of-the-box, so I decided to do all scans in Microsoft Windows and then transfer files between partitions later. I stopped using that laptop approximately 2 years ago, and since then until the beginning of this month, it just sat in a box gathering dust. At the beginning of this month, desirous of using this scanner again for the aforementioned purposes, I brought out the old laptop & scanner, but found out that in the intervening 2 years, the damage to the laptop's screen & hinge had worsened, the battery had completely died due to no charging in that time, and the laptop (on either OS) would randomly overheat & shut off. At this point, I now believe that old laptop should be junked.

My current laptop is an ASUS ZenBook UX331UN. I didn't think the scanner would work with it, because it uses USB 1.1, and I remember having trouble getting this laptop to read an older USB device. Just for the heck of it, I decided to connect the scanner to see what happens. Just as with my old laptop, in Linux Mint, the Simple Scan application didn't find any connected scanners. However, I had the idea to run the command "sudo simple-scan" from the terminal. That showed that the scanner was in fact being recognized, so this was probably a permission problem; I also realized that the earlier problem with another old USB device was specific to that device and not a general issue with this laptop reading any older USB device. That said, when I tried to scan a document, I got a window showing the error "Failed to scan: Unable to connect to scanner". Follow the jump to see more.

Looking online for solutions, I tried the command "sane-find-scanner". Its output was as follows.

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.

could not open USB device 0x1d6b/0x0003 at 002:001: Access denied (insufficient permissions)
could not open USB device 0x8087/0x0a2b at 001:005: Access denied (insufficient permissions)
could not open USB device 0x13d3/0x5a09 at 001:004: Access denied (insufficient permissions)
could not open USB device 0x045e/0x0084 at 001:003: Access denied (insufficient permissions)
could not open USB device 0x04a9/0x2228 at 001:006: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0002 at 001:001: Access denied (insufficient permissions)
  # No USB scanners found. If you expected something different, make sure that
  # you have loaded a kernel driver for your USB host controller and have setup
  # the USB system correctly. See man sane-usb for details.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

  # You may want to run this program as root to find all devices. Once you
  # found the scanner devices, be sure to adjust access permissions as
  # necessary.

This confirmed that there was indeed a permissions issue. Running the command "sudo sane-find-scanner" yielded the following.

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.

could not fetch string descriptor: Pipe error
could not fetch string descriptor: Pipe error
found USB scanner (vendor=0x04a9 [Canon], product=0x2228 [CanoScan], chip=GL843) at libusb:001:006
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.
 

This confirmed that with proper permissions, Linux Mint could recognize the scanner. From there, I tested the command "sudo scanimage -L", yielding the output "device `genesys:libusb:001:006' is a Canon Canoscan 4400f flatbed scanner", showing again that the device is being recognized. Furthermore, the command "ls -al /dev/bus/usb/001/006" yielded the output "crw-rw-r-- 1 root root 189, 5 Sep 29 11:22 /dev/bus/usb/001/006".

In truth, I'm not that experienced with fully understanding the conventions for the output of the command "ls -al" with respect to user & group permissions. However, I had read that changing certain permissions could be helpful. Given this, based on what I read online, I ran the commands "sudo adduser $username lp", "sudo adduser saned scanner", and "sudo adduser saned lp" (in that order). However, none of those things helped, as the same errors from before would occur.

Looking further online, I came across this old forum post pointing to this even older wiki page for Ubuntu, both of which I had seen before, claiming that the Canon CanoScan 4400F scanner is not supported under Ubuntu. It was clear that these pages were out of date, as the official SANE list of supported devices (where SANE, which expands to Scanner Access Now Easy, is the name of the software supporting scanners in various Linux distributions) showed that the Canon CanoScan 4400F is now fully supported.

Later, I found this Linux Mint forum thread in which one of the proposed solutions suggested using the command "sudo add-apt-repository ppa:rolfbensch/sane-git" followed by upgrading all packages. This seemed like a promising solution, as the original questioner used a similar version of Linux Mint as I did, and had the exact same scanner; from the posts in that thread, it seemed like the problem was that a recent update to SANE made a huge difference in the ability to read this particular scanner, but it wasn't available in the repositories for Linux Mint 19 "Tara", so it needed to be installed from a third-party repository. I followed the steps and upgraded other packages too. However, not only did this not work, but it completely messed up my installation of Linux Mint 19 "Tara" (while thankfully not affecting my installation of Microsoft Windows 10 — I say "thankfully" only because there are a few utilities for which I do need Microsoft Windows, and I wouldn't want to go through the much greater hassle of recovering a messed-up Microsoft Windows installation or the expense of a new license), in the sense that essential features of the OS wouldn't load upon boot, the cursor would occasionally show as if it was about to show the login screen (LightDM) but that would never happen, I had to do everything from the command line (while dealing with the OS trying but failing to make the GUI work), and I couldn't get networking to work. Furthermore, going into recovery mode and trying various things like repairing GRUB didn't fix anything either.

I suspected that part of the problem may have been that the aforementioned forum thread referred to SANE being at version 1.0.29 from the third-party repository (while the default version was 1.0.27), but by the time I installed it, it was already at version 1.0.31, which may have had problems. Even so, uninstalling all SANE packages and cleaning up the rest of the system didn't help either. This seemed to suggest that my only other option was to completely reinstall Linux Mint. I took the time to make a live USB for Linux Mint 20 "Ulyana" MATE (which I won't review here, because the stability & trustworthiness of Linux Mint over the years and the general lack of novelty in my view in newbie-focused Unixoid distribution experiences have made me less inclined to do Unixoid distribution reviews on this blog, as should be clear by my last review having been of Linux Mint 19 "Tara" over 2 years ago), used the live USB to back up my remaining data onto my external hard drive, and then installed the new OS without touching anything else on the internal drive. It took a couple more hours to restore data, install applications, and configure everything to my liking, but so far, I haven't had any problems, and the OS works well. However, although SANE on Linux Mint 20 "Ulyana" is at version 1.0.29 by default (i.e. with no need for a third-party repository that may break things), plugging in my scanner no longer works at all, as the command "lsusb" shows that it isn't even being recognized anymore, and the other aforementioned SANE-based commands no longer show recognition of the scanner.

At this point, I'm a bit hesitant to try anything else to get the scanner to work; I'd rather just take pictures/scans with my phone. However, I'd be curious if any readers have any other suggestions or explanations for what I experienced.