Showing posts with label usb. Show all posts
Showing posts with label usb. Show all posts

Wednesday, November 8, 2023

portable (usb) disk recovery

We've nearly all dropped an important HDD on the way to the airport or work and know the (sinking) feeling later that day when data can't be accessed. It's expensive, slow, and intrusive to have data recovered professionally.

So we've mostly switched to SSD's, but even these are of questionable1 reliability.

levels of loss

  • level of destruction -- unable to work at all, unable to be detected, unable to boot
  • type of drive SSD, USB, SDC, HDD
  • file system (ext2, ntfs, reiser, etc)

The easiest thing, the thing we'd like to do, is reset the dirty bit, or re-establish a corrupted MBR, and be able to plug our drive back in for normal use. Then we find that each crash can have a different level of complexity -- the dirty bit is often possible, the corrupted boot sector typically not.

Some of our luck in a crash also has to do with the file system. If a person has an HDD formatted in NTFS, then it needs a bootable NTFS sector even if it's just a portable data disk.

expectations: think data first, access second

The data crash reveals the drive to be unreliable; if I greedily aim to re-establish a boot sector, I might lose the data if the boot sector attempt fails. Check to see if the data is intact and shoot for that first, even if it's more time consuming than restoring access through a repaired boot.

software: testdisk

At the start of the fail I cycled through all my disk software, fdisk, cfdisk, gparted, ntfsfixbootand best so far seems to be testdisk. Also might take a look at wipefreespace on the AUR.

Data Recovery with Test Disk (18:22) oswyguy, 2018. This poor guy needs sunlight, but a superb TestDisk video beginning about 7:30.

WD Passport 1000GB, (1058:0748)

I employed the usuals to gather info and attempt repairs, cfdisk, fdisk, gparted, and from the AUR, . None of them did anything

pacman -S testdisk

This retrieved files, but didn't repair the MBR index.

nope

Zero
pacman -S ntfsffixboot
No
pacman -S ntfsfix

1Consider this SSD drive article, from which I quote:

According to the Western Digital's firmware update page, the impacted products are from the SanDisk Extreme Portable SSD V2, SanDisk Extreme Pro Portable SSD V2, and WD My Passport SSD line, and lists the models as follows:

SanDisk Extreme Portable 4TB (SDSSDE61-4T00)
SanDisk Extreme Pro Portable 4TB (SDSSDE81-4T00)
SanDisk Extreme Pro 2TB (SDSSDE81-2T00)
SanDisk Extreme Pro 1TB (SDSSDE81-1T00)
WD My Passport 4TB (WDBAGF0040BGY)

And these drives are still best-sellers on Amazon, so suppliers are being shady AF. SSD's rely on firmware but still must be properly constructed, of course. HDD's were mostly just a hardware situation.

Tuesday, August 8, 2023

android usage - usb-tether

Suppose a person wants to cord-cut and obtain their internet access entirely from a tethered phone. Some of other posts have explained the configuration, but what about the data-plan? This is made somewhat inscrutable by the provider, so that a person tends toward ordering a larger plan. Let's look at the T-Mobile case.

somewhat mysterious

This is the information from the website. How much data do I use every month. At mid cycle am I at 22.28G usage, 25.08G usage, or 47.36G usage?

An hour on the 611 line with T-Mobile: the larger number, 25.08G, includes both hotspot and "voice" usage, this is my total number mid-cycle. T-Mobile uses "voice" to mean data they provide that is untethered. So "voice" isn't actually voice, it is eg., usage when driving around looking up the nearest gas station on one's phone. The 22.28G is the tethered "hotspot" usage: tethered to a laptop, a vehicle's Android connection, etc, and is the largest portion of the entire 25.08G. The untethered "voice" usage is 3.2G, the difference between the two larger numbers.

inflated values

Based on this, we can see I send about 3000 MMS/SMS a month, which would be about 100 per day. This is an overstated amount. I probably send about 25 texts per day. Similarly, they have me at about 1000 minutes of phone a month (33 mins daily) another overstatement, though not as grossly made.

But it's data that really matters to a cord cutter, b/c this is never unlimited. If my plan includes "40G hotspot", and I know I never use wifi, I just use tethering, then what is the 22.28G I have used? Is it part of the overall 25.08G used?

options online

The way we view it is important to our plan. It appears we need but how much more? Our bill will be roughly $115 per month if we cut the cord and need 100GB, or $90 per month if we can cut the cord and only need 50GB per month. But roughly, we can say to cut the cord, our costs are $100 per month phone and internet. For the gov't to track us.

Thursday, April 9, 2020

2016 Latitude E7270 6600U Install

Safety: BitLocker (encryption), UEFI, Fingerprint. Uninstall packages:

# pacman -Rsn

NB:Headphones (also hands-free) Mijiaer/Langsdom JM26 3.5mm earbuds


Problem: your situation requires reliable Zoom (or other) teleconferencing but you're not a first responder, professional athlete, nor an investment banker. If you can carry one (2.74 lbs), 2016 carbon fiber, non-touch screen version Latitude E7270's are available on EBay for about $250 delivered. These are not display showoffs, w/ 12.5" screens, and only integrated Intel HD Graphics(520), but they are solid business grade: 16 GB DDR4, i7 6600U Skylake w/100Mhz FSB, and 1080P webcam: they will do the job reliably. Think 256G PCIe3 SSD, Arch Linux and IceWM: for that $250, one has a laptop which will teleconference, plus audio might be edited -- a single 3.5mm combined jack. Watching movies or editing pics on a 12.5" however, is suboptimal.

upgrade/replacement notes: Please scroll down to bottom for sections on replacement, esp batteries and SSD. The laptop takes an M.2 card style NVME SSD so its a little complicated.

Packaging appeared good, visual inspection was clean and the charger and battery tests went well (1 hr). The subsequent Arch installation was an additional 4 hours.

bootable USB :: 20 mins

  1. Download the latest ISO. Necessary or the signature keys might error during install.
  2. # fdisk -l find the drive name, eg /dev/sdc OR...
  3. $ lsblk | grep -i sd
  4. # cfdisk /dev/sdc, delete all partitions and write, exit
  5. # dd bs=4M if=/home/foo/Downloads/archlinux-2020.03.01-x86_64.iso of=/dev/sdc oflag=sync The sync flag takes a little longer but you can be sure it will be properly on the usb.

BIOS shifts :: 15 mins

Two equally important adjustments must be made in BIOS: 1) booting from USB for install and, 2) when booting from HDD, non-windows, non-secure, booting and no disk encryption.
  • Enter BIOS, press F12 repetitively during power up.
  • Secure Boot Enable -> "Disabled"
  • General -> Advanced Boot Options -> "Enable Legacy ROM's"
  • General -> Boot Sequence -> Enable "Legacy"
Also, I noted I luckily had the latest BIOS version 1.20.3 (7/2016) but there's a process if not. Link: configure BIOS for USB boot :: update the BIOS

GRUB/safety problem :: 15 mins

Currently (2020) however, GRUB seems finnicky when using a GPT ("globally unique identifier partition table") disk. So, in addition to eliminating EFI, I convert all GPT to MBR. This requires three applications: cfdisk (delete all partions), gdisk (to detect GPT and revert to MBR) and fdisk ("fdisk -t" to create an MBR. 0x04.)
  1. # fdisk -l determine the drive name, eg /dev/nvme1
  2. # cfdisk /dev/nvme1, delete all partitions, which eliminates EFI. Write this partitionless drive and exit
  3. # gdisk /dev/nvme1 note whether GPT is present and MBR protected. Mine notes both and that "using GPT". I selected "x" for "expert command", then "z" to zap the entire GPT structure, which was confirmed. Then it asked if I want to "Blank out MBR"?, to which I replied "yes". When i then retried # gdisk /dev/nvme1, all (MBR, BSD, APM, and GPT) were not present. This is correct, but "x,z,y" again to be sure.
  4. # cfdisk /dev/nvme1, select DOS label, and proceed. The main is a linux (83) nvme1p1 and a linux swap (82) nvme1p2,
The only real question is whether to make multiple partitions for different parts of the OS. For this example, I've put them all in a single partition.

base CLI (runlevel 2) configuration :: 20 mins

# mkswap /dev/nvme1p2
# swapon /dev/nvme1p2
# free -m [check swap is on]
# mke2fs /dev/nvme1p1
# mount -rw -t ext2 /dev/nvme1p1 /mnt
# mkdir /mnt/etc
# genfstab -p /mnt >> /mnt/etc/fstab
# pacstrap /mnt base base-devel linux linux-firmware
# arch-chroot /mnt
# ln -s /usr/share/zoneinfo/US/[zone] /etc/localtime
# mkinitcpio -p linux
# passwd
# pacman -Syu grub dhcpcd
# mkdir /boot/grub
# grub-mkconfig -o /boot/grub/grub.cfg
# grub-install /dev/sda [no partition]
# exit
# reboot

go back to install disk

Let's say I forget to # pacman dhcpcd after pacstrap, and now I'm booting straight off the drive. It's extremely difficult to setup even a wired connection, let alone WiFi with just the tools in # So go back to arch-chroot and install from there.
# mount -rw -t ext2 /dev/nvme1p1 /mnt
# arch-chroot /mnt
# pacman -Syu dhcpcd wireless-tools
# exit
# reboot
Similarly, you want to pull window manager menus and so on prior to starting X the first time...
$ mkdir media
# mount -rw -t ext2 /dev/nvme1p1 /media
$ cd media
[do whatever operations]
# umount /dev/nvme1p1

locale :: 0 mins

I don't set a locale, but here's some information if interested.

useradd :: 5 mins

User 500, name "foo", home directory of "foo", using bash shell.
# useradd -G wheel,lp,audio -u 500 -s /bin/bash -m foo

aur :: 30 mins

Used to be so simple with yaourt, however it hasn't been maintained since 2018. The best option now is yay, built on the 300Mb behomoth go dependency. This first part is the same:
# nano /etc/pacman.conf
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

# pacman -S go wget git base-devel
$ git clone https://aur.archlinux.org/yay.git
To build and install they do it through fakeroot, which looks at the god-damned sudoers file. Unfortunately, editing sudoers is done through the visudo command, which every stinking website tells users not to circumvent, and which uses the ridiculous VIM editor. Here's the workaround...
# nano /etc/sudoers
foo ALL=(ALL) ALL
... and once that's done...
$ cd yay
$ makepkg -si
If you have to hand install the TAR.XZ, use pacman with a "U" flag. The "U" flag has pacman looking into the current directory instead of out over the Net. Prior to building any AUR helper (yaourt, aurman), you'll need to first build "package-query", also from the AUR.
# pacman -U package-query[version]tar.xz
And then the same with yaourt thereafter.

limit journalctl size :: 5 mins

Systemd will log GB's and GB's of data if not limited
# nano /etc/systemd/journald.conf
SystemMaxUse=200K

X install :: 20 mins

These Dells have the Intel integrated graphics 945GM; the correct xf86 driver is the Intel VA driver.
# pacman -S xf86-video-intel
This driver now uses DRI3 as the default Direct Rendering
Infrastructure. You can try falling back to DRI2 if you run
into trouble. To do so, save a file with the following
content as /etc/X11/xorg.conf.d/20-intel.conf :
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "DRI" "2" # DRI3 is now default
#Option "AccelMethod" "sna" # default
#Option "AccelMethod" "uxa" # fallback
EndSection
# pacman -S xorg-server xorg-apps xorg-xinit xorg-xrandr
If you scroll down this Arch page discussing Xorg, we can see that we'll want the mesa for Open GL and lib32-mesa for older apps. Also, Intel chips, as we know (scroll down to about item 13), do not support VDPAU, viz:
"Intel Embedded Graphics Drivers do not support VDPAU. VDPAU stands for video decode and presentation API for UNIX*. VDPAU is an open source library and API originally designed by NVIDIA that provides an interface to support hardware-accelerated video decode."
... and so Intel sez libVA is correct. More specific to Arch, there's additional information in their video acceleration page, if you like to read. The only problem with the VA-API is it can't decode MP4 and FLASH containers, but it does all other common formats, and all codecs, including H264 and the new VP8 and 9. I just use MKV and AVI containers and set the VLC codec to VA (instead of its default VDPAU). In spite of inefficiencies on the Intel hardware, some may wish to overlay VDPAU functionality onto their Intel chip, which is an installation beyond this post. If a person does that, any mistakes will defeat X working properly -- no harm, just revert to runlevel 2 and reconfigure until Xorg is working well. FYI, one of the tweaks I've seen for VIDPAU overlaid onto VA, is adding "export VDPAU_DRIVER=r600"in one's ~/.xinitrc file. Anyway, back to pure libVA...
# pacman -S libva libva-intel-driver libva-utils libva-mesa-driver
... then check the install with "$ vainfo".

window manager :: 10 mins

On an old system, I don't waste memory with display managers, instead I login and "startx" from runlevel 2. I like Ice Window Manager, a light interface with simple text configuration, wallpaper, and menu files (look inside ~/.icewm ). Efficient on older systems: perhaps 150M usage after logging-in, connecting to network, and starting X. In Arch, the template files are inside /usr/share/icewm/, including the themes. See the main Arch file.
# pacman -S icewm
$ cp /etc/X11/xinit/xinitrc .xinitrc
$ nano .xinitrc
exec dbus-launch icewm-session
$ startx
I also looked here to get the names of additional drivers, for example to solve the pesky touchpad problem. I couldn't stop the Dell touchpad with synclient TouchPadOff=1 until I # pacman -S xf86-input-synaptics.

QT or Gtk

I used to stick with one or the other to keep a smaller install and shorter update. Nowadays both seem necessary. I prefer GTK (except gvfs), but VLC requires QT. QT is about 400MB, and typically pulls in PyQT. But since I'm a fan of VLC ... QT became my baseline API.
# pacman -S qt4
However, you're going to see that udiskie (to avoid gvfs) brings in about 80MB of shit, including basic Gtk.

sound

I avoid PulseAudio as much as I can. See my post from 2016. ALSA is now built-in, so that all that's required is alsamixer in order to control the sound levels (unmute, etc)
# pacman -S alsa-utils
Done.

rc.local

A consolidated place for random startup shit too lazy to configure individually. It's like an initrc in X, but for runlevel 3.
# nano /etc/rc.local
#!/bin/bash
wpa_supplicant etc
dhcpd etc
exit 0
# systemctl enable rc-local.service should make it happen next boot, but you also have to create the service file before enabling it.
# nano /etc/systemd/system/rc-local.service

# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

replacement info

batteries - 55wh(4 Cell) LPD-J60J5 $30

Li-Ion, power is 7.6VDC. These go bad. When I first opened the case, the battery was swollen and pushing against the case cover. The charging circuit is built-in, which might have failed. Or the battery has a place for heat paste on the bottom, which might not have been seated. If only there were a LiPo which fit it for less than $100. Replacement Li-Ion J60J5 costs $25 (2022) but 2.5 bucks tax, then thermal paste and cleaner another $15. We're looking at $40+.

After install, there are several ways to check the battery, but this is perhaps the easiest way:

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0

Thermal paste application (8:48) Laptop Performance Tricks, 2019. Appears this is solution video with all relevant tips. Vid is for a Dell G7 rather than the Dell E7270.

storage: ssd pcie $30

Nowadays, we're not dealing with 2.5" SATA HDD's that spin-up. The installed card is a 256Gb NVMe PCIe Gen3 x 4, so 2 lanes are not used. That's because PCIe bus (FSB) is standard 100Mhz, but is discount model with 2 lanes. It's upgradeable to 1TB for probably $70, and to simply replace the 256Gb Gen3 about $30.

Sunday, December 29, 2019

wine -- can we do this better?

Wine works but has been useless to me since its creation. Each app requires a custom installation -- that's fine -- but when we start the actual app with the "wine" command preceeding the EXE file, Wine "updates"(overwrites) the custom settings, and one receives the same suboptimal performance as if customization hadn't been accomplished in the first place. Because it's been entirely eliminated. It's essentially a repeat of the old problem we used to have with Python when running "pip" instead of a package manager. But Wine doesn't ask first.

Summary of iRoot steps

See backstory below for the steps regarding this USB connected device.
  1. Download PC version from website.
  2. Enter the ~/.wine and delete all files
  3. Prepare Wine and .NET using winetricks
    $ mkdir .wine/Win7
    $ WINEARCH=win32 WINEPREFIX=/home/$USER/.wine/Win7 winetricks dotnet452 vcrun2010 corefonts wininet
  4. Unzip the downloaded installation file somewhere, eg ~/.wine/Win7install.exe
  5. Install the iRoot program using wine.
    $ WINEPREFIX=/home/$USER/.wine/Win7 wine explorer /desktop=somename,720x480 "/home/$USER/.wine/Win7/iRoot_1.8.9.21144_cid1005.exe"
  6. Connect the tablet via USB and be sure screenlock is off, and data transfer enabled.
  7. Run the program, using wine. You could make an iDesk icon or menu entry with same info.
    $ WINEPREFIX=/home/$USER/.wine/Win7 wine explorer /desktop=somename,720x480 "/home/$USER/.wine/Win7/iRoot/1.8.9.21144/Root.exe"

Summary of audio editor steps

  1. $ mkdir .wine/Win7/audio
  2. $ cp audio.exe .wine/Win7/audio/audio.exe
  3. $ WINEPREFIX=/home/$USER/.wine/Win7 wine explorer "/home/$USER/.wine/Win7/audio/audio.exe"

backstory

For me, there are four applications with operating system complexity inside Linux use: Linux itself, LaTeX, Wine, and Blender. Plus perhaps the only slightly lesser issues of ALSA audio and CUPS printing. This time it was Wine, due to the need for two Windows PC apps, one for audio editing, another (iRoot) for rooting a cheap tablet. The former was straightforward, but the tablet rooting app was apparently developed using the .NET framework, and requires a USB connection to the tablet. As is well known, even in Windows proper, .NET dependent USB connections are horrible. Then add Wine complexity. The plan was to work through the errors to get a good Wine installation, then do the same thing for a good application installation.

part 1 :: wine (12+ hrs)

Strategy: follow someone else. Bracing for turbulence and a lost weekend, I downloaded the iRoot PC app and began Googling. The closest I could find was the Garmin Nüvi PC application for updating maps. It is .NET framework dependent, with a USB connection. Chris Titus has a helpful video (11:45) and a helpful web page on the Garmin. I followed his steps, only with the iRoot app, but wasn't successful. It's important to be specific about failures, the USB device was detected but then...
... and the tablet did not appear in the iRoot app, in spite of being detected beneath the hood.

directory structure

Unless two applications can run on the same version of Windows, each application requires a separate installation of windows. I put them in folders as seen here.
That is, although I keep wine and winetricks in the system, I completely eliminate all their files inside of /home/foot/.wine/. I then add directories for each version of Windows required. Based on my iRoot application, and Chris Titus' stuff above, I knew I wanted to work it into Windows 7.
$ mkdir .wine/Win7
$ WINEARCH=win32 WINEPREFIX=/home/$USER/.wine/Win7 winetricks dotnet452 vcrun2010 corefonts

installation errors

During the .NET (dotnet452) portion of the installation, several files are downloaded from Microsoft. A status box (left) also appears, and displays the error that I lack "Windows Modules Installer Service" (C:\Windows\servicing\TrustedInstaller.exe). I sought this executable afterward, but could not locate it. Based on the terminal, it appears the lack of this file prevented a certain level of software use.
0060:fixme:service:QueryServiceConfig2W Level 6 not implemented
I hoped to perhaps remedy this via the cleanup tool, once the Win7 was in, the next step.
$ WINEARCH=win32 WINEPREFIX="/home/$USER/.wine/Win7" winetricks win7

registry cleanup

This doesn't have to be run, but I was curious about it. With Windows 7 in, I placed the cleanup tool just inside the Windows 7 installation, in /home/foo/.wine/win7/drive_c/. It should look like this:
I had read about the (.NET framework cleanup tool) and wanted this operating. Cleanup would also have to be placed in any other installed folders -- XP, 10, whatever -- in which a person wanted to check their .NET install. The prefix is the OS folder, and then I gave it a 720x480 desktop to run inside, in case the Cleaner requires one.
$ WINEPREFIX="/home/$USER/.wine/win7" wine explorer /desktop=cleaner,720x480 "/home/foo/.wine/win7/drive_c/cleanup_tool.exe"
As it ran, the Cleaner, among many thousands of errors it revealed, noted the lack of level 6 implementation. Here are some of the error notifications...
Level 6 is not implemented.
HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\Components key is not present.
No product/patch data was found.

part 2 :: application (12+ hrs)

First run indicated some missing pieces from my installation
0054:err:wininet:open_http_connection create_netconn failed: 12029
... it appeared the program needed to dial home. So, I added the missing wininet.
$ WINEARCH=win32 WINEPREFIX="/home/$USER/.wine/Win7" winetricks wininet
Here's more of the garbled mess that popped up. The program itself indicated a bug.

dead ends

A collection of various things I tried and which were apparently irrelevant.

lack of Windows Module Installer Service

During .Net (aka. "dotnet452") installation, if the installer is unable to find the Windows Module Installer Service,then it provides an error window. There is a noticeable effect downstream from this.
For example, error messages will appear if one attempts to attach a USB device via USB. This is because Level 6 of the .Net installation was not met. The USB device will successfully be detected, but the device will not be able to send file information or be written to. The complaints will take a form similar to...
0060:fixme:service:QueryServiceConfig2W Level 6 not implemented
The situation has been encountered by others, for example as documented here.

linux library checks - AUR

One of my dead ends was checking the Linux libraries. Mine turned out to be fine, but I read of them being a problem for others and having similar problems. Eg, a Battlenet article noted some missing Linux libraries had led to fails. The only one I thought might be mine was hal, so I checked for it...
$ ldconfig -p | grep hal
... returning nothing. Hal is in the AUR,so it has to be built.I'd want the 32 bit version. My luck, yaourt is no longer functioning.
$ yaourt -Ss hal
package-query: error while loading shared libraries: libalpm.so.11: cannot open shared object file: No such file or directory
$ ldconfig -p | grep alpm
libalpm.so.12 (libc6,x86-64) => /usr/lib/libalpm.so.12
libalpm.so (libc6,x86-64) => /usr/lib/libalpm.so

... so it's annoying as heck. Time to move to yay, I suppose; yaourt getting just too unmaintained -- I'm not going to create softlinks to libraries and such. Buh-bye...

yay build

# nano /etc/sudoers
foo ALL=(ALL) ALL
... otherwise the build will fail. Then...
$ cd Downloads
$ git clone https://aur.archlinux.org/yay.git
$ cd yay
$ makepkg -si

Thursday, March 8, 2018

[solved] USB drive mounting as read-only

1. 80% fix

# pacman -S ntfs-3g

2. 10% fix

Occasionally, the FS correct, but a file corruption causes the dirty bit to be set. File splice or other permission errors will occur attempting to copy. Once that happens, you gotta fsck, the drive, but what is the drive reference? Plug in the drive and then...

# dmesg |tail

...then take the resultant drive number (eg, /dev/sdc1) and...

$ dosfsck /dev/sdc1

...or if not VFAT

$ fsck /dev/sdc1

3. 10% fix

This one is really annoying and began in 2020 with the latest versions of udiskie. Udiskie mounts the USB into /run/media/foo/, using the full UUID of the USB. And it's root only. It looks like problem 1 above but a check on the logs shows that it's attempting to mount an ext2 fs using ext4. Udiskie no longer mounts ext2 so it "mounts ext2 using an ext4 system" which it can only do read-only. This pisses people off.

$ journalctl -r
EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem EXT4-fs (sda1): warning: mounting unchecked fs, running e2fsck is recommended

...but yet you know it's an e2 fs...

$ df -Th
/dev/sda1 ext2 3.6G

...so WTF?

[Fail 1 ] doubled down on fs type..

$ mke2fs -t ext2 /dev/sda1

[Success] after 4 days wasted, I gave up and put VFAT fs. I mean, udiskie is going to mount with ext4 no matter what and I sure AF am not going to format a USB drive, or anything else under the sun, with ext4. So just format with something ext4 compatible like VFAT.

$ mkdosfs /dev/sda1

Problem solved. Mounts and reads as user.

HOWEVER... if you do run this version be sure to run either dosfsck, or fsck.msdos on the drive, or you may further corrupt the drive.

Saturday, February 6, 2016

[solved] mount some unknown usb

In the current era of systemd, some of our old friends like udevadm aren't independent apps, but are elements of systemd. We used to be able to identify cranky (eg, doesn't automount) usb items simply with udevadm -monitor. We'd # udevadm -monitor, plug in our usb item, and read the information. Then we could craft a suitable mount, or whatever.

Currently, we do our system monitor as:
# udevadm monitor --environment --udev
After plugging in, say a drive, Ctrl-C out of the new udevadm as quickly as possible since it floods the terminal history with polling updates. Then just scroll-up a bit to get the drive name, eg /dev/sdd. Create the appropriate mount.

A standard mount might be
# mount /dev/sdd -o rw /somefolder

file ownership

Sometimes even udiskie will mount a USB incorrectly and it will be read-only. Simply # umount /dev/sdc1(or whatever), and then remount it with the following.

# mount -o rw,uid=1000,umask=000 /dev/sdc1 /home/foo/mnt

Tuesday, June 23, 2015

extra laptop storage - hdd in optical slot, notes: external usb, thunar

Backups are a pain. They can be managed more easily in a laptop by purchasing a $10 drive caddy (photo) into which a backup SATA HDD can be placed.
Once the HDD is in the caddy, the laptop's DVD drive is removed, and the caddy (with the HDD drive) goes into its place.

software steps

First, determine the names of drives in your system. This is easily done with, say, fdisk -l. Using the name of drive, add a line for it in fstab:
# fdisk -l
[suppose result is "sdb1" for caddy drive]

# nano /etc/fstab
/dev/sdb1 /home/media ext3 rw,relatime 0 1

Now the drive will automatically mount each time the system is booted. Once mounted, the drive is an available repository for back-ups. Files can be transferred between the drives using a file manager, or a user might implement a backup schema or program (such as Rsync, eg. with chron).

Note: if you decide to put the optical drive back in the slot, comment the fstab entry for the removed HDD before rebooting, otherwise, it will seek the drive and take several minutes to boot.

external (usb) drives

For the setup above, no special applications are necessary. However, if one is going to use a USB stick or drive, the typical rule applies: you will need to install udisks2, fuser, gvfs or similar bullsh*t, if you don't want to deal with manually mounting these or moving in and out of root. Such applications cause a permission kludge, and may have memory hogging notification daemons that continually poll your system (I dislike .gvfs, notification-daemon is slightly better),but there's little doubt some permutation of these is necessary you're copying to a thumb drive or other USB block device regularly, and want to use a GUI file manager in user-space, without sudoing-up and some CLI skills. In Arch, I use udisks2 in tandem with udiskie (for userspace). Taken together, these are 20Mb:
# pacman -S udisks2 ntfs-3g parted dosfstools udiskie
With these, I can mount any format USB drive, including HFS (Mac).

udisk2 and udiskie note

Links: manual policykit/udiskie config :: systemctl udiskie config
This is a useful app for avoiding fuser, samba, .gvfs, and some others, not needed on stand-alone systems, but it requires configuring. First be sure you're in group "storage" then, for udisks2:
# nano /etc/polkit-1/rules.d/50-udisks.rules
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
var permission = {
// only required for udisks2:
"org.freedesktop.udisks2.filesystem-mount": YES,
"org.freedesktop.udisks2.filesystem-mount-system": YES,
"org.freedesktop.udisks2.encrypted-unlock": YES,
"org.freedesktop.udisks2.eject-media": YES,
"org.freedesktop.udisks2.power-off-drive": YES,
};
if (subject.isInGroup("storage")) {
return permission[action.id];
}
});
Then, for udiskie, somewhere near the end of .xinitrc, but ahead of dbus activation:
$ nano .xinitrc
udiskie &

Thunar note

Supposing this is your file manager for and you've connected a USB drive, you'll also need to install thunar-volman, and to set the permissions (see below) for Thunar to display it.


Select at least the two mounting options I've checked above. The path to this dialog box is: Edit, Preferences, Advanced (tab), Configure.

Finally, if you did install .gvfs, don't forget to exclude it from any dynamic backups or you're in for a world of pain.

Tuesday, October 29, 2013

primefilm 7250u scanner - arch/fuduntu (05e3:0145)

Links: CLI scanning w/scanimage :: sane-config options :: extracting .nal from Windows driver :: deeper on the .nal

This is a c. 2013 Genesys/Pacific Image Electronics scanner -- oth

Relevant folders: 1) dev/bus/usb [device]; 2) etc/sane.d [daemon only]; 3) etc/udev/rules.d [custom rules]; 4) usr/lib/sane [backends]; 5) usr/lib/udev/rules.d [default rules]; 6) usr/share/sane


A friend recently purchased a Primefilm 7250u to scan old slides. Closed-source Windows and Mac software came with it. Difficulty: No software for Linux, not even Vue-Scan. Fuduntu has no access to repos. A kludge of interacting files, as one can see from the folders above.

The most important steps

The first two steps need to happen in order. We need to be sure, 1) the scanner is detected and, 2) the correct backend is called. For detection, /usr/lib/udev/rules.d/49-sane.rules, or (user-created) /etc/udev/rules.d/[custom].rules must contain the vendor ID. These files then call the correct backend(s).

hardware detection

Sane-find-scanner does not check the backend, it simply verifies the scanner is connected and that it's vendor ID is one of the rules files. This is hardware detection, pure and simple. Scanimage does both detection and backend pointing but, unfortunately, it will fail with the same message whether hardware detection fails or backend fails. Accordingly, even though scanimage must be working smoothly in order to use GUI frontends (eg Xsane), sane-find-scanner is very useful to troubleshoot hardware detection.
$ sane-find-scanner
...found USB scanner (vendor=0x05e3, product=0x0145) at libusb:002:009

$ 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).
Success with hardware. However, scanimage -L subsequently failed, meaning the backend is misconfigured or missing. To solve this, we have two options -- modify the rules or force scanimage to call backends (stored in /usr/lib/sane) using CLI switches.

software

Before writing a rule, we'd like to see how the kernel names the device, ie, what is the /dev device node's name? I typically use dmesg but, in my friend's system, dmesg was not supplying it. Also, his /dev folder had no "usb" folder. I located the usb folder /dev/bus/usb...
$ ls /dev/bus/usb
001 002 003 004 005 006
Opening /dev/bus/usb/002/ revealed "009". Taken together, these correlate with lsusb:
$ lsusb
Bus 002 Device 009: ID 05e3:0145 Genesys Logic, Inc.

vuescan - 235Mb

not sure this will work wihtout removing hplip

$ yay -s vuescan
1 aur/vuescan-bin 9.7.82-2 (+42 0.50)
A powerful proprietary scanning tool developed by Hamrick Software

udev rules

Only if need be. I had enough to go after the necessary /etc/udev/rules.d information:

# udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/002/009)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device '/devices/pci0000:00/0000:00:12.2/usb2/2-2':
KERNEL=="2-2"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{bDeviceSubClass}=="ff"
ATTR{bDeviceProtocol}=="ff"
ATTR{devpath}=="2"
ATTR{idVendor}=="05e3"
[snip]

looking at parent device '/devices/pci0000:00/0000:00:12.2/usb2':
KERNELS=="usb2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
[snip]

looking at parent device '/devices/pci0000:00/0000:00:12.2':
KERNELS=="0000:00:12.2"
SUBSYSTEMS=="pci"
DRIVERS=="ehci-pci"
ATTRS{irq}=="17"
ATTRS{subsystem_vendor}=="0x1179"
[snip]

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""

/etc/udev/rules.d

Tried this rule...
# nano /etc/udev/rules.d/10-primefilm.rules

# Custom for Primefilm scanner
KERNEL=="2-2", SUBSYSTEM=="usb", \
ATTRS{idVendor}=="05e3", ATTRS{idProduct}=="0145", \
GROUP="scanner", MODE="0664", \
ENV{libsane_matched}="yes"
This rule worked correctly, as tested with...
# udevadm test $(udevadm info -q path -n /dev/bus/usb/002/009) 2>&1
...however I continued to see scanimage -L fails. This means backend trouble -- typically complicated.

scanimage and sane-config

In /usr/lib/sane, I noted two libsanes which might work as backends, viz libsane-pie, and libsane-genesys. Sane wasn't automatically pointing to either of these, so they hadn't been used. We can make it do that with the CLI. Neither appeared to work:
$ scanimage --device=pie:/dev/bus/usb/002/009
scanimage: open of device pie failed: Invalid argument

$ scanimage --device=genesys:/dev/bus/usb/002/009
scanimage: open of device genesys failed: Invalid argument

Saturday, May 18, 2013

slacko 5.5 (puppy) and easy peasy on a hp110 mini

Links: GPTfdisk  Puppy User and Security

booting from USB


I downloaded the latest slacko ISO (5.5), and used UNetbootin to put the ISO onto a stick. I put in the stick and powered-up. F10 got me into the BIOS, but the BIOS did not detect the USB --- the HDD was the single boot option. The F1 key and cycling the BIOS eventually detected the USB. Each time thereafter, an F9 option to "change boot device order" appeared in the BIOS splash. Once the USB was detected, Slacko booted and installed quickly from it.

Next were attempts at a couple of Ubuntu based distros; Joli OS, and EasyPeasy. Both hung during auto-partitioning. Reckoning I had encountered the storied MBR/GPT conflict, I considered downloading GPTfdisk, but then I discovered an article which appeared to show how to remove the GPT manually. I processed these on both ends of the HDD, but the installs still hung at the same step.

Why was an Ubuntu installer hanging and a Slackware based installer not hanging? During installs, Ubuntu's installer script apparently relies on the POS gparted for the partitioning phase. Since Ubuntu installation screens are GUI, not CLI, gparted has no straightforward way to provide its failure information; gparted simply dies (exits) and hangs the installation. I was eventually able to guess it might be gparted only after Googling similar hangs. To verify, I exited the setup script and entered the live CD desktop. I then opened a terminal, su'ed up ("sudo passwd ubuntu", then "su") and ran gparted. Sure enough, gparted failed and exited. The failure:
Assertion (head_size <= 63) at ../../../libparted/labels/dos.c:659 in function probe_partition_for_geom() failed.
OK, the above explained why I couldn't see the failure, and why it didn't occur in Slackware, but what is this failure? Poor design, apparently. Certainly, the difference between a USB and a CDROM should be irrelevant for gparted to do its install job, but it obviously isn't. It is a nasty bug. I was only able to find one fix on my first chop at it, and that was designed for Verbatim brand USB's. I don't have a Verbatim USB. Nevertheless, cfdisk -z /dev/sdb got me partway there, and then I also formatted the USB with ext2 (mke2fs /dev/sdb1) just to be sure. I then ran UNetbootin on an EasyPeasy ISO. With this, I was able to install EasyPeasy (Ubuntu installer script) without issues. 3 lost hours.

UEFI (Unified Extensible Firmware Interface) Note:

I also booted Slacko from the USB on a 2013 laptop. For this, I found I had to enter the BIOS and disable UEFI booting prior to the USB, or even a CDROM, booting successfully.

Slacko: adding a user, logins, X-settings for user

Slacko's default GUI access is root, which makes sense for a live distro. So how to create users and which files are required for X (and Bash, etc) initilization for these users?

Create users (in this case "foo"), add them to groups, and set-up the home directory...
# mkdir /home/foo
# adduser foo
# nano /etc/group #(add foo to whatever)
# su foo
$ cp /boot/root/.bashrc /home/foo/
$ cp /boot/root/.Xdefaults /home/foo/
$ cp /boot/root/.Xresources /home/foo/
$ cp /boot/root/.fonts-cache1 /home/foo/
$ cp /boot/root/.gtkrc-2.0 /home/foo/
...then arrange for runlevels and booting logins.

First, to eliminate autologins to root, change the second line in \etc\inittab.
\etc\inittab
tty1::respawn:/sbin/getty -n -l /bin/autologinroot 38400 tty1
...to...
tty1::respawn:/sbin/getty 38400 tty1

Sunday, December 18, 2011

usb external drive - misc

Occasionally, the problem of "stale nfs file handles" arises on an external drive. This is a strange error which I believe has to do with a file changing without it's time stamp being updated. I have no idea which index or hash this offends, but it seems to occur with external USB drives on occasion, in such a way that prevents mounting the drive. What to do? My first thought was to run fsck, but without mounting, we can't be sure of the "dev" name to provide fsck, and neither can we run fsck when the device with stale handles is mounted.

The best way to break this impasse is to use udevmonitor or, if now under the dreaded "systemd", udevadm monitor --environment --udev", to get the block device name. Then just verify it's unmounted, and fsck it. Let's say we plug-in our our USB drive with stale NFS file handles, and it becomes labeled "/dev/sdc" by the system when it's detected...

SysV

# udevadmin monitor [plug-in device]
# umount /dev/sdc
# fsck /dev/sdc

SystemD

# udevadm monitor --environment --udev [plug-in device]
# umount /dev/sdc
# fsck /dev/sdc

Saturday, November 19, 2011

[solved] naxa nmv-155 sized playback (QVGA)


Let's see if we can get anywhere with this inexpensive media player. I find players like these NAXA's in bargain bins for $15, (probably $5 worth of parts in the unit), but the day I wanted to toy with one, I was only able to find one as cheap as $25. Bought it anyway.

In forums about these knock-off players, the two most common problems are USB recognition and media formatting. It's got a 4GB internal, and room for a card as well. But it's picky about file formats... it's cheap. Secondly, I was excited to read in its manual, that the NAXA can display PDF's (Edit: this was misadvertised; it reads only basic text files), in addition to MP3's, movies, and photos. Battery life is reasonable.

unboxing

Unit comes without any cover but fits into a G1 holder (remaining after I had a G1 stolen). A USB -> micro-USB connector cable, a 300mA AC->micro-USB charger, earbuds, stylus (a plastic dental pick also works), Windows disk, and a small manual.

USB detection/connection

Threw out the Windows disk and plugged in the USB, and no auto-recognition took place in any file managers. Nothing in lsusb. Seeing nothing in udevmonitor either, I swapped USB cables with a known good USB cable (for a different device) and suddenly the NAXA appears in the file manager, no problems. It's identified there as "GENERIC USB DISK DEVICE Music Player" (3.5GB). We're already at less than the advertised 4GB. In lsusb, it appears as
10d6:1101 Actions Semiconductor Co., Ltd D-Wave 2GB MP4 Player / AK1025 MP3/MP4 Player
This 2GB reading is probably the most accurate -- I've likely been ripped off: appears I have a Chinese 2GB device hacked to indicate twice its real capacity. Happens. A different system check (below) shows 3.7 GB, but I'd bet against it and with the 2GB reading.
# df
/dev/sdc 3709840 2084 3707756 1% /media/disk
Summary: Ditch the included USB->micro-USB cable and the Windows disk. Storage expectations should be reduced to a little less than 2GB for this (likely) piece of shiat.

video

Let's upload something less than 2GB and see if it plays.
  • MKV - First-up, a 1.4GB sports vid coded in MKV. Result: the file is not even detected in the device file manager. Can't even be seen there.
  • AVI - Second, we'll do a standard AVI, let's go. Here's the encoding and resolution
    Stream #0.0: Video: mpeg4, yuv420p, 608x336
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 96 kb/s
    This file appeared in the device. I attempted to play it, but the NAXA displayed a "file format error".

QVGA = 320x240

Next step: record a short vid on the device, make sure it plays on the device (it did), and then download to the laptop and determine its settings and codecs.
Duration: 00:00:17.93, start: 0.000000, bitrate: 551 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 320x240
Stream #0.1: Audio: mp3, 16000 Hz, stereo, s16, 64 kb/s
So 320x240 (ie, QVGA) and 551k bitrate, and only 64 k on the sound. This is what the NAXA makes and plays.

Let's approximate that. I'll take a file taxi_s01e01.avi and, not worrying about B frames or whatever, split it into audio and video, and then render it back together, but in QVGA with MP3:
$ ffmpeg -i taxi_s01e01.avi -vn -ar 44100 -ac 2 s1e1.wav
$ ffmpeg -i taxi_s01e01.avi -vcodec libxvid -b:v 500k -s qvga -an s1e1.avi
$ ffmpeg -i s1e1.avi -i s1e1.wav -acodec libmp3lame
-ar 44100 -ab 192k -ac 2 -vol 330 -vcodec copy -b:v 504k qvga_taxi_s01e01.avi
This encoded without errors and played without errors.

the email angle

Most email attachments won't take more than a 20 second video clip without maxing out the 20Mb attachment limit. Try the 320x240 as a solution. It makes files roughly 30 x smaller than normal WXGA resolution. Not perfect, but a workable email attachment in lieu of those crappy MMS crippled vids. Use something like Ocenaudio to clean up your audio and put the video back together and email it.

$ ffmpeg -i s1e1.mp4 -i s1e1.wav -acodec libmp3lame
-ar 44100 -ab 192k -ac 2 -vol 330 -s qvga taxismall.mp4

Monday, May 30, 2011

wusb54g - ralink 2500

A family member running kernel 2.6.28.7 was having some problems with her older Linksys WUSB54G (Ralink 2500 chip). As seen in the photo, this is an external USB Wi-Fi card. When I installed her system (Zenwalk Slackware) back in 2009, ndiswrapper was the answer for this chip, which was posing problems for some Linux installations. It did fine, even with encryption and so on. Recently however, the relatives de-encrypted their network, probably so a visiting relative could use their network or during a Windows update, and the Linksys card was unable to associate with the LAN router once the network was keyless. This is a matter of opening or dropping the encryption configuration line and then ordering the remaining lines. However, over a telephone, implementing these kinds of changes required a lot of patience from my relative (thank you, Mom!). Ultimately, at least over the phone, it appeared there was no associating to this unencrypted network via ndiswrapper and using standard commands such as, say:
iwconfig wlan0 essid Foo
iwconfig wlan0 key open #(or using "off")
iwconfig wlan0 ap 00:20:etc
So it was a conundrum. We tried several different permutations, as noted above, before giving-up for the weekend.

Then I got to thinking about the old rt2500 driver. This driver is anachronistic, as all of these legacy Ralink cards now are managed directly in the kernel. But it is less anachronistic than ndiswrapper. Further, it would be a lot to ask a family member to update their entire system, a full Linux installation, with only telephone guidance. It looked like the middle ground would be to withdraw ndiswrapper and install the last/latest rt2500 driver to see if it was less finicky. Would the source for this older driver still be available. Turns out it was no longer available at the Ralink site. Summary: I couldn't travel to Mom's place to make the changes and it had been going slowly over the phone.

Solution: Linksys WUSB100

I locally purchased a WUSB100, id 1737:0078 ($15), to install onto my system, make configuration software, and then mail to her. There are two versions of WUSB100

Version 1 module rt2870sta

This site indicates that the the rt2870sta works with the following Linksys USBs:
USB: 1737:0070 Linksys WUSB100 v1 RangePlus Wireless Network Adapter [Ralink RT2870]
USB: 1737:0071 Linksys WUSB600N v1 Dual-Band Wireless-N Network Adapter [Ralink RT2870]
USB: 1737:0077 Linksys WUSB54GC v3 802.11g Adapter [Ralink RT2070L]
Noting that my 1737:0078 is not on that list

Version 2 - module rt2870 or rt3070?

Written on the back of the WUSB100 in my possession: FCCID Q87-WUSB100v2. Still began with the rt2870 since some were having success with this. The kernel would recognize it and assign ra0, but would not assign memory resources or allow connection. During this process, found there are at least two chips in version 2, the Belkin 050d:825b or what I have, the Ralink chip 1737:0078. I'm on the right track but, for the Ralink chip, it appears will have to go to the rt3070sta which means a patch is necessary. That will be my next weekend project. Meanwhile, I've also left the Belkin stuff here for those who have Belkins.
Ralink This is supposed to take care of the patch stuff according to this site
I believe the fix is to replace all instances of usb_buffer_alloc with usb_alloc_coherent and all instances of usb_buffer_free with usb_free_coherent. The instances I replaced were in include/os/rt_linux.h and os/linux/rt_usb_util.c.
Belkin

preinstalled driver attempts

Well before I compiled the rt3070sta module, I had hoped for the good luck of a driver included with the distro working. In favor of such a dream, the WUSB100 was detected by udevmonitor and lsusb. However, no module was being loaded. Thus, I looked in the wifi driver directory for useful drviers included with the distro:
$ls /lib/modules/2.6.28.7/kernel/drivers/net/wireless/
[snip] rtl8187.ko rt2x00 (directory) rtl8180.ko
$ls /lib/modules/2.6.28.7/kernel/drivers/net/wireless/rt2x00
rt2400pci.ko rt2500pci.ko rt2500usb.ko rt2x00lib.ko rt2x00pci.ko rt2x00usb.ko rt61pci.ko rt73usb.ko
I tried loading some of these with modprobe but the card continued to go unreachable. That is, in spite of modprobing these drivers in, the command
#ifconfig ra0 up (or wifi0, etc)
was yielding nothing. Back to the Google machine.

module rt2870sta attempts

Also before compiling the rt3070sta, I'd noticed some had success with the rt2870sta module and a few tweaks. It wasn't already onboard:
root[/]# find -iname rt2870*
root[/]#
  • downloaded rt3070sta, now deprecated, cached here (scroll down to "nightflier"'s post) and also here, along with some associated patches.
  • downloaded the rt2870sta source, now deprecated, here.This provided me with version2010_0709_RT2870_Linux_STA_v2.4.0.1.tar.bz2.
  • downloaded the firmware, same location. File is RT2870_Firmware_V22.zip.
  • The settings for rt2870sta.dat are explained here

rt2870sta compiling notes

most comprehensive link
Before compiling, be sure the card ID "1737:0078" is included in the card ID section. I located them by navigating to the top source directory and then
$ grep -r USB_DEVICE *
In my source, these statements were in /common/rtusb_dev_id.c. I added the line in there:
{USB_DEVICE(0x1737,0x0078)}, /* Linksys WUSB100v2 Pepsi */
(I like Pepsi, so whatever). In this fellow's source, they were in rt2870.h.
Still within the source directory, I also made the following change
$ geany /os/linux/config.mk
HAS_WPA_SUPPLICANT=y
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
Blacklist any modules that might attempt to load and conflict.
# geany /etc/modprobe.d/blacklist
blacklist rt2x00usb
blacklist rt2x00lib
blacklist rt2500usb
Backed-up the default /etc/Wireless/RT2870STA/RT2870STA.dat
# cp /etc/Wireless/RT2870STA/RT2870STA.dat /etc/Wireless/RT2870STA/RT2870STA.bak.def
Compiling is a basic $make/#make install operation. Unzip and install the firmware, although I noted no significant change from before the firmware was installed to after.
# cp Download/RT2870_Firmware_V22/rt2870.bin /lib/firmware/
# chmod 555 /lib/firmware/rt2870.bin
After compiling, installation, and modprobing, it's good to run # depmod, so I did that as well. Zince I'm using Zlackware Zenwalk, added the MAC to /etc/iftab. Added the module and updated the kernel
# depmod

After all of this, the rt2870sta was a no-go. A deeper look, showed that it lacks product and bus information and was not even being assigned an IRQ or other resources. For example, compare it to the (working) Atheros card below
# lshw -C network
*-network
description: Wireless interface
product: AR242x 802.11abg Wireless PCI Express Adapter
vendor: Atheros Communications Inc.
physical id: 0
bus info: pci@0000:05:00.0
logical name: wifi0
version: 01
serial: 00:2e:xx:xx:xx:xx
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list logical ethernet physical wireless
configuration: broadcast=yes driver=ath_pci ip=192.168.1.2 latency=0 multicast=yes wireless=IEEE 802.11g
resources: irq:18 memory:f3100000-f310ffff
*-network
description: Wireless interface
physical id: 1
logical name: ra0
serial: 68:3e:xx:xx:xx:xx
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=RALINK WLAN driverversion=2.4.0.0 multicast=yes wireless=Ralink STA
  • it was suggested here, that a change had to be made in /etc/udev/rules.d/10-wusb100.rules, or that the file had to be created. The rule then called rt2870sta and it would then work with the "0078" version.
  • creating a softlink worked for this guy

Tuesday, November 25, 2008

usb storage - corrupted e2fs

I don't know how it happened, since I verify each time when I disconnect my external 350G USB drive. I wait for hal to indicate "OK to disconnect" each time. Nevertheless, it's corrupted. I found the list of superblock backups easily
# dumpe2fs /dev/sdb1 |grep superblock
Then, I attempted a customary
# fsck -b 32768 /dev/sdb1
with a backup block from the list, 32768. However, several attempts netted the the same response, that the device was busy
# umount /dev/sdb1
# fsck -b 32768 /dev/sdb1
fsck 1.40.8 (13-Mar-2008)
e2fsck 1.40.8 (13-Mar-2008)
/sbin/e2fsck: Device or resource busy while trying to open /dev/sdb1
Filesystem mounted or opened exclusively by another program?
Making sure, I ran
# umount /dev/sdb1
umount: /dev/sdb1: not mounted
But yet, again, if I tried to fsck, I got
# fsck -b 32768 /dev/sdb1
fsck 1.40.8 (13-Mar-2008)
e2fsck 1.40.8 (13-Mar-2008)
/sbin/e2fsck: Device or resource busy while trying to open /dev/sdb1
Filesystem mounted or opened exclusively by another program?
What was going on? I verified the blocksize
# dumpe2fs /dev/sdb1 |grep -i "block size"
dumpe2fs 1.40.8 (13-Mar-2008)
Block size: 4096
and proceeded with
# mke2fs -S -b 4096 -v /dev/sdb1
to restore the superblocks without touching the data. Unfortunately, this move resulted in stale file handles and the drive wouldn't mount. Another move would be
# e2fsck -y -f -v -C 0 /dev/sda3
# tune2fs -j /dev/sd3
This makes the file system into a Ext3 system, and so the blocks are off if I started with ext2 on the drive in the first place. So I lost everything. Years of data, photos, passwords, tax records, the lot. If I knew a little more about e2fsck, I might have been able to get there, but all I could find was what to do with e3 file systems.