Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 40874 - /etc/init.d/crypto-loop gives option -k to /sbin/losetup which the later doesn't know
Summary: /etc/init.d/crypto-loop gives option -k to /sbin/losetup which the later does...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on: 19970
Blocks:
  Show dependency tree
 
Reported: 2004-02-08 13:03 UTC by jochen
Modified: 2005-01-30 14:08 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fixed init sctipt for crypto-loop (crypto-loop,1.11 KB, text/plain)
2004-07-05 02:01 UTC, Michele Noberasco (RETIRED)
Details
New init script for crypto-loop (crypto-loop,1.40 KB, text/plain)
2004-07-06 03:07 UTC, Michele Noberasco (RETIRED)
Details
New init-script using password hashing (crypto-loop,1.60 KB, text/plain)
2005-01-01 16:10 UTC, Jürgen Hötzel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jochen 2004-02-08 13:03:18 UTC
the crypto-loop init script uses a syntax for losetup which the later doesn't support (namely the -k flag)

Reproducible: Always
Steps to Reproduce:
1. /sbin/losetup -e serpent -k 256 /dev/loop0 test 
2.
3.

Actual Results:  
/sbin/losetup: invalid option -- k
usage:
  /sbin/losetup loop_device                                      # give info
  /sbin/losetup -d loop_device                                   # delete
  /sbin/losetup [ -e encryption ] [ -o offset ] loop_device file # setup


Expected Results:  
normal behaviour

Portage 2.0.50 (default-x86-1.4, gcc-3.3.2, glibc-2.3.3_pre20040117-r0,
2.4.24-xfs-r1)
=================================================================
System uname: 2.4.24-xfs-r1 i686 Celeron (Coppermine)
Gentoo Base System version 1.4.3.12
Autoconf: sys-devel/autoconf-2.59
Automake: sys-devel/automake-1.8.2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium3 -O3 -pipe -mcpu=pentium3 -mmmx -msse -fforce-addr
-fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt
-falign-functions=4 -fstack-protector"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/share/config /usr/share/texmf/dvipdfm/config/
/usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=pentium3 -O3 -pipe -mcpu=pentium3 -mmmx -msse -fforce-addr
-fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt
-falign-functions=4 -fstack-protector"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox strict userpriv"
GENTOO_MIRRORS="http://sunsite.cnlab-switch.ch/ftp/mirror/gentoo
ftp://sunsite.cnlab-switch.ch/mirror/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl alsa apm avi berkdb clamav crypt dga doc dvd encode esd foomaticdb
gdbm gif gphoto2 gpm gtk gtk2 gtkhtml imap imlib ipv6 java jikes jpeg kerberos
libg++ libwww lufsusermount mad mbox mldonkeypango motif mozcalendar mozilla
mozxmlterm mpeg ncurses nls oggvorbis opengl oss pam pcmcia pdflib perl png
python readline scanner sdl slang spell sse ssl tcltk tcpd tetex tiff truetype
x86 xface xfs xml2 xmms xv zlib"
Comment 1 Michele Noberasco (RETIRED) gentoo-dev 2004-02-16 02:37:36 UTC
Same issue here.
Comment 2 Michele Noberasco (RETIRED) gentoo-dev 2004-02-16 02:43:41 UTC
This might be useful:

http://clemens.endorphin.org/Cryptoloop_Migration_Guide.html

It appears util-linux-2.12 is broken, either downgrade or wait for a fixed version...
Comment 3 Michele Noberasco (RETIRED) gentoo-dev 2004-02-16 03:04:39 UTC
A quick solution would be to mask sys-apps/util-linux/util-linux-2.12* until this gets fixed, or to subst util-linux-2.12 losetup with the 2.11z one, which should work.
Comment 4 Michele Noberasco (RETIRED) gentoo-dev 2004-05-13 15:12:02 UTC
Shameless bump...
Comment 5 Michele Noberasco (RETIRED) gentoo-dev 2004-06-07 00:56:59 UTC
Hello? Anybody home?
Comment 6 Armin 2004-07-04 22:27:14 UTC
still valid with:

sys-apps/baselayout=1.10.1-r1
sys-apps/util-linux=2.12-r4

It seems the correct syntax changed to

/sbin/losetup -e ${cipher}-${keysize} ${loop} ${device}

Also, on the enhancement sector, any chance for an option that would allow me to mount a device with a random key? (useful for automated swap mounts) Something like this, for instance, (inspired from the way Mandrake does it):

dd if=/dev/urandom bs=1024 2>/dev/null | mcookie -f /dev/stdin | losetup -p 0 -e  {cipher}-${keysize} ${loop} ${device} &>/dev/null
if [[ $? == 0 ]] ; then
   mkswap ${loop}
fi
Comment 7 Michele Noberasco (RETIRED) gentoo-dev 2004-07-05 02:00:48 UTC
This actually works. Adding a modified cryptoloop init script that solves the issue.
Comment 8 Michele Noberasco (RETIRED) gentoo-dev 2004-07-05 02:01:48 UTC
Created attachment 34811 [details]
Fixed init sctipt for crypto-loop
Comment 9 Michele Noberasco (RETIRED) gentoo-dev 2004-07-05 02:04:15 UTC
Also, it would be a nice enhancement to add a stop() section to the init script that scanf for active crypto-loops and runs 'losetup -d /dev/loop<number>' on them.
Comment 10 Armin 2004-07-05 08:09:41 UTC
you mean something like this?

for loop in $(echo /dev/loop[0-9]); do
	losetup ${loop} &>/dev/null
	if [[ $? == 0 ]]; then
		umount ${loop} &>/dev/null
		/sbin/losetup -d ${loop} &>/dev/null
	fi
done
Comment 11 Michele Noberasco (RETIRED) gentoo-dev 2004-07-06 03:00:09 UTC
Exactly, only maybe with some more checks:

local status="0"
for loop in $(echo /dev/loop[0-9]); do
	losetup ${loop} &>/dev/null
	if [[ $? == 0 ]]; then
		umount ${loop} &>/dev/null
		if ! /sbin/losetup -d ${loop} &>/dev/null
		then
			ewarn "Failure deconfiguring ${loop}."
			status=1
		fi
	fi
done
ewend ${status}
Comment 12 Michele Noberasco (RETIRED) gentoo-dev 2004-07-06 03:07:33 UTC
Created attachment 34862 [details]
New init script for crypto-loop
Comment 13 Michele Noberasco (RETIRED) gentoo-dev 2004-07-08 06:32:36 UTC
Uh, hello?

We got the fix,
we got an  enhancement,
we got a   shiny new init script already done,

what about closing this one?
Comment 14 Aron Griffis (RETIRED) gentoo-dev 2004-07-21 17:39:45 UTC
This was assigned to the wrong component so I hadn't seen it until now.
Comment 15 Michele Noberasco (RETIRED) gentoo-dev 2004-08-31 06:07:59 UTC
Ping...
Comment 16 SpanKY gentoo-dev 2004-12-18 22:12:25 UTC
can someone please attach a patch that will work with at least baselayout-1.11.8 and util-linux-2.12i-r1 ?
Comment 17 Michele Noberasco (RETIRED) gentoo-dev 2004-12-19 08:11:50 UTC
Will see to that in a few days, if nobody else beats me on time...
Comment 18 Jürgen Hötzel 2005-01-01 16:05:58 UTC
btw, the current initscript doesnt support hashed passwords. Previous Version of losetup hashed password with RMD160OLD. losetup included in util-linux >= 2.12 doesn't support hashing of password anymore. Instead hashing should be done via hashalot. See: 
http://clemens.endorphin.org/Cryptoloop_Migration_Guide 
To read my encrypted RedHat-9 CD-Images, i use:
loop=/dev/loop0 cipher=aes keysize=256 device=/dev/cdrom other='' hash=rmd160compat  in /etc/conf.d/crypto-loop and the attached init-script.




Comment 19 Jürgen Hötzel 2005-01-01 16:10:47 UTC
Created attachment 47339 [details]
New init-script using password hashing
Comment 20 SpanKY gentoo-dev 2005-01-30 14:08:57 UTC
added new script to cvs, thanks