Bug#788819: needrestart: status-logger fails to execute with inaccessible $SHELL

2015-06-15 Thread Michael Prokop
Package: needrestart
Version: 1.2-8+deb8u1
Severity: important

I've a running live system which is using /bin/zsh as interactive
shell and $SHELL is pointing to it. Inside a chroot I'm installing
Debian and then enter this chroot via:

  chroot /media/vg0-root /bin/bash

Now every package installation via dpkg fails:

| (test-jessie1)root@test-jessie1:~# apt-get install zsh
| Reading package lists... Done
| Building dependency tree
| Reading state information... Done
| Suggested packages:
|   zsh-doc
| The following NEW packages will be installed:
|   zsh
| 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
| Need to get 0 B/700 kB of archives.
| After this operation, 2,023 kB of additional disk space will be used.
| E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file 
or directory)
| dpkg (subprocess): unable to execute status logger ((test -x 
/usr/lib/needrestart/dpkg-status  /usr/lib/needrestart/dpkg-status || cat  
/dev/null)): No such file or directory
| Selecting previously unselected package zsh.
| (Reading database ... 40973 files and directories currently installed.)
| Preparing to unpack .../archives/zsh_5.0.7-5_amd64.deb ...
| E: Sub-process /usr/bin/dpkg exited unexpectedly
| (test-jessie1)root@test-jessie1:~# echo $?
| 100

This is caused because of:

| (test-jessie1)root@test-jessie1:~# echo $SHELL
| /bin/zsh
| (test-jessie1)root@test-jessie1:~# ls -la /bin/zsh
| ls: cannot access /bin/zsh: No such file or directory

in combination with:

| (test-jessie1)root@test-jessie1:~# cat /etc/dpkg/dpkg.cfg.d/needrestart
| # needrestart - Restart daemons after library updates.
| #
| # Scan for (successfully) installed packages,
| # triggers needrestart in apt's Dpkg::Post-Invoke
| # hook.
| 
| status-logger=(test -x /usr/lib/needrestart/dpkg-status  
/usr/lib/needrestart/dpkg-status || cat  /dev/null)

As soon as I unset $SHELL this works as expected again:

| (test-jessie1)root@test-jessie1:~# unset SHELL
| (test-jessie1)root@test-jessie1:~# apt-get install zsh
| Reading package lists... Done
| Building dependency tree
| Reading state information... Done
| Suggested packages:
|   zsh-doc
| The following NEW packages will be installed:
|   zsh
| 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
| Need to get 0 B/700 kB of archives.
| After this operation, 2,023 kB of additional disk space will be used.
| E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file 
or directory)
| Selecting previously unselected package zsh.
| (Reading database ... 40973 files and directories currently installed.)
| Preparing to unpack .../archives/zsh_5.0.7-5_amd64.deb ...
| Unpacking zsh (5.0.7-5) ...
| Setting up zsh (5.0.7-5) ...
| update-alternatives: using /bin/zsh5 to provide /bin/zsh (zsh) in auto mode
| update-alternatives: using /bin/zsh5 to provide /bin/rzsh (rzsh) in auto mode
| Scanning processes...
| Scanning candidates...
| Scanning kernel images...
| (test-jessie1)root@test-jessie1:~#

I'm aware that dpkg(1) says:

| SHELL  The program dpkg will execute when starting a new shell.

and I'm not sure whether needrestart really can do anything about
it. But I'm reporting it since other users might stumble upon this
as well and maybe something can be done about this invalid $SHELL
setting situation? Feel free to reassign as needed.

regards,
-mika-


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/2015-06-15t13-18...@devnull.michael-prokop.at



Bug#788819: needrestart: status-logger fails to execute with inaccessible $SHELL

2015-06-15 Thread Thomas Liske
reassign 788819 dpkg
affects 788819 needrestart
thanks


Dear Dpkg Developers,

this bug is simular to #777242. In both reports users did break their
dpkg (while needrestart is installed) by using:

#777242: a non-common interactive shell like fish
#788819: $SHELL pointing to a non-existing path (i.e. due to chroot)

needrestart does use the status-logger option of dpkg. dpkg uses the
user's $SHELL variable to execute the status-logger command. IMHO dpkg
must not use the user's $SHELL variable to run a status-logger command.

Dpkg should keep using $SHELL to spawn a shell on demand but it should
use /bin/sh to spawn the status-logger command (which is non-interactive
so there is no need to care about the user's $SHELL).


TIA  HTH,
Thomas


On 06/15/2015 01:36 PM, Michael Prokop wrote:
 Package: needrestart
 Version: 1.2-8+deb8u1
 Severity: important
 
 I've a running live system which is using /bin/zsh as interactive
 shell and $SHELL is pointing to it. Inside a chroot I'm installing
 Debian and then enter this chroot via:
 
   chroot /media/vg0-root /bin/bash
 
 Now every package installation via dpkg fails:
 
 | (test-jessie1)root@test-jessie1:~# apt-get install zsh
 | Reading package lists... Done
 | Building dependency tree
 | Reading state information... Done
 | Suggested packages:
 |   zsh-doc
 | The following NEW packages will be installed:
 |   zsh
 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 | Need to get 0 B/700 kB of archives.
 | After this operation, 2,023 kB of additional disk space will be used.
 | E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file 
 or directory)
 | dpkg (subprocess): unable to execute status logger ((test -x 
 /usr/lib/needrestart/dpkg-status  /usr/lib/needrestart/dpkg-status || cat  
 /dev/null)): No such file or directory
 | Selecting previously unselected package zsh.
 | (Reading database ... 40973 files and directories currently installed.)
 | Preparing to unpack .../archives/zsh_5.0.7-5_amd64.deb ...
 | E: Sub-process /usr/bin/dpkg exited unexpectedly
 | (test-jessie1)root@test-jessie1:~# echo $?
 | 100
 
 This is caused because of:
 
 | (test-jessie1)root@test-jessie1:~# echo $SHELL
 | /bin/zsh
 | (test-jessie1)root@test-jessie1:~# ls -la /bin/zsh
 | ls: cannot access /bin/zsh: No such file or directory
 
 in combination with:
 
 | (test-jessie1)root@test-jessie1:~# cat /etc/dpkg/dpkg.cfg.d/needrestart
 | # needrestart - Restart daemons after library updates.
 | #
 | # Scan for (successfully) installed packages,
 | # triggers needrestart in apt's Dpkg::Post-Invoke
 | # hook.
 | 
 | status-logger=(test -x /usr/lib/needrestart/dpkg-status  
 /usr/lib/needrestart/dpkg-status || cat  /dev/null)
 
 As soon as I unset $SHELL this works as expected again:
 
 | (test-jessie1)root@test-jessie1:~# unset SHELL
 | (test-jessie1)root@test-jessie1:~# apt-get install zsh
 | Reading package lists... Done
 | Building dependency tree
 | Reading state information... Done
 | Suggested packages:
 |   zsh-doc
 | The following NEW packages will be installed:
 |   zsh
 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 | Need to get 0 B/700 kB of archives.
 | After this operation, 2,023 kB of additional disk space will be used.
 | E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file 
 or directory)
 | Selecting previously unselected package zsh.
 | (Reading database ... 40973 files and directories currently installed.)
 | Preparing to unpack .../archives/zsh_5.0.7-5_amd64.deb ...
 | Unpacking zsh (5.0.7-5) ...
 | Setting up zsh (5.0.7-5) ...
 | update-alternatives: using /bin/zsh5 to provide /bin/zsh (zsh) in auto mode
 | update-alternatives: using /bin/zsh5 to provide /bin/rzsh (rzsh) in auto 
 mode
 | Scanning processes...
 | Scanning candidates...
 | Scanning kernel images...
 | (test-jessie1)root@test-jessie1:~#
 
 I'm aware that dpkg(1) says:
 
 | SHELL  The program dpkg will execute when starting a new shell.
 
 and I'm not sure whether needrestart really can do anything about
 it. But I'm reporting it since other users might stumble upon this
 as well and maybe something can be done about this invalid $SHELL
 setting situation? Feel free to reassign as needed.
 
 regards,
 -mika-
 


-- 

::  WWW: http://fiasko-nw.net/~thomas/  ::
   :::  Jabber:   xmpp:tho...@jabber.fiasko-nw.net  :::
::  flickr:  http://www.flickr.com/photos/laugufe/  ::


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#788819: needrestart: status-logger fails to execute with inaccessible $SHELL

2015-06-15 Thread Guillem Jover
Hi!

On Mon, 2015-06-15 at 22:55:31 +0200, Thomas Liske wrote:
 reassign 788819 dpkg
 affects 788819 needrestart
 thanks

(Please remember to Cc the pkg@packages.debian.org for the reassigned
package, otherwise the maintainers only see a control mail reply.)

 this bug is simular to #777242. In both reports users did break their
 dpkg (while needrestart is installed) by using:
 
 #777242: a non-common interactive shell like fish

That's the real problem here.

 #788819: $SHELL pointing to a non-existing path (i.e. due to chroot)

This is a local configuration problem. Take into account that
interactive shells will not start if the SHELL is not present,
like the option on the conffile changes prompt.

 needrestart does use the status-logger option of dpkg. dpkg uses the
 user's $SHELL variable to execute the status-logger command. IMHO dpkg
 must not use the user's $SHELL variable to run a status-logger command.

 Dpkg should keep using $SHELL to spawn a shell on demand but it should
 use /bin/sh to spawn the status-logger command (which is non-interactive
 so there is no need to care about the user's $SHELL).

Right, I've now changed the code to use SHELL only for interactive
shell invocations. Otherwise it will use /bin/sh.

Thanks,
Guillem


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org