KenMacD / wdpassport-utils

Code and information on how to unlock a WD My Passport drive in Linux.
126 stars 54 forks source link

Unable to unlock on Ubuntu 14.04 #8

Closed RCheesley closed 9 years ago

RCheesley commented 9 years ago

I've got this working on Debian but when I try to unlock on Ubuntu I'm having some difficulties.

I get the following when running the grep:

rcheesley@Puddle:~/wdpassport-utils-master$ dmesg | grep sg | grep "type 13" [756416.966932] ses 8:0:0:2: Attached scsi generic sg5 type 13 [756518.588560] ses 9:0:0:2: Attached scsi generic sg5 type 13

If I run the command manually to unlock after following all the required steps I get the following:

rcheesley@Puddle:~/wdpassport-utils-master$ sudo sg_raw -s 40 -i password.bin /dev/sg5 c1 e1 00 00 00 00 00 00 28 00 SCSI Status: Good

The drive is not available, however.

If I run the GUI I get the following:

Calling external cookpw-script... Sending SCSI commands to encrypt/unlock the drive... Secure Harddrive identified at /dev/type Failure while sending SCSI encrypt command -> Check if harddrive is connected properly! (Maybe /dev/type does not exist)

Could this be due to there being two entries returned with sg5?

Any ideas?

Nuc1eoN commented 9 years ago
$ sudo sg_raw -s 40 -i password.bin /dev/sg5 c1 e1 00 00 00 00 00 00 28 00
SCSI Status: Good

Did you try to mount the drive afterwards? Like this:

# mkdir /media/wdpass
# mount /dev/sg5 /media/wdpass/

Try it.

RCheesley commented 9 years ago

I did try that, and I get: mount: /dev/sg5 is not a block device

RCheesley commented 9 years ago

Some more details if it's helpful, not sure if this might be a system problem rather than to do with the script itself.

lsusb yields:

Bus 004 Device 006: ID 1058:0820 Western Digital Technologies, Inc. 

Output from fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=8b533003-adad-4774-b50e-24479e6bc625 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
#UUID=72b5536b-dc64-499a-9542-37f4b40a92aa none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

fdisk:

Disk /dev/sda: 250.1 GB, 250058268160 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488395055 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006aac3

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   471881727   235939840   83  Linux
/dev/sda2       471883774   488394751     8255489    5  Extended
/dev/sda5       471883776   488394751     8255488   82  Linux swap / Solaris

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4ec31301

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   976773119   488385536   83  Linux

Disk /dev/sdc: 1000.2 GB, 1000170586112 bytes
255 heads, 63 sectors/track, 121597 cylinders, total 1953458176 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x65b14d59

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048  1953458175   976728064    7  HPFS/NTFS/exFAT
KenMacD commented 9 years ago

Sorry, this isn't something I've seen before, as I don't run Ubuntu locally.

Could you post the results from the following on both systems:

RCheesley commented 9 years ago

Thanks for the help, really appreciate it!

On Debian Before mounting the drive:

SCSI Status: Good 

Sense Information:
sense buffer empty

Received 17 bytes of data:
 00     45 00 00 01 30 00 00 20  c4 eb 16 62 00 00 00 01    E...0.. ...b....
 10     30   

With the drive mounted:

sg_raw 0.4.3 (2011-02-25)

Password MD5 looks good

SCSI Status: Good 

Sense Information:
sense buffer empty

Received 17 bytes of data:
00     45 00 00 02 30 00 00 20  fb 8a 33 e7 00 00 00 01    E...0.. ..3.....
10     30   

When I run the GUI I get the following warnings (despite the drive unlocking perfectly fine) In the GUI:

Failure: udisk automoint didn't work! Maybe the uuid/Volume Serial Number you entered is wrong!

In the terminal where I launched the script I get the following:

Warning: Unable to open /dev/sr1 read-write (Read-only file system).  /dev/sr1 has been opened read-only.
Warning: Unable to open /dev/sr1 read-write (Read-only file system).  /dev/sr1 has been opened read-only.
Error: The partition's data region doesn't occupy the entire partition.
Cannot find device with major:minor 8:17: No such device

The drive has however fully unlocked and I can read/write all directories.

Will run it on Ubuntu later when I have a chance!

Nuc1eoN commented 9 years ago

mount: /dev/sg5 is not a block device

Well, so it's actually a duplicate of #2. I have the same error, but it has nothing to do with ubuntu. I am using gentoo.

With the drive mounted:

So how did you mount it in the end?

KenMacD commented 9 years ago

Okay, that shows what it should, the drive goes from 45 00 00 01 (locked) to 45 00 00 02 (unlocked). I look forward to seeing what Ubuntu says.

KenMacD commented 9 years ago

@RCheesley As you're probably not also reading #2, try unlocking the device on Ubuntu, then run sudo partprobe, and take a look at your dmesg to see if a new drive like /dev/sdb has shown up. I'm thinking that I typically don't mount the /dev/sd* device.

RCheesley commented 9 years ago

OK will try this when I get home this evening, had not seen the other issue as the title didn't immediately suggest it could be related ;) On 25 Jun 2015 9:58 pm, "Kenny MacDermid" notifications@github.com wrote:

@RCheesley https://github.com/RCheesley As you're probably not also reading #2 https://github.com/KenMacD/wdpassport-utils/issues/2, try unlocking the device on Ubuntu, then run sudo partprobe, and take a look at your dmesg to see if a new drive like /dev/sdb has shown up. I'm thinking that I typically don't mount the /dev/sd* device.

— Reply to this email directly or view it on GitHub https://github.com/KenMacD/wdpassport-utils/issues/8#issuecomment-115396580 .

Be like me, be Carbon free - don't print this and save a tree IMPORTANT: The contents of this email and any attachments are confidential. They are intended for the named recipient(s) only. If you have received this email by mistake, please notify the sender immediately and do not disclose the contents to anyone or make copies thereof.

RCheesley commented 9 years ago

@KenMacD that's awesome, thank you so much!

I ran sudo partprobe after unlocking the device manually and it mounted immediately. Hurrah!

KenMacD commented 9 years ago

Great to hear. I added partprobe info to the readme in 788c00b40c087b6bd55f3cea3673f5204894efbb.