8

I have this error... Slow boot, I've read other questions about that,but I don't know how to Edit fstab

  • Note that I'm dual booting 2 Linux OS

I tried this commend to Open up the fstab:

gksudo gedit /etc/fstab

It comes up like this:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=be7d4a16-5c69-... /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
UUID=ad0b043b-68a6-... none            swap    sw              0       0

I use this commend too:

ls -l /dev/disk/by-uuid

What should I do?? Should i just add # in fstab at the beginning of this line?:

UUID=ad0b043b-68a6-... none            swap    sw 

I tried to do that(leaving # and space) but when i wanna save fstab i faced with warning in terminal which says:

** (gedit:13456): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported

** (gedit:13456): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

My changed fstab is here:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=be7d4a16-5c69... /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
# UUID=ad0b043b-68a6... none            swap    sw              0       0

A screen shot from gparted: is here

I think The extended partition /dev/sda2 is an other Linux OS that I have in my SSD

/dev/sda1 is root of Ubuntu /dev/sda5 is swap(of other Linux OS?I think)

A Screen shot from 1 TB HDD: is here

There is an error in /dev/sdb5 It is about the free space in my HDD...It's not important.

Sss
  • 1,012
  • 6
  • 16
  • 34
  • I can't see your partition UUID=ad0b043b-68a6-484c-961e-378ac3ccf875 (swap) in your list of partitions; so this will be what your system is waiting for. i assume you reformatted 'swap' changing its UUID (unique ID), so the ideal fix is to change the id to reflect whichever partition (it was sda6) swap is now. if you deleted swap; the # addition (commenting out line) is best. either way I'd # out line, and make change in following line, plus a # [comment] line describing what you did, date etc. – guiverc Sep 15 '17 at 08:47
  • 2
    Your swap line in /etc/fstab is wrong, and that's why your boot is so slow. Edit your question (not into the comments please) to include the `terminal` output of `cat /etc/fstab` and `sudo blkid` and I'll give you instructions to fix it. Ping me at `@heynnema` when you have this info. – heynnema Sep 15 '17 at 14:53
  • Please do two things run `blkid` and `lsblk -f`, `cat /etc/fstab` and paste it into your question your `/etc/fstab` seems to be off – George Udosen Sep 15 '17 at 15:55
  • @heynnema thank you... I fixed it with inseting # at the beginning of last line in fstab... it works fine... but i had a warning when i trying to save fstab... in terminal.... that says: ** (gedit:5506): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported ** (gedit:5506): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported why and what is happening? after i open fstab again... i saw it changed too what i wanted...but now my question is about that warning... – Sss Sep 15 '17 at 18:38
  • @sina did you leave the # in the swap line, or did you follow my answer? You don't want to leave the #. – heynnema Sep 15 '17 at 19:23
  • @heynnema edited question... now u can see what i did... I tried that before u answered my question... I didn't try yours... – Sss Sep 15 '17 at 20:33
  • @sina your computer is working without a swap file now. You shouldn't leave it like that. Please follow my procedure. It's not difficult, and it'll provide a real fix. Actually, before you do it, show me a screenshot of `gparted`. – heynnema Sep 15 '17 at 22:48

3 Answers3

3

Your swap line in /etc/fstab is incorrect.

Update: We're going to have to create a new separate swap partition for Ubuntu...

Make sure that you have a good backup of your important Ubuntu files, as this procedure can corrupt or loose data.

Keep these things in mind:

  • always start the entire procedure with issuing a swapoff on any mounted swap partitions, and end the entire procedure with issuing a swapon on that same swap partition

  • a move is done by pointing the mouse pointer at the center of a partition and dragging it left/right with the hand cursor

  • a resize is done by dragging the left/right side of a partition to the left/right with the directional arrow cursor

  • if any partition can't be moved/resized graphically, you may have to manually enter the specific required numeric data (don't do this unless I instruct you to)

  • you begin any move/resize by right-clicking on the partition in the lower part of the main window, and selecting the desired action from the popup menu, then finishing that action in the new move/resize window

Do the following...

Note: if the procedure doesn't work exactly as I outline, STOP immediately and DO NOT continue.

  • boot the a Ubuntu Live DVD/USB
  • start gparted
  • resize (shrink) sda1 by moving the right side of the partition to the left, reducing it by 3G
  • create a new swap partition in the newly unallocated 3G space, note the sdaX number
  • click the Apply button
  • quit gparted
  • optional...
    • open terminal
    • type sudo fsck -f /dev/sdb5 # to fix errors on sdb5
  • reboot to Ubuntu

In terminal...

sudo blkid # copy the full /dev/sdaX UUID to the clipboard

sudo cp /etc/fstab /etc/fstab.bak # backup the file first

gksudo gedit /etc/fstab # edit the file, save, and quit gedit

Change this:

# swap was on /dev/sda6 during installation
UUID=ad0b043b-68a6-... none            swap    sw              0       0

To this:

# swap was on /dev/sdaX upon reconfiguration
UUID={put UUID for sdaX here} none            swap    sw              0       0

Notice the ... in the UUID numbers. The number is cut off. You need to use the full UUID taken from the sudo blkid command for /dev/sdaX.

Still in terminal...

sudo swapon -a # observe no errors when enabling swap

reboot

Update #1:

After reviewing a screenshot of gparted, it looks like something else is going on. /dev/sda6 USED to be swap, but now it's a Ext4 partition, and /dev/sda5 is a swap partition. It may be a swap for another OS. I've slightly adjusted my procedure.

Update #2:

Turns out that /dev/sda5 was a swap partition for another OS. We're going to have to create a new separate swap partition for Ubuntu. I'll rewrite some of my procedure. I'll also add a fsck for /dev/sdb5 that has errors.

heynnema
  • 68,647
  • 15
  • 124
  • 180
  • I followed this step by step...but in the last command:'swapon -a # observe no errors when enabling swap' terminal denied Permission: " swapon: cannot open /dev/sda6: Permission denied " – Sss Sep 16 '17 at 13:22
  • anyway inserting #+space before UUID=ad0b043b-68a6-... works fine... – Sss Sep 16 '17 at 13:28
  • 2
    @sina **NO**. Commenting out that swap line just totally disables the swap. **That's not the correct fix**. Do as I suggested... show me a screenshot of `gparted`, let me review it so I can update my procedure if need be, then do my procedure. – heynnema Sep 16 '17 at 14:04
  • 1
    A Screen shot from the gparted added to the question – Sss Sep 16 '17 at 15:14
  • @sina thanks for the screenshot. It's a good thing that I looked at it. Please describe your disk configuration. Do you have more than one disk? Is /dev/sda your SSD? Do you have any other OS's installed. If so, how do you boot them? How have you recently modified your OS installations? Something looks strange. – heynnema Sep 16 '17 at 15:30
  • Yes i have an other Linux Debian distributions... I had installed both OS in SSD 128... and I use 1 TB HDD as '/home' ... and i dual boot both of them from grub boot loader which installed in SSD – Sss Sep 16 '17 at 15:38
  • @sina Let me see a screenshot of gparted of your 1TB disk. I'm looking for another swap partition. How much RAM do you have? – heynnema Sep 16 '17 at 15:53
  • @sina I'm going to have to rewrite some of my procedure to accommodate your current configuration. Give me a few minutes. I'll let you know when I'm done. How much RAM do you have? – heynnema Sep 16 '17 at 15:56
  • Added a screenshot of HDD... My system: Msi GE62 6QD - C .... RAM:16GB – Sss Sep 16 '17 at 15:58
  • @sina In light of the new information, I've updated my procedure. Report back. – heynnema Sep 16 '17 at 16:12
  • OK thanks in advance.... so it will fix the warning which I faced in terminal? – Sss Sep 16 '17 at 16:30
  • @sina the gedit error will probably still be there, but the swapon error will be gone, and your system will be properly running with a swap partition. – heynnema Sep 16 '17 at 16:57
  • @heynnema I am struggling with a [similar issue](https://unix.stackexchange.com/questions/496298/slow-boot-time-after-cloning-disk-and-resizing-partitions). It you have time to look at it. – JJD Jan 24 '19 at 14:48
  • @JJD Although I hate to ask... 'cause you've done a great job documenting your question... assuming this is Ubuntu... can you move it here to AU and then delete the other (they frown on asking the same question in two places)? Ping me at "@heynnema" when that's done. Also, when you "moved" your swap to the end, the UUID shouldn't have changed. Did you delete the original swap and then re-create it? Show me `swapon`. – heynnema Jan 24 '19 at 15:00
  • @heynnema I intentionally posted my question at the Unix & Linux stackexchange because I don't know if the problem is Ubuntu specific. - Yes, I deleted the swap and re-created it. Executing `swapon` outputs `/dev/sda5 partition 9.8G 512K -2`. – JJD Jan 24 '19 at 16:38
2

I too have encountered this error, answer #1 should work fine, I am familiar with fstab,terminal, gparted,this is how I fixed in a few minutes. Open terminal type gksugedit locate and open etc/fstab

Open gparted locate swap partition you will be using,right click, select swapoff, if none is present follow heynnema how to create new swap partition,right click again and highlight and copy complete UUID for swap partition, do not close gparted yet

In gedit, highlight existing UUID for swap,right click and paste new swap UUID over old UUID,double and triple check you have complete UUID every digit and save, I also recieved the same error,(gedit:5506): WARNING **: Set document metadata failed, proceed anyway this will not affect the repair

Go back to gparted, select swap partition, right click,slect swapon.

Close everything and reboot. Take notice did boot time improve? Is the error still in your boot log? for me the problem was solved.Thank you heynnema

Joe Wicz
  • 41
  • 2
0

Thanks everyone involved.I know very little on fstab and gksudo. I have the same problem. I did followed @Joe Wicz and have issue fixed. Now it booted fast as always.

I follow your instruction it is easy but with little problems. so I write this comment to help other newbies.

  1. confirm the issue started after re-partition swap file to install 2nd Lubuntu. When I booted Ubuntu it booted so slow I press F1 so it show the start job is running for dev-disk-by x2duuid............... (... 1 min 30 seconds) I took the photo using my mobile phone to record the missing "uuid"

  2. your command "gksugedit" was brief it produce error (I just copied not understood). so I use "gksudo gedit /etc/fstab" from top post, it produce "NO Command.... error with the last line telling me how to install the gksudo. I copied and installed gksudo.

  3. open gparted and find the swap partition. Mouse right click open the new window. go to the last menu "information" click on it. It will provide uuid copy that ID (uuid). (if you see the "swap off" above "information" click "swap off" to turn off the swap partition"

  4. Go back to the terminal key in "gksudo gedit /etc/fstab" (with out the " ") After press enter the new window will pop up.

  5. Check if the last line is the same uuid that you took the photo of the slow booting looking for uuid from No.1, to confirm the issue, mine is the same it means that THIS ubuntu is looking for the swap partition using the old uuid.
  6. I just paste the copied uuid from no.3 and Click SAVE on the top right hand corner. the window will close. Ignore the error in the Terminal.
  7. Go back to Gparted and right click on Swap Partition and click on the Swap ON to make Swap Partition ACTIVE.
  8. Reboot. My Ubuntu is working fast boot as usual.

If you have problems not working as I have done. Please Ask those above 2 gurus. I just dumm follower.

aimwin
  • 15
  • 4