0

To start with, I am very new to Linux and Ubuntu in general (only had it a couple months) and so am operating off of what I have learned from actually using Ubuntu in that time.

I am currently running Ubuntu 18.04.1 LTS (Bionic Beaver) on a HP Compaq machine and until recently, everything was working nearly perfectly.

However, I decided to try expanding my storage and options by adding another hard drive, to store my /home folder on. Looking around, I found what looked to be the best way to do it: Partitioning/Home/Moving

Following those instructions, I immediately ran into errors, so I decided to try another way. To make a long story short, I eventually figured out how to get into my /etc/fstab file and tried adding a line on to mount my second hard drive. Unfortunately, I didn't know to make a backup originally, though I did (accidentally) after adding the line on the end. But when adding the line onto the end of the fstab file, as shown in the directions from that link, I encountered some weird warnings in the terminal when I saved the Gedit file. Looking those up, I found that Gedit had a bug that generates those warnings. I don't know how or why, as I am, after all, just a beginner.

Anyway, while messing around, trying to get the one line added on, I must have changed something somewhere, because when I restarted my computer, the /etc/fstab file failed to mount. Here's what it looked like the first time:"Failed to mount /etc/fstab" error And this is what I got after typing in the command for more info: details on "Failed to mount /etc/fstab" error

Thinking I had just accidentally put in an extra number or something, I inserted my Ubuntu installation DVD, booted into "Try Ubuntu" mode, and tried to edit my fstab that way. Although I was able to get into, view, and edit my fstab, I couldn't figure out how to save it, and it kept saying that "/dev/sda1/etc/fstab not a directory". Here's what it looked like: Ubuntu installation disk terminal The /etc/fstab file as shown in this picture is exactly how it was before all this started, with the exception of the last line that I added on. The middle two lines in the picture got clipped by the edge of the terminal (didn't have the window expanded enough), but they are still the original, unedited entries. Everything above that last UUID entry is exactly as original.

Since then I have tried editing the fstab in a couple different ways, trying to get it to where it will at least boot my main drive (the first UUID entry in the last picture). So far, nothing seems to work. Every time I turn on the computer it goes into emergency mode and tells me that /etc/fstab has failed to mount. Is this a problem with the contents of the fstab file, or did something else get messed up? I really can't remember doing anything else at first other than adding the one line on the end. Also, does the number of spaces in an fstab entry really matter? I have tried to read up on fstab, but I've never really seen any mention of spaces being important or not.

Any help on what to do and how to do it, to get my Ubuntu up and running again would be VERY much appreciated. Right now, I'd be happy with just my main drive booting again. Also, clarification on adding a line to the fstab would be useful too. Once again, I am not very good with Linux or computers at all, so only basic computer language would be helpful.

Thanks,

Kaleb

Update: If it is any help to those who commented on this post, these are my options when saving my fstab file in Gedit via the live DVD.

  • 1
    Please use a LiveUSB and the run fsck -y on all your partitions except the one with the efi files that should be /dev/sda1! I wish you had done sudo mount -a before the reboot to ensure all went well. – George Udosen Dec 28 '18 at 6:37
  • 1
    It looks to me like the /etc/fstab file was saved with UTF16 character encoding (perhaps because of your default locale, or maybe because you configured gedit to save it that way) - the error message What: <U+FEFF> seems to be referring to a UTF16 byte order mark – steeldriver Dec 28 '18 at 14:36
  • 1
    ... so the simplest fix will probably be to boot with the live DVD, install dos2unix (you may need to enable the universe repository) then mount your old root partition in rw mode and run dos2unix on the /etc/fstab file. Make a backup of the file first in case anything goes wrong. – steeldriver Dec 28 '18 at 15:58
  • Unfortunately, I can't seem to make steeldriver's suggestion work, going off of what instructions I could find. I booted from the live DVD, opened a terminal and typed sudo add-apt-repository universe as directed by one website. Although it gave me a few errors, it did say that the "universe repository" had been enabled. However, when I tried to enter sudo apt-get update and sudo apt-get install -y dos2unix, it said "E: unable to locate package dos2unix". Am I doing something wrong here, or is there a better way to do this? Further instructions or optional methods would be helpful. – Kaleb Dec 28 '18 at 20:56
  • 1
    If you file /etc/fstab does it report the file as ASCII text? (the command file reports on what type of file it is from the contents of the file; this will provide nothing new except confirmation that steeldriver was correct, and you need to convert your file to ascii; be it using save-as from a gui-editor (that allows you to select format using live-media) or conversion utility like steeldriver was suggesting you try). Also when you tried a command, telling us it gave me a few errors doesn't allow us to help unless we know what those errors were (ie. significant?/irrelevant?) – guiverc Dec 29 '18 at 5:07
1

After much help from others and little bit or work, my problem has finally been resolved, no thanks to my limited computer skills.

However, the answer was quite a bit different than I thought it would be. The root of the error was that my /etc/fstab file was encoded in UTF-8, which is how gedit saved the file, and it needed to be in ASCII. Although I'm sure more experienced Linux users know a way to convert the one to the other, I couldn't seem to make it work right.
Instead, I took @steeldriver's advice and decided to re-make my fstab file completely.

Fortunately, I had a near-entire back-up of the original file, so the details of writing it were not a problem. The steps I took were: Booted from live Ubuntu DVD> mounted my original root drive> created a new folder and file in the /etc folder using terminal> pasted fstab entries into the new file using sudo nano to edit in the terminal> moved that file into /etc> deleted original fstab file> and renamed the new file as fstab to replace the original. I then rebooted without the live DVD and everything started normally, with no errors. I'm sure there are better ways out there to do this, but this just happened to be what worked in my situation.

Thanks again to everyone who helped me with this problem. It's so good to be able to use my computer normally again.

-Kaleb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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