我尝试使用终端安装 SELinux,如下所示:
sudo apt-get install selinux
完成后,它说有一个错误。以下是包含错误消息的最后几行:
Starting SELinux autorelabel [ OK ]
Processing triggers for initramfs-tools (0.103ubuntu4.1) ...
update-initramfs: Generating /boot/initrd.img-3.13.0-29-generic
Selecting previously unselected package selinux-policy-ubuntu.
(Reading database ... 285160 files and directories currently installed.)
Preparing to unpack .../selinux-policy-ubuntu_0.2.20091117-0ubuntu2_all.deb ...
Unpacking selinux-policy-ubuntu (0.2.20091117-0ubuntu2) ...
Setting up selinux-policy-ubuntu (0.2.20091117-0ubuntu2) ...
Updating /etc/selinux/config.
Processing triggers for selinux (1:0.11) ...
semodule deferred processing now taking place
Error opening /etc/selinux/ubuntu/contexts/files/file_contexts.local: No such file or directory
libsemanage.sefcontext_compile: sefcontext_compile returned error code 255. Compiling /etc/selinux/ubuntu/contexts/files/file_contexts.local
libsemanage.semanage_install_active: Could not copy /etc/selinux/ubuntu/modules/active/file_contexts.homedirs to /etc/selinux/ubuntu/contexts/files/file_contexts.homedirs. (No such file or directory).
/usr/sbin/semodule: Failed!
dpkg: error processing package selinux (--configure):
subprocess installed post-installation script returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (1)
你们有人能帮我解决这个问题吗?我将不胜感激。
答案1
刚刚遇到这个问题 - 在我遇到这个问题之后重新启动,然后重新运行安装,似乎已经解决了这个问题。
$ sudo apt get install selinux
<snip>
usr/sbin/semodule: SELinux policy is not managed or store cannot be accessed.
Error opening /etc/selinux/ubuntu/contexts/files/file_contexts.local: No such file or directory
libsemanage.sefcontext_compile: sefcontext_compile returned error code 255. Compiling /etc/selinux/ubuntu/contexts/files/file_contexts.local
libsemanage.semanage_install_active: Could not copy /etc/selinux/ubuntu/modules/active/policy.kern to /etc/selinux/ubuntu/policy/policy.29. (No such file or directory).
/usr/sbin/semodule: Failed!
dpkg: error processing package selinux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
selinux
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ sudo reboot
$ sudo apt-get install selinux
Reading package lists... Done
Building dependency tree
Reading state information... Done
selinux is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up selinux (1:0.11) ...
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-30-generic
Found initrd image: /boot/initrd.img-3.13.0-30-generic
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
* Starting SELinux autorelabel [ OK ]
Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
update-initramfs: Generating /boot/initrd.img-3.13.0-30-generic
$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: ubuntu
Current mode: permissive
Mode from config file: permissive
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
我已经有一段时间没有使用过 SELinux 了(而且从未在基于 debian 的发行版上玩过),但我猜测安装依赖于内核中默认未运行的某些东西,而重启可以解决这个问题。