From 1de2b96bc43690834b20753d484198b601d195b2 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 21 Aug 2019 15:53:17 -0700 Subject: [PATCH] action_utils: Workaround problem with setting debconf answers Closes: #1303. Test: Reproduce the problem with debconf-set-selections. Install tt-rss. run debconf-set apt install tt-rss echo 'tt-rss tt-rss/database-type string pgsql' | debconf-set-selections apt purge tt-rss echo 'tt-rss tt-rss/database-type string pgsql' | debconf-set-selections error: Cannot find a question for tt-rss/database-type Then run try to install ttrss without patch and observe that it fails. Apply the patch and see that ttrss is installed properly. Observe that database configured in /etc/ttrss/database.php is 'pgsql'. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/action_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plinth/action_utils.py b/plinth/action_utils.py index 8b973dc1b..67ab7728c 100644 --- a/plinth/action_utils.py +++ b/plinth/action_utils.py @@ -531,6 +531,14 @@ Owners: {package} def debconf_set_selections(presets): """Answer debconf questions before installing a package.""" + try: + # Workaround Debian Bug #487300. In some situations, debconf complains + # it can't find the question being answered even though it is supposed + # to create a dummy question for it. + subprocess.run(['/usr/share/debconf/fix_db.pl'], check=True) + except (FileNotFoundError, PermissionError): + pass + presets = '\n'.join(presets) subprocess.check_output(['debconf-set-selections'], input=presets.encode())