[GTALUG] War story: OpenWRT USB access

Giles Orr gilesorr at gmail.com
Tue Jan 6 17:15:50 UTC 2015


In honour of Hugh's "war stories," which I enjoy and think/hope I'm
learning from, here's one of my own about trying to get USB access on
an OpenWRT router ... and the dangers of thinking you know what you're
doing.  This is cut and pasted from my blog, so it'


I've just purchased a TP-Link wireless access point. Despite owning
the thing, the model of the item remains somewhat unclear: it's
variously known as the "TL-WDR7500," "AC1750," and the "Archer C7."
Fortunately, what was clear is that it has good specs (including
immensely more memory than the WRT54Gs I've been playing with, and two
USB2 ports), it's very well supported by OpenWRT (mine is the one with
three antennas). This is a version 2, which is also good as that has
more memory than version 1.x. And installing OpenWRT was literally as
easy as downloading
barrier_breaker/14.07/ar71xx/generic/openwrt-ar71xx-generic-archer-c7-v2-squashfs-factory.bin,
logging in to the router's admin interface and then to "Firmware
Upgrade," pointing to the downloaded file, and pressing the "Upgrade"
button. It doesn't get much simpler than that.

Getting OpenWRT to talk to the two USB ports on the device was
unpleasantly difficult. With the default install, dmesgmade it clear
that the insertion of a USB device was duly noted with a log entry
like this:

usb 2-1: new high-speed USB device number 3 using ehci-platform

but there was no further information - perhaps noting whether or not
it was a drive rather than a mouse? Or what device number it was. I
started to work through the information at
http://wiki.openwrt.org/doc/howto/usb.storage . So I installed:

kmod-usb-storage
kmod-scsi-core

which you'd think would be in the default squashfs file for this
specific device as they'd already included kmod-usb-core. I kind of
understand why they didn't include the filesystem types (who knows
which you're going to need?) so I installed:

kmod-fs-msdos
kmod-fs-vfat

It was possible to do insmod kmod-usb-storage and insmod kmod-fs-vfat
after these installs, but I found behaviour was better after a reboot:
I have to assume there's scripts and autodetection that set these up
better than a naked insmodcommand. Still, it's a bit annoying to have
to reboot a Linux device as if it were Windows ...

And finally I installed:

block-mount

which is apparently required to mount any device. Again, shouldn't
that be in the default image?

At this point, dmesg was acknowledging that we have genuine USB
storage devices attached:

usb 1-1: new high-speed USB device number 2 using ehci-platform
usb-storage 1-1:1.0: USB Mass Storage device detected
scsi0 : usb-storage 1-1:1.0
scsi 0:0:0:0: Direct-Access     USB 3.0  USB Flash Drive 1.00 PQ: 0 ANSI: 6
sd 0:0:0:0: [sda] 30883840 512-byte logical blocks: (15.8 GB/14.7 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
sd 0:0:0:0: [sda] Write cache: disabled, read cache: disabled, doesn't
support DPO or FUA
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk

But attempting to run mount /dev/sda1 /mnt/ fails with mount: mounting
/dev/sda1 on /mnt/ failed: Invalid argument, although we do now have a
/dev/sda1 device in the /dev/ folder and /mnt/ is a valid folder.

After hours of tests and googling, I finally stumbled across an
obscure hint from someone who was asking another question but had
"solved the USB problem" ... they had installed the appropriate NLS
("Native Language Support") packages for their area. Seriously? But
I'm willing to try anything by this point, so I installed:

kmod-nls-iso8859-1
kmod-nls-cp437

Test again, and ... I can mount USB storage devices! At least ones
with a filesystem that I've installed, so I guess I need to install
NTFS and/or ext3/4 support if I want to use hard drives.

This solution is both non-obvious and not well documented. I see in
looking back at the OpenWRT documentation that they DO mention the NLS
packages. But I didn't notice at the time and they weren't
dependencies enforced by the package manager, so they got lost. <sigh>



-- 
Giles
http://www.gilesorr.com/
gilesorr at gmail.com


More information about the talk mailing list