I have a Pi B with Raspbian Jessie installed (upgraded recently from wheezy to jessie by changing sources.lst). I also use rpi-update to stay up to date.

On every boot I get as the very first message that selinux could not be mounted (file not found). However, in my /etc/fstab I can't find anything about "selinux". Only thing I have found was the folder /etc/selinux with a semanage.conf. The exact message is:

mount failed for selinuxfs on /sys/fs/selinux: No such file or directory

Grepping services results in:

# grep -i selinux /etc/init.d/*
/etc/init.d/checkroot.sh:       if selinux_enabled && [ -x /sbin/restorecon ] && [ -r /etc/mtab ]
/etc/init.d/udev:    # set the SELinux context for devices created in the initramfs

What is this selinux and how do I disable it so that it is not tried to be mounted on each boot? Or should I rather try to repair it (if it's important) so that it is mounted correctly (how would I do so)?

  • Does it cause any problem, or is it just a warning? Selinux probably isn't enabled, but the functionality is likely included in the kernel so you can use it if you want. – goldilocks Apr 10 '15 at 18:07
  • No problems. Thing is, I don't want any garbage on my Pi (it's very stripped down, only the absolute minimum of what I need). And the stuff that is on my Pi should function correctly. Last but not least I want to learn. ;) – Foo Bar Apr 10 '15 at 18:10
  • I definitely think this is just a kernel subsystem starting up then saying it has nothing to do. Try and get that line exactly and paste it in; it's probably in /var/log/syslog and/or /var/log/dmesg; try sudo grep -i selinux /var/log/*. I just checked my upgraded-to-jessie pi and there's nothing there, but it started out with a kernel I made which would not have anything selinux built into it. I do have that /etc/selinux/semanage.conf file. – goldilocks Apr 11 '15 at 11:25

SELinux is, as the wikipedia article says, "a mechanism for supporting access control security policies". You probably don't need to do that on the pi as it turns out to be a bit of a hassle; it adds to the restrictions imposed by normal unix style permissions (file owner, group, etc.).

It probably isn't enabled either since you would likely have noticed some hassle, and I have not heard of it being enabled by default on Raspbian. However, it may be built into the kernel in case you do want to enable the userland part; it's that module that's complaining when you boot up.

Edit /boot/cmdline.txt and add at the beginning of the line (it should only be one line):

  • Adding selinux=0 at the very first entry did not do anything. It still is trying to mount SELinux as the very first boot actions, but can not because it does not find the path. – Foo Bar Apr 14 '15 at 7:01
  • You should try and get the exact text of that error message. – goldilocks Apr 14 '15 at 13:09
  • I edited the question with the exact message. – Foo Bar Apr 18 '15 at 9:44
  • It is very strange that selinux=0 doesn't work if this is the kernel. Are you sure you added it to cmdline.txt (not config.txt)? Also, looking here I don't think it's really the first thing that happens, although it may appear to be. Do a grep "for selinuxfs" /var/log/syslog and get the timestamp for that line, e.g. [ 2.202258] <- number of seconds since kernel start. Also grep -i selinux /etc/init.d/* to see if there is some service involved. – goldilocks Apr 18 '15 at 12:57
  • Edited question with grep results. Yes, double-checked, the selinux=0 entry is in cmdline.txt as the very first content. The logs I have to check later. – Foo Bar Apr 18 '15 at 13:37

The likely reason for the problem is the installation of the upstart while systemd is present on the system.

A Proper solution will be to edit /boot/cmdline.txt and add rw init=/bin/bash at the end of the line, so it will look like:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait rw init=/bin/bash 

Insert the card back into RPI and boot. Then you'll be able to remove upstart with:

sudo apt-get remove upstart

After that RPI should boot normally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.