If I boot the system in single user mode, can we directly edit the file?

Slow down chap, breathe in! Heh heh.
Because all of your posts are related; rather than creating four separate threads, you could have created one thread and asked all of your questions together in the one place!

Also, in order for anybody to help diagnose your problem with any degree of accuracy, we'll need some more information from you. All we've got so far from four separate threads is very vague information about a system that won't boot with some equally vague questions.

To allow us to help you more effectively we'll need some more solid details like:
What distro are you running and which version?
What are the specs of the machine?
What version of grub are you using?
What are the exact problems you are experiencing?
e.g.
- How far does the boot process go before it fails?
- Are you seeing any error messages from the system during boot?
- Did the problem start after any significant changes, updates or upgrades to hardware or software on the machine?
etc....

As a very general tip for this type of situation, you could try booting your machine using a Linux live CD/DVD. Either as a CD, DVD or installed on a USB stick. Once the LiveCD environment has booted, you can mount the internal hard-drive of the machine and do whatever you need to do to solve your problem e.g.:
- Check the HD and its file-systems using fsck, or some other tool
- Back-up/recover important data to another removable drive
- Check any system logs on the HD for error messages from boot processes
- Edit any config files
etc....

If the HD has failed, or has errors; as long as it will at least mount, the best you can hope for is to back-up or recover any important data to another drive and you'll have to replace the drive and reinstall the OS from scratch. But if the HD and filesystems on it are healthy, then it is most likely a config file somewhere that is set up incorrectly, or has become corrupt. The only way of determining this will probably be to check the system logs on the HD for any error messages from processes during recent reboots. Once you've identified problems with a particular boot process, you'll need to find the relevant configs and edit them appropriately.

Once you think you've isolated and fixed the problem, you can shutdown the machine, remove the live CD/DVD/USB media and reboot from the hard-drive to see if you managed to fix the problem. If it works, great. If not, you can simply reboot into the liveCD environment again and repeat the process until you have solved your problem.

Otherwise, if you have too many problems trying to fix your system from a live environment and the HD and filesystem are healthy, you could always back up any important documents/data and reinstall the system from scratch.

Hope this is of some help to you! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.