Unable to access hard drive

This is a crap shoot, but I am pretty desperate.
The original install of PureOS finally got to the point where I couldn’t get past boot anymore. I reinstalled the OS, but did so on the other hard drive this laptop has. I am now trying to see if I can access the original HD to try to salvage some of the things I had on there that would otherwise be lost. Right now I am just trying to get the same way you would try to access any files. When I try to access the hard drive I get the following error:
“Error unlocking /dev/sdb2: Failed to activate device: Operation not permitted”
Is there any other way of trying to access the hard drive that I should try?
Thanks.

Excuse the ignorance, I’m a Windows expert who feels pretty comfortable in Linux so far, and this may be obvious but have you tried mounting the drive using root, and then using root just grant yourself permissions using chown?

I am likely a lot more ignorant than you. I haven’t tried any of that. I’ll try it now, but if you gave me a play by play it wouldn’t go unappreciated.

Are you able to see the drive in Nautilis (file browser)? Under Other Locations for example?

1 Like

Yes, I can see it in Nautilis.

Excellent. Do you know how to determine its drive letter (path name, usually sda, sdb, etc.)?

If not you can use sudo fdisk -l to see it.

Then you can use the path with chown. Now, I’m fairly certain this is a bad idea, but if you are just trying to salvage data and then format the drive, I don’t see the harm in it.

So for example if your hard drive was being mounted at /dev/sdb1 you would type

sudo chown USERNAME dev/sdb1/

This would grant the user specific right to the drive. Now because I’m ignorant, you might not be able to grant ownership rights to the entire root of that drive. if this is the case, you’ll need to chown specific folders on the drive instead.

Either way, you should be able to access files in Nautilis after that.

I would then use something like gParted to format and repartition the drive to be used in your current install.

1 Like

I’m still screwing something up.

Chown is giving me this
“chown: cannot access ‘dev/sdb2/’: No such file or directory.”
sdb2 is how that HD comes up in Nautilis and when I did fdisk -l

See below.

I’ve only used chown in very limited cases, and have usually been in the parent folder of the folder in question. So I never used a preceding forward slash. :slight_smile:

You need / before dev.

You could use udisksctl unlock {–object-path OBJECT | --block-device DEVICE} [–no-user-interaction]
[–key-file PATH]
and it should ask for your passphrase

example (might double check man page that my syntax is right):
udisksctl unlock -b /dev/sdb2
enter passphrase
should say something like Unlocked /dev/sdb2 as /dev/something
udisksctl mount -b /dev/something

1 Like

I suspect you will need to unlock the disk before you can mount it even in a chroot given that the error had as part of it’s message “Error unlocking /dev/sdb2”

Using udisksctl as @supermammal indicated is a good idea, perhaps start this way;

udisksctl info -b /dev/sdb2

unlock doesn’t seem to be working.

“udisksctl unlock -b /dev/sdb2” gives me

“Error unlocking /dev/sdb2: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error unlocking /dev/sdb2: Failed to activate device: Operation not permitted”

@jeremiah info gave me a wall of text I largely don’t understand

1 Like

Is the disk you’re trying to get into encrypted? Did you choose to encrypt in the original PureOS install on it?

1 Like

Yes to both of your questions.
I think this problem might be related to the problem I was having before.

I haven’t tried this before, but based on this thread:

You could try

sudo cryptsetup luksOpen /dev/sdb2 cryptdisk, which may allow you to decrypt the disk, and then from there, the suggestions above might work.

1 Like

That asks me for a passphrase, which keeps gettign rejected.

Are you 100% sure you’re typing your original decryption passphrase correctly? I can only assume that if you’ve tried carefully multiple times, then the decryption passphrase is not what you think it is (maybe you accidentally had a typo in it on the original setup), and then I don’t know what else can be done

1 Like

Should have asked if the drive was encrypted to begin with. Just assumed you would have mentioned that.

Definitely outside of my realm of expertise. Good luck!

I’m as confident as I am going to get that I am using the same passcode.

Did you have a file.key saved any where?

Hate to say it, but without the passcode you’re pretty much out of options

1 Like

I didn’t.
Thanks everyone for trying to help, but it’s looking like I am increasingly screwed.