安装 Firefox ESR 后,AppArmor 无法启动,并显示“无法打开‘abstractions/ubuntu-browsers.d/firefox’” - 如何修复?

安装 Firefox ESR 后,AppArmor 无法启动,并显示“无法打开‘abstractions/ubuntu-browsers.d/firefox’” - 如何修复?

在我的 Ubuntu 16.04.5 LTS 系统上,我安装了 Firefox ESR 52.9.0,以便一些旧版插件能够在其上运行。

它是从安装的乔纳森F PPA然后固定:

$ apt-cache policy firefox-esr
firefox-esr:
  Installed: 52.9.0esr-1~16.04.york0
  Candidate: 52.9.0esr-1~16.04.york0
  Version table:
     60.8.0esr-1~16.04.york 500
        500 http://ppa.launchpad.net/jonathonf/firefox-esr/ubuntu xenial/main amd64 Packages
 *** 52.9.0esr-1~16.04.york0 1337
        100 /var/lib/dpkg/status

$ cat /etc/apt/preferences.d/pin-firefox 
Package: firefox-esr
Pin: version 52.9.0esr-1~16.04.york0
Pin-Priority: 1337

firefox我的系统上没有包。

我发现我的系统上没有启动 AppArmor 服务:

$ systemctl status apparmor.service 
● apparmor.service - LSB: AppArmor initialization
   Loaded: loaded (/etc/init.d/apparmor; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Вс 2019-09-08 00:07:34 MSK; 1min 47s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 8876 ExecStart=/etc/init.d/apparmor start (code=exited, status=123)

сен 08 00:07:34 norbert-UX32A apparmor[8876]:  * Starting AppArmor profiles
сен 08 00:07:34 norbert-UX32A apparmor[8876]: AppArmor parser error for /etc/apparmor.d/usr.bin.firefox-esr in /etc/apparmor.d/usr.bin.f...irefox'
сен 08 00:07:34 norbert-UX32A apparmor[8876]: Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
сен 08 00:07:34 norbert-UX32A apparmor[8876]: AppArmor parser error for /etc/apparmor.d/usr.bin.firefox-esr in /etc/apparmor.d/usr.bin.f...irefox'
сен 08 00:07:34 norbert-UX32A apparmor[8876]: Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
сен 08 00:07:34 norbert-UX32A apparmor[8876]:    ...fail!
сен 08 00:07:34 norbert-UX32A systemd[1]: apparmor.service: Control process exited, code=exited status=123
сен 08 00:07:34 norbert-UX32A systemd[1]: Failed to start LSB: AppArmor initialization.
сен 08 00:07:34 norbert-UX32A systemd[1]: apparmor.service: Unit entered failed state.
сен 08 00:07:34 norbert-UX32A systemd[1]: apparmor.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.

$ tail -f /var/log/syslog | grep apparmor

Sep  8 00:07:34 norbert-UX32A apparmor[8876]: AppArmor parser error for /etc/apparmor.d/usr.bin.firefox-esr in /etc/apparmor.d/usr.bin.firefox-esr at line 224: Could not open 'abstractions/ubuntu-browsers.d/firefox'
Sep  8 00:07:34 norbert-UX32A apparmor[8876]: Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Sep  8 00:07:34 norbert-UX32A apparmor[8876]:    ...fail!
Sep  8 00:07:34 norbert-UX32A systemd[1]: apparmor.service: Control process exited, code=exited status=123
Sep  8 00:07:34 norbert-UX32A systemd[1]: apparmor.service: Unit entered failed state.
Sep  8 00:07:34 norbert-UX32A systemd[1]: apparmor.service: Failed with result 'exit-code'.

/etc/apparmor.d/usr.bin.firefox-esr文件来自firefox-esr以下包:

$ dpkg -S /etc/apparmor.d/usr.bin.firefox-esr
firefox-esr: /etc/apparmor.d/usr.bin.firefox-esr

看来主要问题是“ Could not open 'abstractions/ubuntu-browsers.d/firefox'”。我在哪里可以找到这个文件?或者我应该如何修复这个错误?

答案1

abstractions/ubuntu-browsers.d/firefox文件/etc/apparmor.d/local/usr.bin.firefox并不对应任何包,而是由安装后 脚本命名firefox.postinst

我们可以使用以下长命令重新创建这些文件

cat << EOF | sudo tee /etc/apparmor.d/abstractions/ubuntu-browsers.d/firefox
# This file is updated by 'aa-update-browser' and may be overwritten on
# upgrades.
#
# For site-specific adjustments, please see /etc/apparmor.d/local/<binary>

#include <abstractions/ubuntu-browsers.d/plugins-common>
#include <abstractions/ubuntu-browsers.d/mailto>
#include <abstractions/ubuntu-browsers.d/multimedia>
#include <abstractions/ubuntu-browsers.d/productivity>
#include <abstractions/ubuntu-browsers.d/java>
#include <abstractions/ubuntu-browsers.d/kde>
#include <abstractions/ubuntu-browsers.d/text-editors>
#include <abstractions/ubuntu-browsers.d/ubuntu-integration>
#include <abstractions/ubuntu-browsers.d/user-files>
EOF

和小命令:

sudo touch /etc/apparmor.d/local/usr.bin.firefox

AppArmor 将照常启动。

相关内容