Bug#910377: Inhibit reboot/shutdown if dpkg is running

2021-05-19 Thread Julian Andres Klode
On Wed, May 19, 2021 at 04:03:16PM +0200, Laurent Bigonville wrote:
> reopen 910377
> reassign dpkg 1.20.9
> thanks
> 
> On Sat, 31 Aug 2019 00:34:32 +0200 Michael Biebl  wrote:
> 
> > On Fri, 5 Oct 2018 21:30:43 +0200 Michael Biebl  wrote:
> > > Am 05.10.18 um 21:28 schrieb Michael Biebl:
> > > > That said, also keep in mind, that the inhibit mechanism does not
> work
> > > > if the reboot request is triggered by privileged users [1], e.g.
> if you
> > > > trigger a reboot as root, an existing inhibitor blocks are ignored.
> > > > [1] https://github.com/systemd/systemd/issues/6644
> > >
> > > This issue describes this even better
> > > https://github.com/systemd/systemd/issues/2680
> > 
> > It seems there is no real interest to change this upstream and even if
> > at some point in the future there was a way to make inhibitors work for
> > the root user, I think such an inhibitor lock shoud be take directly by
> > dpkg. I don't think the hook interface is sufficient for that.
> 
> I'm reopening this issue and reassigning it dpkg package, that would at
> least avoid non privileged users to restart the machine when there is an
> update happening.
> 
> Apparently RPM has this functionality via a plugin. The manpage of the
> plugins available at [0] and says:
> 
>    This plugin for RPM prevents the system to enter shutdown, sleep
>    or idle mode while there is a rpm transaction running to prevent
>    system corruption that can occur if the transaction is
>    interrupted by a reboot.
> 
>    This is achieved by using the inhibit DBUS interface of systemd.
>    The call is roughly equivalent to executing
> 
>    systemd-inhibit --mode=block --what=idle:sleep:shutdown --who=RPM
>    --why="Transaction running"
> 
> The code is available in [1]
> 
> Having something similar in dpkg would be nice, but that would mean that
> dpkg will grow a dependency on libdbus and/or libsystemd, not sure how that
> would work

Or just use apt which already does this instead of manually running
dpkg? I mean, it wouldn't hurt to have dpkg inhibit too, but it's not
really relevant for most users given that apt-pkg library does and hence
apt, aptitude, packagekit.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer  i speak de, en



Bug#910377: Inhibit reboot/shutdown if dpkg is running

2021-05-19 Thread Ansgar
Laurent Bigonville writes:
> I'm reopening this issue and reassigning it dpkg package, that would
> at least avoid non privileged users to restart the machine when there
> is an update happening.

For what it's worth apt supports this already when apt invokes dpkg:

```C++
 if (_config->FindB("DPkg::Inhibit-Shutdown", true))
Fd = Inhibit("shutdown", "APT", "APT is installing or removing 
packages", "block");
```

Ansgar



Bug#910377: Inhibit reboot/shutdown if dpkg is running

2021-05-19 Thread Laurent Bigonville

reopen 910377
reassign dpkg 1.20.9
thanks

On Sat, 31 Aug 2019 00:34:32 +0200 Michael Biebl  wrote:


On Fri, 5 Oct 2018 21:30:43 +0200 Michael Biebl  wrote:
> Am 05.10.18 um 21:28 schrieb Michael Biebl:
> > That said, also keep in mind, that the inhibit mechanism does not 

work
> > if the reboot request is triggered by privileged users [1], e.g. 

if you

> > trigger a reboot as root, an existing inhibitor blocks are ignored.
> > [1] https://github.com/systemd/systemd/issues/6644
>
> This issue describes this even better
> https://github.com/systemd/systemd/issues/2680

It seems there is no real interest to change this upstream and even if
at some point in the future there was a way to make inhibitors work for
the root user, I think such an inhibitor lock shoud be take directly by
dpkg. I don't think the hook interface is sufficient for that.


I'm reopening this issue and reassigning it dpkg package, that would at 
least avoid non privileged users to restart the machine when there is an 
update happening.


Apparently RPM has this functionality via a plugin. The manpage of the 
plugins available at [0] and says:


   This plugin for RPM prevents the system to enter shutdown, sleep
   or idle mode while there is a rpm transaction running to prevent
   system corruption that can occur if the transaction is
   interrupted by a reboot.

   This is achieved by using the inhibit DBUS interface of systemd.
   The call is roughly equivalent to executing

   systemd-inhibit --mode=block --what=idle:sleep:shutdown --who=RPM
   --why="Transaction running"

The code is available in [1]

Having something similar in dpkg would be nice, but that would mean that 
dpkg will grow a dependency on libdbus and/or libsystemd, not sure how 
that would work


[0] https://man7.org/linux/man-pages/man8/rpm-plugin-systemd-inhibit.8.html
[1] 
https://github.com/rpm-software-management/rpm/blob/master/plugins/systemd_inhibit.c




Bug#910377: Inhibit reboot/shutdown if dpkg is running

2018-10-05 Thread Michael Biebl
Am 05.10.18 um 18:36 schrieb Laurent Bigonville:
> Package: systemd
> Version: 239-10
> Severity: wishlist
> 
> Hi,
> 
> Not sure if this should be reported here or in dpkg
> 
> Shouldn't it be intresting to add a hook in dpkg to inhibit the
> reboot/shutdown of the machine while packages are being
> updated/installed?
> 


I don't see how this could be implemented via a dpkg hook.
Can you elaborate, maybe provide a hook file which implements what you
have in mind?

That said, also keep in mind, that the inhibit mechanism does not work
if the reboot request is triggered by privileged users [1], e.g. if you
trigger a reboot as root, an existing inhibitor blocks are ignored.

Michael

[1] https://github.com/systemd/systemd/issues/6644

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?



signature.asc
Description: OpenPGP digital signature


Bug#910377: Inhibit reboot/shutdown if dpkg is running

2018-10-05 Thread Michael Biebl
Am 05.10.18 um 21:28 schrieb Michael Biebl:
> That said, also keep in mind, that the inhibit mechanism does not work
> if the reboot request is triggered by privileged users [1], e.g. if you
> trigger a reboot as root, an existing inhibitor blocks are ignored.
> [1] https://github.com/systemd/systemd/issues/6644

This issue describes this even better
https://github.com/systemd/systemd/issues/2680

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?



signature.asc
Description: OpenPGP digital signature


Bug#910377: Inhibit reboot/shutdown if dpkg is running

2018-10-05 Thread Laurent Bigonville
Package: systemd
Version: 239-10
Severity: wishlist

Hi,

Not sure if this should be reported here or in dpkg

Shouldn't it be intresting to add a hook in dpkg to inhibit the
reboot/shutdown of the machine while packages are being
updated/installed?

Kind regards,

Laurent Bigonville

-- Package-specific info:

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_BE.UTF-8, LC_CTYPE=fr_BE.UTF-8 (charmap=UTF-8), 
LANGUAGE=fr_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: SELinux: enabled - Mode: Permissive - Policy name: refpolicy

Versions of packages systemd depends on:
ii  adduser  3.118
ii  libacl1  2.2.52-3+b1
ii  libapparmor1 2.13-8
ii  libaudit11:2.8.4-2
ii  libblkid12.32.1-0.1
ii  libc62.27-6
ii  libcap2  1:2.25-1.2
ii  libcryptsetup12  2:2.0.4-2
ii  libgcrypt20  1.8.3-1
ii  libgnutls30  3.5.19-1+b1
ii  libgpg-error01.32-1
ii  libidn11 1.33-2.2
ii  libip4tc01.6.2-1.1
ii  libkmod2 25-1
ii  liblz4-1 1.8.2-1
ii  liblzma5 5.2.2-1.3
ii  libmount12.32.1-0.1
ii  libpam0g 1.1.8-3.8
ii  libseccomp2  2.3.3-3
ii  libselinux1  2.8-1+b1
ii  libsystemd0  239-10
ii  mount2.32.1-0.1
ii  procps   2:3.3.15-2
ii  util-linux   2.32.1-0.1

Versions of packages systemd recommends:
ii  dbus1.12.10-1
ii  libpam-systemd  239-10

Versions of packages systemd suggests:
ii  policykit-10.115-1
ii  systemd-container  239-10

Versions of packages systemd is related to:
pn  dracut   
ii  initramfs-tools  0.132
ii  udev 239-10

-- no debconf information