[Solved] I have an error in my /etc/fstab file, now I cannot get my rig to boot

Status
Not open for further replies.

pizzaazzip

Dabbler
Joined
Dec 3, 2015
Messages
25
So I was messing with my /etc/fstab file, had a typo and now I can't boot. During the boot process I get a few
Code:
fstab: /etc/fstab:3: Inappropriate file type or format

until it gets to
Code:
ERROR: ABORTING BOOT (sending SIGTERM to parent)!
Dec 5 22:29:26 blade init: /bin/sh on /etc/rc terminated abnormally, going to single user mode
Enter full pathname of shell or RETURN for /bin/sh:

and does not go any further. I found a forum post about freeBSD in general that detailed how to make changes to files in single user mode and have them save but I can't seem to get it to work. Apparently fsck -y does not work in freenas. Anyone have any suggestions on how to save changes to my fstab file? All I need to do is comment that line out for now.

Edit: To fix broken file just hit enter and type nano /conf/base/etc/fstab because I believe /etc/fstab is generated on boot from the /conf/base/etc/fstab file.
 
Last edited:

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
"fsck -y" doesn't work in FreeNAS because the boot filesystem is ZFS.

Revert the file back and reboot the system.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Take the copy of the file that you made before you began adventuring and copy it back to /etc/fstab
 

pizzaazzip

Dabbler
Joined
Dec 3, 2015
Messages
25
Could you explain how to do this? As far as I can tell, single user mode is read only so copying a backup file over is easier said than done.
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
Can you not boot to an older boot image on the boot device, as a last ditch way to revert?

Also, I suspect I will regret asking this, but I can think of not a single reason on the planet that I would be messing with the appliance's /etc/fstab. Am I perhaps the only one misunderstanding what you're saying? If not, can you tell me what was on your mind when you began to mess with the fstab file?
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
There should be no reason to edit the fstab by hand.
Indeed. I've been sitting here meditating on it for about 20 minutes, and I literally can't think of a reason I'd even WANT to do that, even if I didn't know how bad of an idea it was.
 

pizzaazzip

Dabbler
Joined
Dec 3, 2015
Messages
25
I had a SMB share mounted from another NAS. I rebooted to update and it cleared it so I wanted it to stay. I had it working but I messed with it because the boot process was asking for a password and I could not figure out how to get around that hence the messing. I'm uploading a youtube video to better explain.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Could you explain how to do this? As far as I can tell, single user mode is read only so copying a backup file over is easier said than done.

Remount the filesystem for read-write, of course. "mount -u -o rw /" is what my finger memory says, though for all we know, that might be a SunOS 4 incantation.
 

pizzaazzip

Dabbler
Joined
Dec 3, 2015
Messages
25
Uue0Dpv.jpg


still doesn't let me save fstab after I run that
 

pizzaazzip

Dabbler
Joined
Dec 3, 2015
Messages
25

Here is the youtube video. I know it doesn't sound like it in the video, but I really appreciate all of you helping me (I think I sound like a jerk when I'm recording, sorry about that). This is just to make sure we are on the same page
 
Last edited:

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Hmm. Most Youtube doesn't make it very easily thru the UTM here. But I guess the question is, what's the contents of /etc/fstab, and what's actually mounted. I'm not actually that familiar with FreeBSD systems booting from ZFS and where the magic happens in the boot sequence for a ZFS filesystem to mount. So, two things, show us the contents of /etc/fstab

Code:
# cat /etc/fstab


and then also

Code:
# df /


In theory you can twiddle a fs back and forth between rw and ro.

Code:
# df /
Filesystem                                        1K-blocks    Used    Avail Capacity  Mounted on
freenas-boot/ROOT/FreeNAS-9.3-STABLE-201506292332  29232715 1043211 28189503     4%    /
# mount -u -o ro freenas-boot/ROOT/FreeNAS-9.3-STABLE-201506292332 /
# mount -u -o rw freenas-boot/ROOT/FreeNAS-9.3-STABLE-201506292332 /
#


But I don't really know how that interacts with a broken /etc/fstab offhand.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Why not just reinstall the system and upload your saved config? (I hope you backed up your config)

But at the same I'm curious to know how to solve the problem without re-installing :)
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
Also,

A **VERY** good rule of thumb, when dealing with an **APPLIANCE**, like FreeNAS, versus, **SOFTWARE**, like FreeBSD, is that an APPLIANCE, like other appliances (toasters, laundry machines, dildos) are not meant to be fucked with (well, ok, maybe dildo wasn't the best choice here given this phrasing). Any choices you have will be provided to you with dials, buttons, etc. If you find you have to do something to FreeNAS for which the developers have not provided a "button", or setting, or something, in the GUI, then almost certainly you do *NOT* want to do that, and doing so represents much more risk than benefit (because if it did not, then presumably, we'd give you a button for it.)
 

pizzaazzip

Dabbler
Joined
Dec 3, 2015
Messages
25
Yeah, hindsight is 20/20. I've only been using freenas for about a week so I'll make sure next time I mess with the files, I'll backup my configuration. This has all been a learning experience for me. I'll try Jgreco's suggestion tonight. I also wish I could figure how to mount the USB boot drive to another machine and modify it that way. I made a freebsd live CD in hopes for me to modify things that way, i also installed zfs support on both Ubuntu and os x but still wasn't able to figure that out.
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Disregard, just remembered that /etc is tmpfs and built on the fly at boot.
 
Last edited:

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I'm more curious to see what actually IS in the fstab. I'm an old-time curmudgeon who has spent many hours manually editing partition tables and moving crap around on live production systems since the old SunOS days, and the ZFS auto-magic-mounting stuff leaves a bit of a bad taste in my mouth.

The answer to this might involve specifying an alternative, corrected fstab file (-F) but the interactions with ZFS are new to me.
 
Status
Not open for further replies.
Top