Project

General

Profile

Bug #15382

Feature #14568: Additional Software Packages

Feature #14594: Code & integration into Tails: Additional Software Packages GUI

APT hooks for ASP should be non-blocking

Added by intrigeri about 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Persistence
Target version:
Start date:
03/06/2018
Due date:
% Done:

100%

QA Check:
Pass
Feature Branch:
Type of work:
Code
Blueprint:
Starter:
Affected tool:
Additional Software Packages

Description

The APT package installation currently does not complete until the hook has returned. I suspect that's not on purpose and one should add exec to the command line in DPkg::Pre-Install-Pkgs and DPkg::Post-Invoke.

Associated revisions

Revision d3a5336e (diff)
Added by alant about 1 year ago

ASP: execute post-install hook in the background

The APT package installation currently does not complete until the hook has
returned and no package installation can succeed without the user clicking on
the desktop notification.

Refs: #15382

Revision 26f89d52 (diff)
Added by bertagaz about 1 year ago

Test suite: Temoorary fix bug in APT hooks introduced by ASP.

At the moment, APT waits for the DPKG post install hook notification to
be clicked on before returning, which is a bug that should be fixed with
ticket #15382. Meanwhile we have to run APT install in the background
and check when the package is installed to go on with the feature.

Refs: #14596, #15382

Revision ed9795e3 (diff)
Added by alant about 1 year ago

ASP: double-fork before running apt_hook_post

Will-fix: #15382.

History

#1 Updated by intrigeri about 1 year ago

Incidentally, I believe the current implementation breaks features/apt.feature (and any non-interactive usage of APT): no package installation can succeed without the user clicking on the desktop notification. Cc bertagaz so he does not waste time working around what is more likely an implementation mistake rather than behaviour we should adjust our test suite for.

#2 Updated by alant about 1 year ago

  • Status changed from Confirmed to In Progress

#3 Updated by alant about 1 year ago

  • % Done changed from 0 to 50
  • QA Check set to Ready for QA

#4 Updated by alant about 1 year ago

  • Status changed from In Progress to Resolved
  • QA Check changed from Ready for QA to Pass

#5 Updated by alant about 1 year ago

  • Status changed from Resolved to Confirmed
  • QA Check changed from Pass to Dev Needed

Adding exec doesn't make the hook non-blocking. When using synaptic, adding & after the command makes the hook not being executed at all. To be investigated.

#6 Updated by alant about 1 year ago

  • Assignee changed from alant to intrigeri
  • QA Check changed from Dev Needed to Info Needed

I suspect that's not on purpose and one should add exec to the command line

That fails to make the hook non-blocking, and adding & prevent it from being called from synaptic (but works from the terminal). Do you have a magic idea or should I take time to investigate?

#7 Updated by intrigeri about 1 year ago

  • QA Check changed from Info Needed to Dev Needed

I suspect that's not on purpose and one should add exec to the command line

That fails to make the hook non-blocking,

That's strange. My understanding of apt.conf(5) suggests it should work. On my system I see that /etc/apt/apt.conf.d/20adequate uses exec. I've not verified if it works but I would hope it does. I would suggest you try it out and see if that one works, which should help you figure out why yours does not.

If you want me to help further on the exec option, please push somewhere the exact code you've seen fail.

and adding & prevent it from being called from synaptic (but works from the terminal).

Wow. I'll ignore this for now: let's first investigate the exec way, that has greater chances to work (& might not be enough to indicate to the calling apt process that the hook has completed).

Do you have a magic idea or should I take time to investigate?

Reading apt.conf(5) I have a doubt wrt. how DPkg::Tools::Options plays with what we're trying to do: it's not clear to me how APT extracts cmd from the shell scripts we have in DPkg::Pre-Install-Pkgs and DPkg::Post-Invoke. That's merely anecdotal evidence but on my system, every command for any hook that uses DPkg::Tools::Options starts with cmd, e.g.:

  • DPkg::Pre-Install-Pkgs { "/usr/bin/apt-listchanges […] matches DPkg::Tools::Options::/usr/bin/apt-listchanges::
  • DPkg::Pre-Install-Pkgs { "adequate […] matches DPkg::Tools::Options::adequate::

… so it may be that prefixing our command with exec makes it so DPkg::Tools::Options::/usr/local/sbin/tails-additional-software::Version "3" is unused, which I suspect can break some of our stuff. See how adequate handles this.

Worst case, you'll need to handle the forking (the double-fork pattern might be needed actually) in the Python script itself.

#8 Updated by intrigeri about 1 year ago

  • Assignee changed from intrigeri to alant

#9 Updated by bertagaz about 1 year ago

intrigeri wrote:

and adding & prevent it from being called from synaptic (but works from the terminal).

Wow. I'll ignore this for now: let's first investigate the exec way, that has greater chances to work (& might not be enough to indicate to the calling apt process that the hook has completed).

I confirm it works in the terminal, but not in shells that don't have a TTY, as in the test suite for example. :)

#10 Updated by bertagaz about 1 year ago

  • Status changed from Confirmed to In Progress

Applied in changeset commit:abb33e204cf3f2819b77c699dadf0365471df737.

#11 Updated by alant about 1 year ago

  • % Done changed from 50 to 70
  • QA Check changed from Dev Needed to Ready for QA

This should be fixed by double-forking inside the python script. Tested with synaptic.

#12 Updated by bertagaz about 1 year ago

Indeed according to the test suite Synaptic now works great with ASP. I still had to leave a workaround for the apt install case, but I think that's because of the remote shell in the test suite, that is not a real one (e.g it has no TTY). So for the test suite part of it this ticket can be considered as solved.

#13 Updated by alant about 1 year ago

  • Status changed from In Progress to Resolved
  • % Done changed from 70 to 100
  • QA Check changed from Ready for QA to Pass

Also available in: Atom PDF