Package: uswsusp
Version: 0.3~cvs20060928-7etch1
Severity: normal
Tags: patch

*** Please type your report below this line ***

I just played with uswsusp and it hanged during install if encrytion was
enabled but passphrases were set empty -- I just pressed enter on passphrase
questions. 

The hang shows up like this:

...
Selecting previously deselected package uswsusp.
(Reading database ... 142234 files and directories currently installed.)
Unpacking uswsusp (from .../uswsusp_0.3~cvs20060928-7etch1_i386.deb) ...
Setting up uswsusp (0.3~cvs20060928-7etch1) ...
Generating RSA key, this may take a while ...

and:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
10456 root      25   0  2020  724  608 R 99.6  0.1   9:23.53 suspend-keygen

To me this seems like a debconf usage bug. First in uswsusp.config, an empty 
string is accepted as a passphrase and written to debconf database. A
fix would go somehow like this:

--- uswsusp.config-orig 2007-12-27 15:28:43.000000000 +0200
+++ uswsusp.config      2007-12-27 15:38:32.000000000 +0200
@@ -190,9 +190,11 @@
            db_go || true
 
            db_get uswsusp/RSA_passphrase
-           P1=$RET
+           # fail with empty passphrase
+           if [ -n "$RET" ]; then P1=$RET; fi
            db_get uswsusp/RSA_passphrase_v
-           P2=$RET
+           # fail with empty passphrase
+           if [ -n "$RET" ]; then P2=$RET; fi
        done
     fi
 fi


Then in uswsusp.postinst the empty string is read from database and fed 
without checks to suspend-keygen. A fix could go somehow like this:

--- /tmp/uswsusp/postinst       2007-09-18 00:21:59.000000000 +0300
+++ uswsusp.postinst    2007-12-27 16:36:31.000000000 +0200
@@ -94,13 +94,18 @@
                KEYFILE=$RET
                db_get uswsusp/RSA_passphrase
                PASS=$RET
-               echo "Generating RSA key, this may take a while ..."
-               suspend-keygen <<EOFa &> /dev/null
+               if [ -n "$BITS" ] && [ -n "$KEYFILE" ] && [ -n "$PASS" ]; then
+                       echo "Generating RSA key, this may take a while ..."
+                       suspend-keygen <<EOFa &> /dev/null
 $BITS
 $PASS
 $PASS
 $KEYFILE
 EOFa
+               else echo "RSA_key_bits, RSA_key_file or RSA_passphrase empty!"
+                       echo "suspend-keygen not called."
+                       exit 1;
+               fi
                db_reset uswsusp/RSA_passphrase
                db_reset uswsusp/RSA_passphrase_v
        fi

There might be something wrong with suspend-keygen argument parsing too,
since a few times I got it to loop forever with

$ /usr/sbin/suspend-keygen << EOF
1024


/dev/null
EOF

The output filled with questions and overwrote the history buffer too fast.
This is not always repeatable. Perhaps suspend-keygen is waiting for
the kernels entropy bucket to fill up or something. Anyway, at least the
debconf stuff would be nice to fix.

-Mikko

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (990, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages uswsusp depends on:
ii  debconf [debconf-2.0]  1.5.11etch1       Debian configuration management sy
ii  libc6                  2.3.6.ds1-13etch4 GNU C Library: Shared libraries
ii  libgcrypt11            1.2.3-2           LGPL Crypto library - runtime libr
ii  libgpg-error0          1.4-1             library for common error values an
ii  zlib1g                 1:1.2.3-13        compression library - runtime

Versions of packages uswsusp recommends:
ii  initramfs-tools               0.85h      tools for generating an initramfs

-- debconf information:
  uswsusp/suspend_loglevel:
  uswsusp/no_swap:
  uswsusp/early_writeout: true
  uswsusp/image_size: 487590461
  uswsusp/snapshot_device:
  uswsusp/max_loglevel:
  uswsusp/shutdown_method: platform
* uswsusp/encrypt: true
  uswsusp/RSA_key_bits: 1024
  uswsusp/continue_without_swap: true
  uswsusp/compute_checksum: false
  uswsusp/no_snapshot:
  uswsusp/compress: true
  uswsusp/create_RSA_key: true
  uswsusp/RSA_key_file: /etc/uswsusp.key
* uswsusp/resume_device: /dev/mapper/volgrp1-swap
  uswsusp/splash: false



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

  • Bug#457963: uswsusp: empty passphrase hangs installation and ... Mikko Rapeli

Reply via email to