Hello,

Wouter Verhelst wrote (20 Mar 2007 20:24:45 GMT) :
> On Tue, Mar 20, 2007 at 03:22:27PM +0100, intrigeri wrote:
>> I think I've understood why I hit #415434 : no /etc/nbd-client was
>> created when I installed the package, whereas the debconf data seems
>> ok (see below). Digging into the postinst script, which is running in
>> bash "set -e" mode, I found :
>> [ -e /etc/nbd-client ] && . /etc/nbd-client && CFTMPL=/etc/nbd-client
>> 
>> Since on first install, /etc/nbd-client does not exist, this command
>> fails

> I can't reproduce that. When I manually remove /etc/nbd-client and run
> the postinst script, it works for me: the nbd-client file is created,
> and the postinst script finishes.

> Could you please run the following (as root):

> rm -f /etc/nbd-server
> script -c debconf sh -x /var/lib/dpkg/info/nbd-client.postinst configure 
> 1:2.8.7-4

> and mail the file "typescript" that this creates to this bug report?

Ok, my guess about this was bad, "set -e" does not prevent the script
to go on, I'll have to revise my shell scripting skills :

script -c 'debconf sh -x /var/lib/dpkg/info/nbd-client.postinst configure 
1:2.8.7-4'

----------- typescript --------------------------------------------

Script started on ven 23 mar 2007 12:54:25 CET
+ set -e
+ . /usr/share/debconf/confmodule
+ [ ! 1 ]
+ [ -z  ]
+ exec
+ [  ]
+ exec
+ DEBCONF_REDIR=1
+ export DEBCONF_REDIR
+ CFTMPL=/usr/share/nbd-client/nbd-client.cf
+ [ -e /etc/nbd-client ]
+ db_get nbd-client/number
+ _db_cmd GET nbd-client/number
+ IFS=  printf %s\n GET nbd-client/number
+ IFS=
 read -r _db_internal_line
+ RET=0
+ return 0
+ NUMBER=0
+ [ 0 -gt 0 ]
+ uname -r
+ dpkg --compare-versions 2.6.19.7-grsec2.1.10-vs2.2.0-rc15 ge 2.4
+ 
+ invoke-rc.d nbd-client restart
Stopping NBD client process: 
umounting all filesystems for nbd-blockdevices...
Invoking swapoff on all 'nb*' files in /dev...
Disconnecting ...
Disconnecting: que, disconnect, Disconnecting: que, disconnect, Disconnecting: 
que, disconnect, Disconnecting: que, disconnect, Disconnecting: que, 
disconnect, Disconnecting: que, disconnect, Disconnecting: que, disconnect, 
Disconnecting: que, disconnect, Disconnecting: que, disconnect, Disconnecting: 
que, disconnect, Disconnecting: que, disconnect, Disconnecting: que, 
disconnect, Disconnecting: que, disconnect, Disconnecting: que, disconnect, 
Disconnecting: que, disconnect, Disconnecting: que, disconnect, nbd-client.
Starting NBD client process: Connecting...Activating...
nbd-client.
+ db_stop
+ echo STOP
+ [ -x /etc/init.d/nbd-client ]
+ update-rc.d nbd-client defaults
+ exit 0

Script done on ven 23 mar 2007 12:54:36 CET

----------- /typescript -------------------------------------------

Nevertheless, this did not create anything in /etc, so
I investigated further.

I found it weird to see this in my debconf config.dat, whereas I've
chosen "1" as the number of connections to configure :
Name: nbd-client/number
Template: nbd-client/number
Value: 0
Owners: nbd-client
Flags: seen

After I dpkg-reconfigured nbd-client, and chose "1" again, the debconf value
of nbd-client/number is now 1, and /etc/nbd-client was
successfully created.

I then re-did this :

script -c 'debconf sh -x /var/lib/dpkg/info/nbd-client.postinst configure 
1:2.8.7-4'

----------- typescript --------------------------------------------

Script started on ven 23 mar 2007 13:21:54 CET

+ set -e
+ . /usr/share/debconf/confmodule
+ [ ! 1 ]
+ [ -z  ]
+ exec
+ [  ]
+ exec
+ DEBCONF_REDIR=1
+ export DEBCONF_REDIR
+ CFTMPL=/usr/share/nbd-client/nbd-client.cf
+ [ -e /etc/nbd-client ]
+ . /etc/nbd-client
+ NBD_DEVICE[0]=/dev/nbd0
/etc/nbd-client: 1: NBD_DEVICE[0]=/dev/nbd0: not found
+ db_get nbd-client/number
+ _db_cmd GET nbd-client/number
+ IFS=  printf %s\n GET nbd-client/number
+ IFS=
 read -r _db_internal_line
+ RET=1
+ return 0
+ NUMBER=1
+ [ 1 -gt 0 ]
+ [ x != nx ]
+ mktemp /tmp/nbd-client.XXXXXX
+ TMPFILE=/tmp/nbd-client.d30286
+ seq 0 0
+ [ 0 -eq 0 ]
+ unset i
+ db_get nbd-client/host
+ _db_cmd GET nbd-client/host
+ IFS=  printf %s\n GET nbd-client/host
+ IFS=
 read -r _db_internal_line
+ RET=server
+ return 0
+ host=server
+ db_get nbd-client/port
+ _db_cmd GET nbd-client/port
+ IFS=  printf %s\n GET nbd-client/port
+ IFS=
 read -r _db_internal_line
+ RET=4242
+ return 0
+ port=4242
+ db_get nbd-client/device
+ _db_cmd GET nbd-client/device
+ IFS=  printf %s\n GET nbd-client/device
+ IFS=
 read -r _db_internal_line
+ RET=/dev/nbd0
+ return 0
+ device=/dev/nbd0
+ [ -e /dev/nbd0 ]
+ db_get nbd-client/type
+ _db_cmd GET nbd-client/type
+ IFS=  printf %s\n GET nbd-client/type
+ IFS=
 read -r _db_internal_line
+ RET=raw
+ return 0
+ type_=r
+ i=0
+ sed -e s:\(^NBD_DEVICE\[0\]\=\).*:\1"/dev/nbd0":g -e 
s/\(^NBD_TYPE\[0\]=\).*/\1"r"/g -e s/\(^NBD_HOST\[0\]=\).*/\1"server"/g -e 
s/\(^NBD_PORT\[0\]=\).*/\1"4242"/g /usr/share/nbd-client/nbd-client.cf
+ grep NBD_TYPE\[0\]="r /tmp/nbd-client.d30286
+ [ -e /etc/nbd-client ]
+ mv /etc/nbd-client /etc/nbd-client.bak
+ mv /tmp/nbd-client.d30286 /etc/nbd-client
+ uname -r
+ dpkg --compare-versions 2.6.19.7-grsec2.1.10-vs2.2.0-rc15 ge 2.4
+ 
+ invoke-rc.d nbd-client restart
Stopping NBD client process: 
umounting all filesystems for nbd-blockdevices...
^HInvoking swapoff on all 'nb*' files in /dev...
Disconnecting ...
Disconnecting: que, disconnect, Disconnecting: que, disconnect, Disconnecting: 
que, disconnect, Disconnecting: que, disconnect, Disconnecting: que, 
disconnect, Disconnecting: que, disconnect, Disconnecting: que, disconnect, 
Disconnecting: que, disconnect, Disconnecting: que, disconnect, Disconnecting: 
que, disconnect, Disconnecting: que, disconnect, Disconnecting: que, 
disconnect, Disconnecting: que, disconnect, Disconnecting: que, disconnect, 
Disconnecting: que, disconnect, Disconnecting: que, disconnect, nbd-client.






Script done on ven 23 mar 2007 13:22:00 CET

----------- /typescript -------------------------------------------

So it really seems my guess was wrong, this postinst script does work.

Another test, then :
$ sudo dpkg --purge nbd-client ; sudo rm /etc/nbd-client
==> no more debconf data about nbd-client, as expected.
Then I apt-get installed it, answered debconf questions the same way
as usual, keeping an eye on /var/cache/debconf/config.dat all along
the installation, and :
  - just after I answer debconf questions, config.dat contains correct
    data (nbd-client/number is 1)
  - at some point in the install process, nbd-client/number gets
    a (wrong) value of 0...
  - to end with, /etc/nbd-client is not created.

This seemed pretty strange behaviour, and I was thinking of a weird
apt/dpkg interaction issue, so I had a look to my apt config ; the
only item related to such an issue was in
/etc/apt/apt.conf.d/70debconf :
// Pre-configure all packages with debconf before they are installed.
// If you don't like it, comment it out.
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};

I commented this out, purged again, apt-get installed, and...
everything worked perfectly !

I have this setting enabled on all my etch boxes, and neither me nor
my Changelogs remember having tweaked it, so I guess this is standard,
isn't it ?

Ciao,
--
  intrigeri <[EMAIL PROTECTED]>
  | gnupg key @ http://intrigeri.boum.org/intrigeri.asc
  | Do not be trapped by the need to achieve anything.
  | This way, you achieve everything.

Reply via email to