Stiggy2120
Posts: 3
Joined: Tue Apr 18, 2017 3:12 pm

Jessie won't boot after editing sudo nano /etc/fstab

Thu Apr 20, 2017 8:36 pm

I was trying to map a nas drive to my raspberry pie I set it to auto mount in sudo nano /etc/fstab
But it never mapped now I can't boot my pie into Jessie is there a way to remove that line of code so that I don't have to do a full reinstall

ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

Re: Jessie won't boot after editing sudo nano /etc/fstab

Fri Apr 21, 2017 12:13 am

You'll likely need another computer which is capable of mounting the micro SD card with read and write capability for Ext4/Ext3/Ext2 partitions. By default, Windows and macOS/OS X will not be able to mount the Ext4 root partition (where the /etc/fstab file is located) of the card and will only give you access to the boot partition.

What computer(s) do you have access to and what operating system(s) do they run? There is some free and commercial (with trial versions) software which will allow you to do this on Windows and macOS/OS X. It isn't perfect, but I've used ExtFS for Windows from Paragon on Windows in the past (they also offer ExtFS for Mac 10). With some effort, you may be able to use Homebrew packages on macOS/OS X (Search for instructions). I haven't tried it, but you might try http://www.ext2fsd.com/ on Windows.

You can also do this on a Pi if you have a spare micro SD card and a USB micro SD card reader. You can install another copy of Raspbian on that spare card and edit your current troublesome installation by using a USB micro SD card reader plugged into the Pi.

You may also be able to boot a laptop/desktop computer using a live CD (such as Ubuntu -- https://help.ubuntu.com/community/LiveCD) and edit the /etc/fstab file from there.

Stiggy2120
Posts: 3
Joined: Tue Apr 18, 2017 3:12 pm

Re: Jessie won't boot after editing sudo nano /etc/fstab

Fri Apr 21, 2017 4:44 am

I have windows but I also have an Ubuntu live usb I also have a spare sd card I would percent go the Ubuntu route so my next question is how do I mount and edit the file will it be easy to find do I do all of this in command line or graphical in help is much appreciated

ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

Re: Jessie won't boot after editing sudo nano /etc/fstab

Fri Apr 21, 2017 7:16 am

OK. The Live USB should work. Does the Windows computer have something like a full-size SD card reader slot? Do you have an adapter for the micro SD card so you can insert it into that larger SD card slot? I'm not sure if the partitions on the SD card will automatically mount or not.

The command lsblk may help you identify the name of the SD card and partitions. Here is an example of that command output on one of my computers running Xubuntu with a 16 GB micro SD card (which has Raspbian Jessie installed) inserted into a USB SD card adapter:

Code: Select all

[email protected]:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  78.4M  0 loop /snap/core/1577
loop1    7:1    0  78.3M  0 loop /snap/core/1441
loop2    7:2    0  78.2M  0 loop /snap/core/1512
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   200M  0 part /boot/efi
├─sda2   8:2    0  46.6G  0 part 
├─sda3   8:3    0 229.7G  0 part 
├─sda4   8:4    0 619.9M  0 part 
├─sda5   8:5    0 619.9M  0 part 
├─sda6   8:6    0 619.9M  0 part 
├─sda7   8:7    0 619.9M  0 part 
├─sda8   8:8    0   177G  0 part /
└─sda9   8:9    0   9.3G  0 part [SWAP]
sdb      8:16   1  14.9G  0 disk 
├─sdb1   8:17   1    63M  0 part 
└─sdb2   8:18   1  14.9G  0 part 
The 16 GB micro SD card containing Raspbian Jessie in the output above is named sdb. The boot partition is named sdb1 (63 MB) and the root partition is named sdb2 (14.9 GB). You can also see in the output that the partitions are not mounted, otherwise it would show a file system location under the MOUNTPOINT column such as the mount points listed for sda1 (/boot/efi) and sda8 (/). If the output of lsblk shows that the card is already mounted after inserting the micro SD card, you may want to unmount them first or you can just use the mount point location listed for the root partition in the lsblk command output. You can become root with the command sudo su or just prefix commands with sudo.

So, let's say I wanted to mount the Raspbian root partition (sdb2) to a location in my home directory (in Xubuntu) for editing the fstab file. Using a terminal emulator application (GNOME Terminal in my case), I could do the following:

To begin with, I might unmount the partitions on the SD card (in case they have automatically been mounted upon insertion of the card).

Code: Select all

[email protected]:~$ sudo umount /dev/sdb1 /dev/sdb2
I could then create a directory to use as a mount point for the root partition.

Code: Select all

[email protected]:~$ mkdir raspbian-root
Then I could mount the root partition to that directory.

Code: Select all

[email protected]:~$ sudo mount /dev/sdb2 raspbian-root
If I then ran the lsblk command again, I'd see a mount point for the root partition (/home/ktb/raspbian-root).

Code: Select all

[email protected]:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  78.4M  0 loop /snap/core/1577
loop1    7:1    0  78.3M  0 loop /snap/core/1441
loop2    7:2    0  78.2M  0 loop /snap/core/1512
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   200M  0 part /boot/efi
├─sda2   8:2    0  46.6G  0 part 
├─sda3   8:3    0 229.7G  0 part 
├─sda4   8:4    0 619.9M  0 part 
├─sda5   8:5    0 619.9M  0 part 
├─sda6   8:6    0 619.9M  0 part 
├─sda7   8:7    0 619.9M  0 part 
├─sda8   8:8    0   177G  0 part /
└─sda9   8:9    0   9.3G  0 part [SWAP]
sdb      8:16   1  14.9G  0 disk 
├─sdb1   8:17   1    63M  0 part 
└─sdb2   8:18   1  14.9G  0 part /home/ktb/raspbian-root
The following command shows a basic file and directory listing for the raspbian root partition which I mounted in the previous command.

Code: Select all

[email protected]:~$ ls raspbian-root
bin   debian-binary  etc   lib         man    mnt  proc  run   srv  tmp  var
boot  dev            home  lost+found  media  opt  root  sbin  sys  usr
Then I could use a text editor application such as nano to edit the fstab file.

Code: Select all

[email protected]:~$ sudo nano raspbian-root/etc/fstab
The above command will open the fstab file in nano for editing. I can make any changes I wish and when finished, press the Ctrl and x keys together, then press the y key and then finally press the Enter key.

To be sure the changes are written to the card before unmounting it, I could use the following command.

Code: Select all

[email protected]:~$ sync; sync
Then I could unmount the root partition with the following command.

Code: Select all

[email protected]:~$ sudo umount /dev/sdb2
If I were to run the lsblk command again, I'd see that the root partition has been unmounted.

Code: Select all

[email protected]:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  78.4M  0 loop /snap/core/1577
loop1    7:1    0  78.3M  0 loop /snap/core/1441
loop2    7:2    0  78.2M  0 loop /snap/core/1512
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   200M  0 part /boot/efi
├─sda2   8:2    0  46.6G  0 part 
├─sda3   8:3    0 229.7G  0 part 
├─sda4   8:4    0 619.9M  0 part 
├─sda5   8:5    0 619.9M  0 part 
├─sda6   8:6    0 619.9M  0 part 
├─sda7   8:7    0 619.9M  0 part 
├─sda8   8:8    0   177G  0 part /
└─sda9   8:9    0   9.3G  0 part [SWAP]
sdb      8:16   1  14.9G  0 disk 
├─sdb1   8:17   1    63M  0 part 
└─sdb2   8:18   1  14.9G  0 part
That should be it. Let me know if you have questions.

Stiggy2120
Posts: 3
Joined: Tue Apr 18, 2017 3:12 pm

Re: Jessie won't boot after editing sudo nano /etc/fstab

Sun Apr 23, 2017 3:47 am

thanks was able to use the paragon program to do it 15 seconds and itwas back up however i cannot figure out how to get nas mounted i have a linksys nas 200 and cannot get it to mount can anyone help me would really like to use it if not i guess its add a second hdd to my pi any good solutions to that would aso be helpfull

auroden
Posts: 2
Joined: Thu Nov 16, 2017 3:27 am

Re: Jessie won't boot after editing sudo nano /etc/fstab

Thu Nov 16, 2017 3:39 am

There is a simple solution for this trouble. I have also screwed up two microSD cards by editing/adding one line into the fstab file. Instead of making new copy of Raspbian from a saved image and waiting 2 hours to copy and verify with Etcher, go ahead and have a Live CD copy of any Linux distro. Boot a live Linux from a CD and voila. You have your fstab file available for editing with Text Editor. It is found in the Root Directory and ETC Subdirectory. Simply delete the wrongful line you added and the SD card with boot nicely the way it used to. I forgot to mention you need an SD/uSD card reader ($3.00 online). Good luck.
P.S. I don't even dare to edit that stupid file to auto mount my external USB drive. Never worked for me while manual Mount/Unmount works fine.

User avatar
HawaiianPi
Posts: 4254
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Jessie won't boot after editing sudo nano /etc/fstab

Sat Nov 18, 2017 9:24 am

auroden wrote:
Thu Nov 16, 2017 3:39 am
...Instead of making new copy of Raspbian from a saved image and waiting 2 hours to copy and verify with Etcher
2 Hours? :shock: :?

auroden wrote:
Thu Nov 16, 2017 3:39 am
Simply delete the wrongful line you added and the SD card with boot nicely the way it used to.
I would comment it to figure out what was done wrong, then fix it.

auroden wrote:
Thu Nov 16, 2017 3:39 am
I don't even dare to edit that stupid file to auto mount my external USB drive. Never worked for me while manual Mount/Unmount works fine.
Works fine for me. What problems were you having?
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “Raspbian”