War story: OpenWRT USB access

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@gmail.com

I WAS going to point out it can be read in the original at http://www.gilesorr.com/blog/archerc7-openwrt.html (with all formatting), but a finger went astray and sent the message on its way. Sorry about that. On 6 January 2015 at 12:15, Giles Orr <gilesorr@gmail.com> wrote:
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@gmail.com
-- Giles http://www.gilesorr.com/ gilesorr@gmail.com

| From: Giles Orr <gilesorr@gmail.com> Thanks! | 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. The diagnostics from mount(8) and mount(2) certainly can leave you in the dark. I've been stuck at various times, cursing mount. | 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! Wow. I wonder how you could have figured this out (except via folklore). Since it is a kernel module that is missing the nls-* modules, the only ways of reporting the problem are: EWHATEVER return code (rather non-specific) or logging (would have to be rate-limited). I guess neither of these were used. Can you fix the web page that gave you the first hints to include the lore about nls-*?

On 15-01-07 01:52 PM, D. Hugh Redelmeier wrote:
| From: Giles Orr <gilesorr@gmail.com> | 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!
Wow.
I wonder how you could have figured this out (except via folklore).
I've configured and built Linux kernels many times, although not in recent years. The reference to NLS reminded me that I saw references to NLS in connection with filesystem support. If I didn't include the right NLS support in a kernel I couldn't mount any (V)FAT/NTFS partitions. I had completely forgotten about this until now. -- Cheers! Kevin. http://www.ve3syb.ca/ |"Nerds make the shiny things that distract Owner of Elecraft K2 #2172 | the mouth-breathers, and that's why we're | powerful!" #include <disclaimer/favourite> | --Chris Hardwick

On 01/07/2015 01:52 PM, D. Hugh Redelmeier wrote:
| From: Giles Orr <gilesorr@gmail.com> | 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!
Wow.
I wonder how you could have figured this out (except via folklore).
Since it is a kernel module that is missing the nls-* modules, the only ways of reporting the problem are: EWHATEVER return code (rather non-specific) or logging (would have to be rate-limited). I guess neither of these were used.
Can you fix the web page that gave you the first hints to include the lore about nls-*?
I remember going through this very same series of events as Giles. It was a few years ago with the TP-Link MR-3020, which I was setting up as a portable PXE boot server. I was going through various parts of the wiki on that, but found the need information was covered in comprehensive document. Ah yes, this looks to be the one. http://wiki.openwrt.org/doc/howto/storage Also relevant, but assumes ext a linux-ish file systems, so doesn't mention VFAT or it's NLS needs. http://wiki.openwrt.org/doc/howto/usb.storage -- Scott Sullivan

On 7 January 2015 at 22:20, Scott Sullivan <scott@ss.org> wrote:
On 01/07/2015 01:52 PM, D. Hugh Redelmeier wrote:
| From: Giles Orr <gilesorr@gmail.com> | 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!
Wow.
I wonder how you could have figured this out (except via folklore).
Since it is a kernel module that is missing the nls-* modules, the only ways of reporting the problem are: EWHATEVER return code (rather non-specific) or logging (would have to be rate-limited). I guess neither of these were used.
Can you fix the web page that gave you the first hints to include the lore about nls-*?
I remember going through this very same series of events as Giles. It was a few years ago with the TP-Link MR-3020, which I was setting up as a portable PXE boot server.
I was going through various parts of the wiki on that, but found the need information was covered in comprehensive document. Ah yes, this looks to be the one.
http://wiki.openwrt.org/doc/howto/storage
Also relevant, but assumes ext a linux-ish file systems, so doesn't mention VFAT or it's NLS needs.
I wanted to confirm Scott's implied thesis, so I installed and uninstalled packages to do a few tests: the NLS files are required for vfat filesystems, but NOT for ext4 or iso9660 filesystems. So an appropriate kmod-nls-* should be a dependency for the kmod-fs-vfat package but not for USB storage in general. But I don't think (didn't research this part) opkg supports virtual dependencies, and forcing a download of all NLS packages wouldn't work ... Okay, it _might_ work, but these are low-resource devices: it might also exhaust all space on the storage media. So it's a pretty thorny problem. -- Giles http://www.gilesorr.com/ gilesorr@gmail.com
participants (4)
-
D. Hugh Redelmeier
-
Giles Orr
-
Kevin Cozens
-
Scott Sullivan