Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It seems that I have added incorrect record to /etc/fstab:

//servername/share    /mnt/share    cifs     defaults,username=myuser     0 0

When I did mount -a, it asked user password to mount network share. It seems that it cannot proceed without password on boot, so it is just hung.

How can I fix fstab to prevent boot failure?

share|improve this question
up vote 9 down vote accepted

It seems that I've found a solution:

  • at the grub prompt, hit a to append options
  • add init=/bin/bash to the end of the kernel command line and press enter

The system will boot to a prompt like 'bash-3.2#' enter the following commands at the prompt

  • mount -o remount,rw /
  • vim /etc/fstab

edit the fstab file commenting the errors by adding a # at the begining of each problematic line, save the file

  • reboot by pressing CTRL+ALT+DEL
share|improve this answer

How about removing the entry, creating a snapshot and then trying to change your /etc/fstab so you have a working snapshot you can roll back to?

According to the manpage mount.cifs you can also specify a password via password=arg. Also, according to that manpage there is no argument username=arg but instead user=arg. But it might be different on your system, better check your manpage for the correct argument names.

share|improve this answer
    
man for the win. – Tim Jul 26 '12 at 13:22
    
I was about to create snapshot, but while I was experimenting with fstab, vm instance went off for some reason. Apparently, I wouldn't ask the question if I could fix it myself. – altern Jul 26 '12 at 13:31
2  
Your problem description is a little bit unclear. Can't you boot in single user / recovery mode? It should only try to mount the root fs and leave the fstab alone. – scai Jul 26 '12 at 13:54

The other easy way is booting to live-cd mode and mount the right partition. Then you can fix anything you want!

share|improve this answer

I found a solution to systems error kernel not loading Use live cd to gain access to your existing installation. Once in reinstall Linux kernel :

pacman -S Linux

Then delete the fstab file from etc/fstab :

rm /etc/fstab

Now reinstall systemd:

pacman -S systemd

When reinstalling systemd it will automatically generate a new fstab file

Now reinstall the bootloader in this case I use grub:

pacman -S grub os-prober

(os probe is useful if you have more than 1 os installed on your hdd/ssd) Then

grub-install --target=i386-pc /dev/sda

Once finished make the configuration files:

grub-mkconfig -o /boot/grub/grub.cfg

Then unmount the partitions in use and reboot

umount /dev/sdX 
reboot

This should fix the problem, it worked for me.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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