app: Re-run setup bypasses force_upgrade
In a vagrant bookworm system, I performed a (test) dist-upgrade to trixie. All packages were upgraded except for firewalld, which is expected due to #2396 (closed).
$ apt policy firewalld
firewalld:
Installed: 1.3.3-1~deb12u1
Candidate: 2.1.0-1
Version table:
2.1.0-1 500
500 http://deb.debian.org/debian trixie/main amd64 Packages
*** 1.3.3-1~deb12u1 100
100 /var/lib/dpkg/status
However, I then did "Re-run setup" for Firewall, which produced this error message:
Jan 27 16:27:23 freedombox /usr/bin/plinth[64091]: # firewall..get_config(…)
Jan 27 16:27:23 freedombox sudo[65744]: plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions firewall get_config --write-fd 25
Jan 27 16:27:23 freedombox sudo[65744]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=110)
Jan 27 16:27:24 freedombox sudo[65744]: pam_unix(sudo:session): session closed for user root
Jan 27 16:27:26 freedombox /usr/bin/plinth[64091]: Operation: firewall: Updating app: added
Jan 27 16:27:26 freedombox /usr/bin/plinth[64091]: Operation: firewall: Updating app: running
Jan 27 16:27:26 freedombox /usr/bin/plinth[64091]: Setup run: firewall
Jan 27 16:27:26 freedombox /usr/bin/plinth[64091]: # plinth..is_package_manager_busy(…)
Jan 27 16:27:26 freedombox sudo[65753]: plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions plinth is_package_manager_busy --write-fd 26
Jan 27 16:27:26 freedombox sudo[65753]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=110)
Jan 27 16:27:26 freedombox sudo[65753]: pam_unix(sudo:session): session closed for user root
Jan 27 16:27:26 freedombox /usr/bin/plinth[64091]: Running install for app - firewall, packages - ['firewalld', 'nftables']
Jan 27 16:27:26 freedombox /usr/bin/plinth[64091]: # plinth..update(…)
Jan 27 16:27:26 freedombox sudo[65758]: plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions plinth update --write-fd 26
Jan 27 16:27:26 freedombox sudo[65758]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=110)
Jan 27 16:27:27 freedombox /usr/bin/plinth[64091]: Apt package cache updated.
Jan 27 16:27:27 freedombox /usr/bin/plinth[64091]: Package upgrade already in process
Jan 27 16:27:27 freedombox sudo[65758]: pam_unix(sudo:session): session closed for user root
Jan 27 16:27:27 freedombox /usr/bin/plinth[64091]: # plinth..install(…)
Jan 27 16:27:27 freedombox sudo[66107]: plinth : PWD=/ ; USER=root ; COMMAND=/usr/share/plinth/actions/actions plinth install --write-fd 16
Jan 27 16:27:27 freedombox sudo[66107]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=110)
Jan 27 16:27:27 freedombox /usr/share/plinth/actions/actions[66109]: Initialized apps - apache, api, names, avahi, storage, backups, cockpit, firewall, config, datetime, diagnostics, dynamicdns, first_boot, help, letsencrypt, networks, power, privacy, security, snapshot, ssh, sso, upgrades, users, bepasty, bind, calibre, coturn, deluge, ejabberd, email, gitweb, i2p, ikiwiki, infinoted, janus, jsxc, kiwix, matrixsynapse, mediawiki, minetest, minidlna, mumble, openvpn, pagekite, performance, privoxy, quassel, radicale, roundcube, rssbridge, samba, searx, shaarli, shadowsocks, shadowsocksserver, sharing, syncthing, tor, torproxy, transmission, ttrss, wireguard, wordpress, zoph
Jan 27 16:27:30 freedombox /usr/share/plinth/actions/actions[66109]: Error executing action: Apt command failed with return code: 100
Traceback (most recent call last):
File "/usr/share/plinth/actions/actions", line 93, in _call
return_values = func(*arguments['args'], **arguments['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/plinth/privileged/packages.py", line 69, in install
raise RuntimeError(
RuntimeError: Apt command failed with return code: 100
Jan 27 16:27:30 freedombox sudo[66107]: pam_unix(sudo:session): session closed for user root
Jan 27 16:27:30 freedombox /usr/bin/plinth[64091]: Error running action plinth..install(*(), **{'app_id': 'firewall', 'packages': ['firewalld', 'nftables'], 'skip_recommends': False, 'force_configuration': None, 'reinstall': False, 'force_missing_configuration': False}): ('Apt command failed with return code: 100', b'freedombox set on hold.\n', b'\x1b[97m INFO\x1b[0m \x1b[94mplinth.app \x1b[0m Initialized apps - apache, api, names, avahi, storage, backups, cockpit, firewall, config, datetime, diagnostics, dynamicdns, first_boot, help, letsencrypt, networks, power, privacy, security, snapshot, ssh, sso, upgrades, users, bepasty, bind, calibre, coturn, deluge, ejabberd, email, gitweb, i2p, ikiwiki, infinoted, janus, jsxc, kiwix, matrixsynapse, mediawiki, minetest, minidlna, mumble, openvpn, pagekite, performance, privoxy, quassel, radicale, roundcube, rssbridge, samba, searx, shaarli, shadowsocks, shadowsocksserver, sharing, syncthing, tor, torproxy, transmission, ttrss, wireguard, wordpress, zoph\nquota not working (qgroup not set)\nquota not working (qgroup not set)\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n\x1b[31m ERROR\x1b[0m \x1b[94m__main__ \x1b[0m Error executing action: Apt command failed with return code: 100\nTraceback (most recent call last):\n File "/usr/share/plinth/actions/actions", line 93, in _call\n return_values = func(*arguments[\'args\'], **arguments[\'kwargs\'])\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/plinth/privileged/packages.py", line 69, in install\n raise RuntimeError(\nRuntimeError: Apt command failed with return code: 100\n') ('Apt command failed with return code: 100', b'freedombox set on hold.\n', b'\x1b[97m INFO\x1b[0m \x1b[94mplinth.app \x1b[0m Initialized apps - apache, api, names, avahi, storage, backups, cockpit, firewall, config, datetime, diagnostics, dynamicdns, first_boot, help, letsencrypt, networks, power, privacy, security, snapshot, ssh, sso, upgrades, users, bepasty, bind, calibre, coturn, deluge, ejabberd, email, gitweb, i2p, ikiwiki, infinoted, janus, jsxc, kiwix, matrixsynapse, mediawiki, minetest, minidlna, mumble, openvpn, pagekite, performance, privoxy, quassel, radicale, roundcube, rssbridge, samba, searx, shaarli, shadowsocks, shadowsocksserver, sharing, syncthing, tor, torproxy, transmission, ttrss, wireguard, wordpress, zoph\nquota not working (qgroup not set)\nquota not working (qgroup not set)\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n\x1b[31m ERROR\x1b[0m \x1b[94m__main__ \x1b[0m Error executing action: Apt command failed with return code: 100\nTraceback (most recent call last):\n File "/usr/share/plinth/actions/actions", line 93, in _call\n return_values = func(*arguments[\'args\'], **arguments[\'kwargs\'])\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/plinth/privileged/packages.py", line 69, in install\n raise RuntimeError(\nRuntimeError: Apt command failed with return code: 100\n') [' File "/usr/share/plinth/actions/actions", line 93, in _call\n return_values = func(*arguments[\'args\'], **arguments[\'kwargs\'])\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', ' File "/usr/lib/python3/dist-packages/plinth/privileged/packages.py", line 69, in install\n raise RuntimeError(\n']
Jan 27 16:27:30 freedombox /usr/bin/plinth[64091]: Error installing package: ('Apt command failed with return code: 100', b'freedombox set on hold.\n', b'\x1b[97m INFO\x1b[0m \x1b[94mplinth.app \x1b[0m Initialized apps - apache, api, names, avahi, storage, backups, cockpit, firewall, config, datetime, diagnostics, dynamicdns, first_boot, help, letsencrypt, networks, power, privacy, security, snapshot, ssh, sso, upgrades, users, bepasty, bind, calibre, coturn, deluge, ejabberd, email, gitweb, i2p, ikiwiki, infinoted, janus, jsxc, kiwix, matrixsynapse, mediawiki, minetest, minidlna, mumble, openvpn, pagekite, performance, privoxy, quassel, radicale, roundcube, rssbridge, samba, searx, shaarli, shadowsocks, shadowsocksserver, sharing, syncthing, tor, torproxy, transmission, ttrss, wireguard, wordpress, zoph\nquota not working (qgroup not set)\nquota not working (qgroup not set)\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n\x1b[31m ERROR\x1b[0m \x1b[94m__main__ \x1b[0m Error executing action: Apt command failed with return code: 100\nTraceback (most recent call last):\n File "/usr/share/plinth/actions/actions", line 93, in _call\n return_values = func(*arguments[\'args\'], **arguments[\'kwargs\'])\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/plinth/privileged/packages.py", line 69, in install\n raise RuntimeError(\nRuntimeError: Apt command failed with return code: 100\n')
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/plinth/package.py", line 345, in install
privileged.install(**kwargs)
File "/usr/lib/python3/dist-packages/plinth/actions.py", line 57, in wrapper
return _run_privileged_method_as_process(module_name, action_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/plinth/actions.py", line 116, in _run_privileged_method_as_process
return _wait_for_return(*wait_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/plinth/actions.py", line 154, in _wait_for_return
raise exception
RuntimeError: ('Apt command failed with return code: 100', b'freedombox set on hold.\n', b'\x1b[97m INFO\x1b[0m \x1b[94mplinth.app \x1b[0m Initialized apps - apache, api, names, avahi, storage, backups, cockpit, firewall, config, datetime, diagnostics, dynamicdns, first_boot, help, letsencrypt, networks, power, privacy, security, snapshot, ssh, sso, upgrades, users, bepasty, bind, calibre, coturn, deluge, ejabberd, email, gitweb, i2p, ikiwiki, infinoted, janus, jsxc, kiwix, matrixsynapse, mediawiki, minetest, minidlna, mumble, openvpn, pagekite, performance, privoxy, quassel, radicale, roundcube, rssbridge, samba, searx, shaarli, shadowsocks, shadowsocksserver, sharing, syncthing, tor, torproxy, transmission, ttrss, wireguard, wordpress, zoph\nquota not working (qgroup not set)\nquota not working (qgroup not set)\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n\x1b[31m ERROR\x1b[0m \x1b[94m__main__ \x1b[0m Error executing action: Apt command failed with return code: 100\nTraceback (most recent call last):\n File "/usr/share/plinth/actions/actions", line 93, in _call\n return_values = func(*arguments[\'args\'], **arguments[\'kwargs\'])\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/plinth/privileged/packages.py", line 69, in install\n raise RuntimeError(\nRuntimeError: Apt command failed with return code: 100\n')
Jan 27 16:27:30 freedombox /usr/bin/plinth[64091]: Setup completed: firewall: Error updating app: ('Apt command failed with return code: 100', b'freedombox set on hold.\n', b'\x1b[97m INFO\x1b[0m \x1b[94mplinth.app \x1b[0m Initialized apps - apache, api, names, avahi, storage, backups, cockpit, firewall, config, datetime, diagnostics, dynamicdns, first_boot, help, letsencrypt, networks, power, privacy, security, snapshot, ssh, sso, upgrades, users, bepasty, bind, calibre, coturn, deluge, ejabberd, email, gitweb, i2p, ikiwiki, infinoted, janus, jsxc, kiwix, matrixsynapse, mediawiki, minetest, minidlna, mumble, openvpn, pagekite, performance, privoxy, quassel, radicale, roundcube, rssbridge, samba, searx, shaarli, shadowsocks, shadowsocksserver, sharing, syncthing, tor, torproxy, transmission, ttrss, wireguard, wordpress, zoph\nquota not working (qgroup not set)\nquota not working (qgroup not set)\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n\x1b[31m ERROR\x1b[0m \x1b[94m__main__ \x1b[0m Error executing action: Apt command failed with return code: 100\nTraceback (most recent call last):\n File "/usr/share/plinth/actions/actions", line 93, in _call\n return_values = func(*arguments[\'args\'], **arguments[\'kwargs\'])\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/plinth/privileged/packages.py", line 69, in install\n raise RuntimeError(\nRuntimeError: Apt command failed with return code: 100\n') ('Apt command failed with return code: 100', b'freedombox set on hold.\n', b'\x1b[97m INFO\x1b[0m \x1b[94mplinth.app \x1b[0m Initialized apps - apache, api, names, avahi, storage, backups, cockpit, firewall, config, datetime, diagnostics, dynamicdns, first_boot, help, letsencrypt, networks, power, privacy, security, snapshot, ssh, sso, upgrades, users, bepasty, bind, calibre, coturn, deluge, ejabberd, email, gitweb, i2p, ikiwiki, infinoted, janus, jsxc, kiwix, matrixsynapse, mediawiki, minetest, minidlna, mumble, openvpn, pagekite, performance, privoxy, quassel, radicale, roundcube, rssbridge, samba, searx, shaarli, shadowsocks, shadowsocksserver, sharing, syncthing, tor, torproxy, transmission, ttrss, wireguard, wordpress, zoph\nquota not working (qgroup not set)\nquota not working (qgroup not set)\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n\x1b[31m ERROR\x1b[0m \x1b[94m__main__ \x1b[0m Error executing action: Apt command failed with return code: 100\nTraceback (most recent call last):\n File "/usr/share/plinth/actions/actions", line 93, in _call\n return_values = func(*arguments[\'args\'], **arguments[\'kwargs\'])\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/plinth/privileged/packages.py", line 69, in install\n raise RuntimeError(\nRuntimeError: Apt command failed with return code: 100\n')
If it only showed the error message but did not upgrade, that would be better. But it actually did upgrade firewalld (without any force_upgrade handling of the conffile):
$ apt policy firewalld
firewalld:
Installed: 2.1.0-1
Candidate: 2.1.0-1
Version table:
*** 2.1.0-1 500
500 http://deb.debian.org/debian trixie/main amd64 Packages
100 /var/lib/dpkg/status
Looking at /etc/firewalld/firewalld.conf, it has our configuration, so I think it did the upgrade keeping this file as is (and not considering the newer file in the upgraded package).
In this case, it is probably fine (the config didn't change that much), but in general this could cause issues where we are left with a config that is no longer valid, and force_upgrade doesn't get to run at all.