• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1443
  • Last Modified:

Centos 6 wont boot because of syntax error in selinux/config need to edit selinux/config

I have a unique issue. I have placed a ";" to comment out a line instead of "#".
I restarted my centos 6 and it says:

Syntax error in /sysroot/etc/selinux/config : 6 : syntax error ";" unexpected
failed to boot sleeping forever.

I placed the live CD in my system booted from there was able to view the file in readonly but can not change it because its mounted form the live cD permissions wont allow me to edit.

I attempted to edit by using Grub and pulling up command line but I dont no how to get to the file from there to edit.
How do I edit the config file without being able to boot to get rid of the ";" in the config file so it will boot?

Thanks for help.
0
LeadCo
Asked:
LeadCo
  • 5
  • 3
  • 2
  • +1
4 Solutions
 
pritamduttCommented:
You can boot the system using livecd and remount the filesystem in rw mode using the mount command

mount -n -o remount,rw /

Open in new window


Hope this helps
0
 
Christopher Raymond MendozaCommented:
Have you tried booting the disk in rescue mode? From there you should be able to access and modify the file.
0
 
LeadCoAuthor Commented:
Sounds good however I dont know how to do that. Afraid I am not a linux tech. Can you give me a step by step?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
pritamduttCommented:
I have given u the command to remount the disk in read-write mode.

Follow the link given below to boot in rescue mode as suggested also

http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-rescuemode-boot.html
0
 
amitnepalCommented:
Just do a reboot of the machine and follow the steps below :

1. Press a when you are in the boot menu , it will show three lines in your screen, press e and it will take you inside the second line, put space and then type 1 and press enter, it will take you back to three lines menu. now press b

2. the above will take you to single user mode.
3. Now you need to do a remount as mentioned by pritamdutt
mount -n -o remount,rw /

4. Now make necessary changes to your file and then reboot and you should be fine.
0
 
LeadCoAuthor Commented:
With the above instruction I do not use the live CD correct? I let it got to regular reboot and press any key to go to boot menu where I can press a,e,c etc...

Is that correct?

Then step 2 it will take you to single user mode: Will it boot up or just give me a prompt like command line where i run mount -n -o remount,rw /. If not where do I run the mount -n -o remount,rw /
0
 
pritamduttCommented:
yeah that should boot you into what we call Single User Mode.

Try if it fails then you have another two options:
1. LiveCD and
2. Rescue Mode.


Happy Learning!
0
 
LeadCoAuthor Commented:
Ok I have in singel user mode I ran the  mount -n -o remount,rw /

I  am familar with nano to edit files but that don't seem to be a recognized command. How do I get to /etc/selinux/config and make the edit?

0
 
LeadCoAuthor Commented:
This did not fix my issue but it prob would if i new how to access the right file and edit it.
Thanks for help.
0
 
amitnepalCommented:
you can do
 vi /etc/selinux/config

 to edit the file, press i before you can start modifying and after you are done modifying the file, press escape and then :x to save and exit the file.

vi should work
0
 
LeadCoAuthor Commented:
Ok I got it, simple.

I loaded the Live CD and when it was doing the auto login after boot and I hit escape and clicked login as other user: root no password was neccessarry, and I could access the drive from gui pull up file and edit and save.

Thanks all.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now