Re: Re: [Bug 267192] [NEW] Misleading cryptsetup error message [PATCH]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reinhard Tartler wrote:
> Milan Broz writes:
> 
>> loading of dm_crypt is not cryptsetup job.
>>
>> Device-mapper has already autoloading of necessary target modules built in.
>> You just need device-mapper core initialized (dm_mod kernel module loaded).
>>
>> It just "simply works" on default configuration:
>>
>> # lsmod
>> Module                  Size  Used by
>> dm_mod                 48656  0
> 
> I see, but couldn't cryptsetup at least warn if the running system has
> not even dm_mod loaded instead of indicating the user had entered a
> wrong passphrase?

Ah so, yep, that's not correct. Interesting that it write error on my
gentoo system but not on other distros...

I think attached patch could be merged to upstream too?

Anyway, the Live CD supporting cryptsetup probably should load dm_mod too
by default (target modules, like dm_crypt, are then loaded automagically).

Milan
--
mbroz@xxxxxxxxxx

---
 lib/libdevmapper.c |    7 +++++++
 lib/setup.c        |    5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Index: cryptsetup.my/lib/libdevmapper.c
===================================================================
--- cryptsetup.my.orig/lib/libdevmapper.c	2008-09-09 23:23:31.000000000 +0200
+++ cryptsetup.my/lib/libdevmapper.c	2008-09-10 17:40:11.000000000 +0200
@@ -32,9 +32,16 @@ static void set_dm_error(int level, cons
 	va_end(va);
 }
 
+static int _dm_simple(int task, const char *name);
+
 static int dm_init(void)
 {
 	dm_log_init(set_dm_error);
+	if (!_dm_simple(DM_DEVICE_LIST_VERSIONS, "test")) {
+		set_error("Cannot communicate with device-mapper. Is the dm_mod module loaded?");
+		return -1;
+	}
+
 	return 1;	/* unsafe memory */
 }
 
Index: cryptsetup.my/lib/setup.c
===================================================================
--- cryptsetup.my.orig/lib/setup.c	2008-09-09 23:23:31.000000000 +0200
+++ cryptsetup.my/lib/setup.c	2008-09-10 17:38:32.000000000 +0200
@@ -692,7 +692,10 @@ static int crypt_job(int (*job)(int arg,
 
 	backend = get_setup_backend(default_backend);
 
-	setup_enter(backend,options->icb->log);
+	if (setup_enter(backend,options->icb->log) < 0) {
+		r = -ENOSYS;
+		goto out;
+	}
 
 	if (!backend) {
 		set_error("No setup backend available");

---------------------------------------------------------------------
dm-crypt mailing list - http://www.saout.de/misc/dm-crypt/
To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx
For additional commands, e-mail: dm-crypt-help@xxxxxxxx

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux