# Issues with cryptsetup and minimal installation cd

## egoitz

Good morning,

I have tried crypting my root and swap partition with the minimal installation cd the following way : 

- First a : dd if=/dev/urandom of=/dev/sda bs=512 count=20480

- partition the device in gpt mode with parted

- cryptsetup -s 512 luksFormat /dev/sda3 and cryptsetup -s 512 luksFormat /dev/sda4

- Later the opening and mapping : cryptsetup luksOpen /dev/mapper/swapdevice and cryptsetup luksOpen /dev/mapper/rootdevice

- Finally... mkfs mount and so....

The problem, is this procedure works just fine with the LiveDVD. When you try the same with the Minimal installacion CD you get errors like : "device-mapper: remove ioctl on temporary-cryptsetup-13503 failed: Device or resource busy" and 

the luksFormat phase is lasts much more. The one uses Kernel 4.4 and the other one Kernel 4.7. 

So now, my main question was : If I use the LiveDVD for installing my box crypting when I reboot the kernel will be (by default at least) the 4.4.21, not the 4.7 one. Would be better to use a 4.7 kernel as a definitive 

for this box due to this issue with the Minimal installation cd?. Could I suffer issues if I "luksFormat" the device with 4.7 but open and manipulate with 4.4.21?. Does some workaround exist in order this to work properply 

in the minimal installation cd?. Have tried listing the modules and diffing the ones charged in LiveDVD and in the minimal installation cd but the problem is not all modules available in the live DVD are available in the CD.

For instance : 

livecd ~ # modprobe ablk_helper

modprobe: FATAL: Module ablk_helper not found in directory /lib/modules/4.4.21-gentoo

livecd ~ # modprobe algif_skcipher

modprobe: FATAL: Module algif_skcipher not found in directory /lib/modules/4.4.21-gentoo

livecd ~ # modprobe af_alg

modprobe: FATAL: Module af_alg not found in directory /lib/modules/4.4.21-gentoo

livecd ~ # modprobe algif_skcipher

modprobe: FATAL: Module algif_skcipher not found in directory /lib/modules/4.4.21-gentoo

livecd ~ # modprobe lockd

livecd ~ # modprobe grace

livecd ~ # modprobe glue_helper

modprobe: FATAL: Module glue_helper not found in directory /lib/modules/4.4.21-gentoo

Could you please tell me something about my questions?.

Best regards,

----------

## egoitz

Good morning,

I have tried crypting my root and swap partition with the minimal installation cd the following way : 

- First a : dd if=/dev/urandom of=/dev/sda bs=512 count=20480

- partition the device in gpt mode with parted

- cryptsetup -s 512 luksFormat /dev/sda3 and cryptsetup -s 512 luksFormat /dev/sda4

- Later the opening and mapping : cryptsetup luksOpen /dev/mapper/swapdevice and cryptsetup luksOpen /dev/mapper/rootdevice

- Finally... mkfs mount and so....

The problem, is this procedure works just fine with the LiveDVD. When you try the same with the Minimal installacion CD you get errors like : "device-mapper: remove ioctl on temporary-cryptsetup-13503 failed: Device or resource busy" and 

the luksFormat phase is lasts much more. The one uses Kernel 4.4 and the other one Kernel 4.7. 

So now, my main question was : If I use the LiveDVD for installing my box crypting when I reboot the kernel will be (by default at least) the 4.4.21, not the 4.7 one. Would be better to use a 4.7 kernel as a definitive 

for this box due to this issue with the Minimal installation cd?. Could I suffer issues if I "luksFormat" the device with 4.7 but open and manipulate with 4.4.21?. Does some workaround exist in order this to work properply 

in the minimal installation cd?. Have tried listing the modules and diffing the ones charged in LiveDVD and in the minimal installation cd but the problem is not all modules available in the live DVD are available in the CD.

For instance : 

livecd ~ # modprobe ablk_helper

modprobe: FATAL: Module ablk_helper not found in directory /lib/modules/4.4.21-gentoo

livecd ~ # modprobe algif_skcipher

modprobe: FATAL: Module algif_skcipher not found in directory /lib/modules/4.4.21-gentoo

livecd ~ # modprobe af_alg

modprobe: FATAL: Module af_alg not found in directory /lib/modules/4.4.21-gentoo

livecd ~ # modprobe algif_skcipher

modprobe: FATAL: Module algif_skcipher not found in directory /lib/modules/4.4.21-gentoo

livecd ~ # modprobe lockd

livecd ~ # modprobe grace

livecd ~ # modprobe glue_helper

modprobe: FATAL: Module glue_helper not found in directory /lib/modules/4.4.21-gentoo

Could you please tell me something about my questions?.

Best regards,

----------

## frostschutz

In either case it should boot the kernel that you yourself provided. Has nothing to do which CD you use. You can use Ubuntu CD to install Gentoo. (Gentoo is not known for its outstanding live/install media)

----------

## egoitz

Really happens this.... but the device seems to work when it's opened but with that error : 

livecd ~ # cryptsetup luksOpen /dev/sda4 raizenc

Enter passphrase for /dev/sda4: 

device-mapper: remove ioctl on temporary-cryptsetup-13614 failed: Device or resource busy

livecd ~ # dmsetup ls

raizenc	(253:0)

livecd ~ # mkfs.ext4 /dev/mapper/raizenc 

mke2fs 1.42.13 (17-May-2015)

Creating filesystem with 75536896 4k blocks and 18890752 inodes

Filesystem UUID: bf7d3975-d164-4e59-bd6d-aab0417321cf

Superblock backups stored on blocks: 

	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 

	4096000, 7962624, 11239424, 20480000, 23887872, 71663616

Allocating group tables: done                            

Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done     

mount /dev/mapper/raizenc /puntomontajes 

livecd ~ # mount

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=127136,mode=755)

devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

tmpfs on / type tmpfs (rw,relatime)

/dev/sr0 on /mnt/cdrom type iso9660 (ro,relatime)

/dev/loop0 on /mnt/livecd type squashfs (ro,relatime)

tmpfs on /run type tmpfs (rw,nodev,relatime,size=102408k,mode=755)

shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)

fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)

cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)

openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc)

tmpfs on /mnt/livecd/usr/portage type tmpfs (rw,relatime)

/dev/mapper/raizenc on /puntomontajes type ext4 (rw,relatime,data=ordered)

----------

## egoitz

Really happens this.... but the device seems to work when it's opened but with that error :

livecd ~ # cryptsetup luksOpen /dev/sda4 raizenc

Enter passphrase for /dev/sda4:

device-mapper: remove ioctl on temporary-cryptsetup-13614 failed: Device or resource busy

livecd ~ # dmsetup ls

raizenc (253:0)

livecd ~ # mkfs.ext4 /dev/mapper/raizenc

mke2fs 1.42.13 (17-May-2015)

Creating filesystem with 75536896 4k blocks and 18890752 inodes

Filesystem UUID: bf7d3975-d164-4e59-bd6d-aab0417321cf

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624, 11239424, 20480000, 23887872, 71663616

Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

mount /dev/mapper/raizenc /puntomontajes

livecd ~ # mount

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=127136,mode=755)

devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

tmpfs on / type tmpfs (rw,relatime)

/dev/sr0 on /mnt/cdrom type iso9660 (ro,relatime)

/dev/loop0 on /mnt/livecd type squashfs (ro,relatime)

tmpfs on /run type tmpfs (rw,nodev,relatime,size=102408k,mode=755)

shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)

fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)

cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)

openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc)

tmpfs on /mnt/livecd/usr/portage type tmpfs (rw,relatime)

/dev/mapper/raizenc on /puntomontajes type ext4 (rw,relatime,data=ordered)

----------

## egoitz

Hi frostschutz,

But I assume a Crypted device... should be opened with the same or greater module version.... perhaps a newer kernel, uses newer module version.... don't you think perhaps frostschutz?

Best regards,

----------

## xaviermiller

Merged the 2 identical topics

----------

## egoitz

Sorry xavier I didn't know which was the proper place to post it.

Cheers,

----------

