0

I wanted to change the type of some data for SELinux and I made a typo and sent the following command into the prompt as the root user:

semanage fcontext -a -t openvpn _etc_t /

Now my system (CentOS 7) won't start up which is truely happened because of this command. The following things failed to start:

  • resets system activity log
  • login service
  • dump dmeg
  • network manager and several other things

Is there a chance to rescue my system?

  • Probably you can boot a livecd, mount the / partition, disable selinux. – schaiba Apr 6 '16 at 11:41
0

You need to relabel your file system.

This is the procedure to achieve this

1) When booting and the grub menu is shown, press e to enter grub.

2) Go to the line that starts with linux16 ....

3) remove the rhgb quiet and append rd.break

4) Press CTRL+x to boot from grub

5) Now you'll see the shell

6) mount -o remount,rw /sysroot

7) chroot /sysroot

8) touch /.autorelabel

9) CTRL+D

10) CTRL+D

11) The system will relabel the filesystem using fixfiles relabel in the background

12) If the above steps are performed correctly you'll be able to boot without a problem

  • This didn't really help. Failed to start: [avahi mDNS/DNS-SD Stack, Dump dmesg, system logging service, resets system activity logs, login service, ntp client/server, network manager] and dependency failed for network manager wait online. – Sascha R. Apr 6 '16 at 12:36
  • Well the procedure above doesn't get you to mDNS/DNS-SD. It breaks in a very early stage of initramfs At this point nothing really is mounted or loaded. – Valentin Bajrami Apr 6 '16 at 12:45
  • So... Is there another chance? – Sascha R. Apr 6 '16 at 12:54
  • You could try the same and use systemd.unit=emergency.target in the same line but this time don't include rd.break. Try to restore the SELinux context from there. Can you update your question and explain what you tried. Did it allow you to enter the grub menu? Did it responde to the commands I described above in my answer section? – Valentin Bajrami Apr 6 '16 at 13:07

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.