Mounting encrypted fs error: remove ioctl failed: Device or resource busy

The error message I keep getting during mounting is:-

device-mapper: remove ioctl failed: Device or resource busy

This is from ane external USB HDD I use as a backup device.

I’ve tried formatting it as ext4 ane encrypting it from the command line

mkfs.ext4 /dev/sdc1

cryptestup luksFormat /dev/sdc1

which run without errors but an attempt to mount throws up the above error
as well as saying - you must specify the file type (tried that) - and fails
to mount.

I’ve tried using YaST to format and encrypt it which throws up the same
error when I run mount but actually does actually mount the filesystem

Googling around has brought up info saying that it’s probably a race
condition brought on by invalid udev rules.

I’ve got a (mostly) working system and the udev rules documentation leaves
more confused than when I started.

Can anyone give me any hints with this?


Alan
openSUSE 11.3 + latest updates, KDE4.5

Fudokai wrote:

> The error message I keep getting during mounting is:-
>
> device-mapper: remove ioctl failed: Device or resource busy
>
> This is from ane external USB HDD I use as a backup device.
>
> I’ve tried formatting it as ext4 ane encrypting it from the command line
> # mkfs.ext4 /dev/sdc1
> # cryptestup luksFormat /dev/sdc1
> which run without errors but an attempt to mount throws up the above error
> as well as saying - you must specify the file type (tried that) - and
> fails to mount.
>
> I’ve tried using YaST to format and encrypt it which throws up the same
> error when I run mount but actually does actually mount the filesystem
>
> Googling around has brought up info saying that it’s probably a race
> condition brought on by invalid udev rules.
>
> I’ve got a (mostly) working system and the udev rules documentation leaves
> more confused than when I started.
>
> Can anyone give me any hints with this?
>

As a follow up - trying the mount on my server which also has eSATA
connection, which is where this HDD would normally sit.

switch unit to eSATA interface and mount

  • mounts Ok, no errors
    unmount, switch to USB and mount
  • mounts Ok but device-mapper: remove ioctl failed: Device or resource busy
    unmount, switch back to eSATA and mount
  • mounts Ok but device-mapper: remove ioctl failed: Device or resource busy

Now I’m really confused :-/


Alan
openSUSE 11.3 + updetes, KDE4.5

On 2010-12-05 11:09, Fudokai wrote:
> The error message I keep getting during mounting is:-
>
> device-mapper: remove ioctl failed: Device or resource busy
>
> This is from ane external USB HDD I use as a backup device.
>
> I’ve tried formatting it as ext4 ane encrypting it from the command line
> # mkfs.ext4 /dev/sdc1

Which is wrong, sdc1 can’t be it.

> # cryptestup luksFormat /dev/sdc1
> which run without errors but an attempt to mount throws up the above error
> as well as saying - you must specify the file type (tried that) - and fails
> to mount.

Paste the exact command line you use to mount it - don’t forget to use code
tags:

Code:

paste here.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Carlos E. R. wrote:

> On 2010-12-05 11:09, Fudokai wrote:
>> The error message I keep getting during mounting is:-
>>
>> device-mapper: remove ioctl failed: Device or resource busy
>>
>> This is from ane external USB HDD I use as a backup device.
>>
>> I’ve tried formatting it as ext4 ane encrypting it from the command line
>> # mkfs.ext4 /dev/sdc1
>
> Which is wrong, sdc1 can’t be it.
>
>> # cryptestup luksFormat /dev/sdc1
>> which run without errors but an attempt to mount throws up the above
>> error as well as saying - you must specify the file type (tried that) -
>> and fails to mount.
>
> Paste the exact command line you use to mount it - don’t forget to use
> code tags:
>
> Code:
> ---------------
> paste here.
> ---------------
>

Standard mount command (as root of course) used dozens of times before with
other fs both encrypted and non-encrypted

<code>
mount /dev/sdc1 /mnt -o rw
</code>

I have 2 other encrypted external HDDs used as part oc the backup cycle and
neither of those throw up errors.


Alan

On 2010-12-07 21:18, Fudokai wrote:

> Standard mount command (as root of course) used dozens of times before with
> other fs both encrypted and non-encrypted
>
> <code>
> mount /dev/sdc1 /mnt -o rw
> </code>

It is not possible to mount an encrypted partition that way. You have to
use a combination of commands (that I have no time to explain at the
moment) or the system script “rccrypto start”.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Carlos E. R. wrote:

> On 2010-12-07 21:18, Fudokai wrote:
>
>> Standard mount command (as root of course) used dozens of times before
>> with other fs both encrypted and non-encrypted
>>
>> <code>
>> mount /dev/sdc1 /mnt -o rw
>> </code>
>
> It is not possible to mount an encrypted partition that way. You have to
> use a combination of commands (that I have no time to explain at the
> moment) or the system script “rccrypto start”.
>

Hmm - that’s the (equivalent) command I use every time I mount my enrypted
external HDDs I use for backup and it works :slight_smile:
The actual command (verbatim) is:-
<code>
mount /dev/sdg1 /media/backup -o rw
</code>
I enter the pasword at the prompt and it mounts (the other disks at least)
without a problem.
I’ve been running this backup system for a couple of years now and this is
the first time I’ve had any problem.


Alan

On 2010-12-08 18:35, Fudokai wrote:
> Carlos E. R. wrote:

>> It is not possible to mount an encrypted partition that way. You have to
>> use a combination of commands (that I have no time to explain at the
>> moment) or the system script “rccrypto start”.
>>
>
> Hmm - that’s the (equivalent) command I use every time I mount my enrypted
> external HDDs I use for backup and it works :slight_smile:
> The actual command (verbatim) is:-
> <code>
> mount /dev/sdg1 /media/backup -o rw
> </code>
> I enter the pasword at the prompt and it mounts (the other disks at least)
> without a problem.

I’ll take your word for it, but I don’t understand it. I’m guessing how it
could work, but I’m not sure. If that is the case, then…

> I’ve been running this backup system for a couple of years now and this is
> the first time I’ve had any problem.

…then have a loog at syslog just after it fails. Do you see any message
there or in the terminal where you type the mount command?

My guess is that the encrypted partition is corrupted, needs an fsck. But
this operation is always manual. I don’t have time right now to dig out my
notes, tomorrow I’ll write some for you.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

On 2010-12-09 04:56, Carlos E. R. wrote:
> My guess is that the encrypted partition is corrupted, needs an fsck. But
> this operation is always manual. I don’t have time right now to dig out my
> notes, tomorrow I’ll write some for you.
>

Ok, the procedure to mount an encrypted partition is:

mount:

cryptsetup luksOpen /dev/sdg1 cr_arbitraryname

mount /dev/mapper/cr_arbitraryname /mnt/mountpoint

umount:

umount /mnt/mountpoint
cryptsetup remove cr_arbitraryname

filesystemn check:

cryptsetup luksOpen /dev/sdg1 cr_arbitraryname

fsck /dev/mapper/cr_arbitraryname

Mounting SUSE style:

create entry in:

Code:

/etc/crypttab:

cr_arbitraryname /dev/disk/by-id/WHATEVER none noauto

(or auto if you want mount at boot)

/etc/fstab:
/dev/mapper/cr_arbitraryname /mnt/mountpoint ext3 defaults,nofail 1 2

After that, it will start automatically on boot (or not), and you can start
it manually with “rccrypto start [name or device]”, with the advantage that
it will do some extra checks.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Carlos E. R. wrote:

> On 2010-12-09 04:56, Carlos E. R. wrote:
>> My guess is that the encrypted partition is corrupted, needs an fsck. But
>> this operation is always manual. I don’t have time right now to dig out
>> my notes, tomorrow I’ll write some for you.
>>
>
> Ok, the procedure to mount an encrypted partition is:
>
> mount:
>
> cryptsetup luksOpen /dev/sdg1 cr_arbitraryname
>
> mount /dev/mapper/cr_arbitraryname /mnt/mountpoint
>
>
> umount:
>
> umount /mnt/mountpoint
> cryptsetup remove cr_arbitraryname
>
>
> filesystemn check:
>
> cryptsetup luksOpen /dev/sdg1 cr_arbitraryname
>
> fsck /dev/mapper/cr_arbitraryname
>
>
> Mounting SUSE style:
>
> create entry in:
>
>
> Code:
> -------------
> /etc/crypttab:
>
> cr_arbitraryname /dev/disk/by-id/WHATEVER none noauto
>
> (or auto if you want mount at boot)
>
> /etc/fstab:
> /dev/mapper/cr_arbitraryname /mnt/mountpoint ext3 defaults,nofail
> 1 2
> -------------
>
>
> After that, it will start automatically on boot (or not), and you can
> start it manually with “rccrypto start [name or device]”, with the
> advantage that it will do some extra checks.
>

Sorry it’s taken so long to get back on this - put it down to a stonking
cold and just being ‘out of it’ ATM :frowning:

I tried mounting the fs as you showed above (cryptsetup && mount) and, sure
enough, no errors.

I didn’t know my way around cryptsetup (I know more than I did now tho’) -
it’s just that a simple mount/umount operation has been working just fine up
to now so I didn’t do the digging. I’ll do some proper rtfm on cryptsetup
now.

Thanks

Alan