View previous topic :: View next topic |
Author |
Message |
KristyX Apprentice
Joined: 18 Dec 2003 Posts: 206 Location: Malaysia
|
Posted: Wed Nov 30, 2005 12:14 am Post subject: Can't setup a loop device (for encryption) |
|
|
I'm trying to encrypt my home directory on my laptop so that if, God forbid, anything
should happen, the data won't be accessible.
But one of the steps calls for the setup of loop device using losetup.
My problem is, this is the error I get:
Code: |
lappy kristy # losetup /dev/loop0 /home/kristy_home
/dev/loop0: No such file or directory
|
I tried creating an empty file called /dev/loop0 but then the error I get is:
Code: |
lappy kristy # nano /dev/loop0
lappy kristy # losetup /dev/loop0 /home/kristy_home
ioctl: LOOP_SET_FD: Inappropriate ioctl for device
|
The HowTo I'm following is here
Anyone have any ideas?
Thanks,
Kristy _________________ Knowledge is a process of piling up facts; wisdom lies in their simplification. [Martin Fischer] |
|
Back to top |
|
|
bLaXe Tux's lil' helper
Joined: 14 Nov 2004 Posts: 81 Location: Berkshire, UK
|
Posted: Wed Nov 30, 2005 12:38 am Post subject: |
|
|
Do you have the relevant options/modules in the kernel? (this thread might help).
Have you modprobed the modules you need? (iirc you need 'dm-crypt') |
|
Back to top |
|
|
KristyX Apprentice
Joined: 18 Dec 2003 Posts: 206 Location: Malaysia
|
Posted: Wed Nov 30, 2005 1:15 am Post subject: |
|
|
Yes, I have.. I compiled the necessary kernel modules and everything. And I added dm-crypt to my autoload file
for kernel-2.6. I'm just not sure what I'm missing out..
Thanks,
Kristy _________________ Knowledge is a process of piling up facts; wisdom lies in their simplification. [Martin Fischer] |
|
Back to top |
|
|
KristyX Apprentice
Joined: 18 Dec 2003 Posts: 206 Location: Malaysia
|
Posted: Fri Dec 02, 2005 1:11 am Post subject: |
|
|
Anyone?? _________________ Knowledge is a process of piling up facts; wisdom lies in their simplification. [Martin Fischer] |
|
Back to top |
|
|
pteppic l33t
Joined: 28 Nov 2005 Posts: 781
|
Posted: Fri Dec 02, 2005 1:40 am Post subject: |
|
|
The loop devices should be created for you in the directory /dev/loop as numbers 0 through 7, /dev/loop0 is just a symlink, so it may be just those missing.
You can create your own loop devices with Code: | mknod /dev/loopX b 7 X | where X is the device number you wish to create. |
|
Back to top |
|
|
KristyX Apprentice
Joined: 18 Dec 2003 Posts: 206 Location: Malaysia
|
Posted: Fri Dec 02, 2005 3:58 am Post subject: |
|
|
Thanks pteppic. I managed to set up the devices but now, running the command below results in an error "Command failed: Block device required"
Code: |
lappy kristy # echo $KEY | cryptsetup create kristy /dev/loop0
Command failed: Block device required
|
Code: |
lappy kristy # mknod /dev/loop0 b 7 1
lappy kristy # ls -l /dev/l*
lrwxrwxrwx 1 root root 6 Dec 2 11:46 /dev/loop0 -> loop/0
lrwxrwxrwx 1 root root 6 Dec 2 11:46 /dev/loop1 -> loop/1
lrwxrwxrwx 1 root root 6 Dec 2 11:46 /dev/loop2 -> loop/2
lrwxrwxrwx 1 root root 6 Dec 2 11:46 /dev/loop3 -> loop/3
lrwxrwxrwx 1 root root 6 Dec 2 11:46 /dev/loop4 -> loop/4
lrwxrwxrwx 1 root root 6 Dec 2 11:46 /dev/loop5 -> loop/5
lrwxrwxrwx 1 root root 6 Dec 2 11:46 /dev/loop6 -> loop/6
lrwxrwxrwx 1 root root 6 Dec 2 11:46 /dev/loop7 -> loop/7
|
Thanks,
Kristy _________________ Knowledge is a process of piling up facts; wisdom lies in their simplification. [Martin Fischer] |
|
Back to top |
|
|
pteppic l33t
Joined: 28 Nov 2005 Posts: 781
|
Posted: Sat Dec 03, 2005 2:07 pm Post subject: |
|
|
From start to finish: Code: | dd if=/dev/zero of=/home/kristy_home bs=1M count=100 #make a 100meg file called krist_home to be the encrypted block filesystem
losetup /dev/loop0 /home/kristy_home #attach to the loop
echo $password| cryptsetup create kristy /dev/loop0 # create the logical device kristy in /dev/mapper
mkfs /mnt/mapper/kristy #format it.
mount /dev/mapper/kristy /home/kristy/encrypted # I assume thats what you plan to do next? |
and to undo... Code: | umount /dev/mapper/kristy
crypsetup remove kristy
losetup -d /dev/loop0
|
I assume (big assumption?) that you need the same kernel modules and packages as you do for encrypting whole partitions, which for me were
modules:
Device Drivers --->Block devices --->Loopback device support
Multi-device support (RAID and LVM) --->Device mapper support & Crypt target support (not sure about these ones, build as modules and see if it works without.)
Cryptographic options ---> AES cipher algorithms (arch)
packages:
device-mapper
multipath-tools
cryptsetup or cryptsetup-luks
Then all you need is a usb key to keep that huge, randomly generated password on, and a microwave to throw it into when the 'authorities' come knocking. |
|
Back to top |
|
|
|