a) Reproducing the problem, and confirming the fix
Starting with 31.2:
$ dpkg -l ubuntu-advantage-tools | grep ubuntu-advantage-tools
ii ubuntu-advantage-tools 31.2~16.04 all transitional dummy package for ubuntu-pro-client
Removing apparmor:
$ sudo apt remove apparmor -y
(...)
The following packages will be REMOVED:
apparmor liblxc1 lxc-common lxd snapd ubuntu-core-launcher
(...)
Removing apparmor (2.10.95-0ubuntu2.12) ...
(...)
Rebooting...
Logging back in, checking apt-news.service to see it fails to start due to apparmor:
$ sudo systemctl start apt-news.service
Job for apt-news.service failed because the control process exited with error code. See "systemctl status apt-news.service" and "journalctl -xe" for details.
$ systemctl status apt-news.service
● apt-news.service - Update APT News
Loaded: loaded (/lib/systemd/system/apt-news.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2024-04-14 15:41:47 UTC; 10s ago
Process: 1486 ExecStart=/usr/bin/python3 /usr/lib/ubuntu-advantage/apt_news.py (code=exited, status=231/APPARMOR)
Main PID: 1486 (code=exited, status=231/APPARMOR)
b) Confirming that apparmor, when available, is being applied
Continuing from test (a), we already have the proposed package installed.
Re-installing apparmor:
$ sudo apt install apparmor -y
(...)
Setting up apparmor (2.10.95-0ubuntu2.12) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Rebooting
Confirming profile is loaded and enforced:
$ sudo grep ubuntu_pro_apt_news /sys/kernel/security/apparmor/profiles
ubuntu_pro_apt_news (enforce)
Starting apt-news, it does not fail:
$ sudo systemctl start apt-news.service ; echo $?
0
Hacking the service unit file to force the service to stay running so we can inspect it:
Xenial verification
a) Reproducing the problem, and confirming the fix
Starting with 31.2: advantage- tools | grep ubuntu- advantage- tools advantage- tools 31.2~16.04 all transitional dummy package for ubuntu-pro-client
$ dpkg -l ubuntu-
ii ubuntu-
Removing apparmor: core-launcher 0ubuntu2. 12) ...
$ sudo apt remove apparmor -y
(...)
The following packages will be REMOVED:
apparmor liblxc1 lxc-common lxd snapd ubuntu-
(...)
Removing apparmor (2.10.95-
(...)
Rebooting...
Logging back in, checking apt-news.service to see it fails to start due to apparmor:
$ sudo systemctl start apt-news.service
Job for apt-news.service failed because the control process exited with error code. See "systemctl status apt-news.service" and "journalctl -xe" for details.
$ systemctl status apt-news.service system/ apt-news. service; static; vendor preset: enabled) /usr/bin/ python3 /usr/lib/ ubuntu- advantage/ apt_news. py (code=exited, status= 231/APPARMOR) 231/APPARMOR)
● apt-news.service - Update APT News
Loaded: loaded (/lib/systemd/
Active: failed (Result: exit-code) since Sun 2024-04-14 15:41:47 UTC; 10s ago
Process: 1486 ExecStart=
Main PID: 1486 (code=exited, status=
Installing ubuntu- advantage- tools from proposed: advantage- tools advantage- tools: br.archive. ubuntu. com/ubuntu xenial- proposed/ main amd64 Packages dpkg/status br.archive. ubuntu. com/ubuntu xenial-updates/main amd64 Packages
$ apt-cache policy ubuntu-
ubuntu-
Installed: 31.2.2~16.04
Candidate: 31.2.2~16.04
Version table:
*** 31.2.2~16.04 500
500 http://
100 /var/lib/
31.2~16.04 500
500 http://
$ pro version
31.2.2~16.04
Now the service starts:
$ sudo systemctl start apt-news.service
$
$ sudo systemctl status apt-news.service system/ apt-news. service; static; vendor preset: enabled)
● apt-news.service - Update APT News
Loaded: loaded (/lib/systemd/
Active: inactive (dead)
(...)
Apr 14 15:43:40 x-vm systemd[1]: Starting Update APT News...
Apr 14 15:43:40 x-vm systemd[1]: Started Update APT News.
b) Confirming that apparmor, when available, is being applied
Continuing from test (a), we already have the proposed package installed.
Re-installing apparmor: 0ubuntu2. 12) ...
$ sudo apt install apparmor -y
(...)
Setting up apparmor (2.10.95-
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Rebooting
Confirming profile is loaded and enforced: security/ apparmor/ profiles
$ sudo grep ubuntu_pro_apt_news /sys/kernel/
ubuntu_pro_apt_news (enforce)
Starting apt-news, it does not fail:
$ sudo systemctl start apt-news.service ; echo $?
0
Hacking the service unit file to force the service to stay running so we can inspect it:
$ sudo systemctl start apt-news.service
(it's sleeping)
Checking process:
# ps auxwZ|grep time\\.sleep
ubuntu_pro_apt_news (enforce) root 1749 0.0 0.8 35296 8716 ? Ss 15:49 0:00 /usr/bin/python3 -c import time; time.sleep(500)
We can see it's confined with ubuntu_pro_apt_news in enforce mode.
Xenial verification succeeded.