4

I am currently using a Lenovo laptop with Ubuntu 18.04.1 LTS dual-boot configured with Windows 10. Recently, I wanted to free some space from my windows partition and add it to my Linux partition. I could de-allocate some 200GB space, but it was not contiguous to my /home drive. It was something like this(only the amount of space was more):

This is the image after I undid all the partition changes

So I used the swapoff option from the gparted and was able to shift the swap partition. When I was shifting the root partition, it failed (I don't have the logs), so I had to again bring back the swap, to re-allocate the space to windows and keep things as they were. Then, I figured, the swap was no longer working like it should (it was not active), so I formatted it as linux-swap and the UUID changed. The problem started then. When I boot into Ubuntu, the screen remains blank for ages until Ubuntu launches and asks for the password. I have tried to patch the latest UUID into the /etc/fstab file and rebuild the grub.cnfg file, but no luck so far. I do not want to go for a clean installation. Please help..!

EDIT : Wed 9:16PM IST - The below result is the output of swap commands on my terminal, as advised by @heynnema

prince@prince-PC:~$ sudo swapoff -a
[sudo] password for prince:
prince@prince-PC:~$ sudo swapon -a
prince@prince-PC:~$ swapon
NAME      TYPE       SIZE USED PRIO
/dev/sda6 partition 12.1G   0B   -2
prince@prince-PC:~$ 
4
  • 1
    Where does one start? Right now, does Windows and Ubuntu boot all the way... Ubuntu may boot slowly. Once Ubuntu is booted, have you tried to edit /etc/fstab? Why are you changing anything... as most partitions are not full yet.
    – heynnema
    Commented Oct 1, 2018 at 21:42
  • I agree with heynnema, the working partitions aren't close to full. Swap is only active when your machine runs low on ram and starts to "swap" so no need to mess with swap at all. For future reference, you can't edit partitions that are mounted
    – user857648
    Commented Oct 1, 2018 at 22:48
  • @heynnema yes I am able to use both windows and ubuntu now, its just that ubuntu boots very very slow. what exactly do I have to edit in /etc/fstab? could you please elaborate? I tried to change the UUID in the file to the latest UUID of the swap partition, but nothing changed.
    – Prince
    Commented Oct 2, 2018 at 2:56
  • @beertempest, I agree, I shouldn't have touched the partitioned, but what option do I have now?
    – Prince
    Commented Oct 2, 2018 at 2:58

2 Answers 2

6

As you guessed, the UUID of the swap partition has changed, and that's why it's taking so long to boot. It's looking for a partition with the old UUID, timing out, and then finishing the boot, but without swap.

Since you can boot, it makes it easy to correct the problem.

Boot Ubuntu and open the terminal and do...

cd /etc # change to the /etc directory

sudo cp fstab fstab.bak # make a backup of fstab file

sudo blkid | grep swap (or lsblk -f | grep swap) # determine the UUID of the swap partition /dev/sda6.
* note the correct UUID of the swap partition. Copy it to the clipboard.

sudo swapoff

sudo pico fstab  # edit fstab

Find the lines that looks similar to this...

# swap was on /dev/sda6 during installation
UUID=071f8b0e-8e16-4f4d-90ff-a4ae9cc56e2b   none   swap  sw  0 0

STOP here if the correct UUID was already showing in the fstab file, and contact me for further instructions.

Replace the old UUID with the new UUID. You can right-click the mouse to paste the UUID from the clipboard.

Ctrl+o # to save your edits

Return # to confirm the filename to save

Ctrl+x # to exit the editor

sudo swapon -a # to enable swap (there should be no errors here)

swapon # to confirm that swap is engaged

reboot  # reboot the computer

And you should be fine.

11
  • blkid needs root privileges, alternatively use lsblk -f which doesn't need root privileges and delivers better readable output.
    – mook765
    Commented Oct 2, 2018 at 16:17
  • @heynnema i already tried this before. I opened the fstab file using editor with sudo priviledge, then I checked the UUID of the swap partition using gparted and corrected it in the fstab file, keeping all other options same as before. Saved and rebooted. Still no improvement :( You might find these screenshots handy imgur.com/a/Z3ySAAM
    – Prince
    Commented Oct 3, 2018 at 2:27
  • @heynnema I even checked the syslog right after system bootup, but couldn't find anything suspicious (although I have no idea where to look exactly, so I simply searched for keywords like swap, UUID).. I got these: Oct 3 08:03:01 prince-PC systemd[1]: Activating swap /dev/disk/by-uuid/e62d95f3-8c23-47c3-a5d6-db76ba467c4f... Oct 3 08:03:01 prince-PC systemd[1]: Activated swap /dev/disk/by-uuid/e62d95f3-8c23-47c3-a5d6-db76ba467c4f. Oct 3 08:03:01 prince-PC systemd[1]: Reached target Swap.
    – Prince
    Commented Oct 3, 2018 at 2:47
  • In terminal, issue sudo swapoff, sudo swapon -a, and swapon and edit the results into your question. Report back to @heynnema
    – heynnema
    Commented Oct 3, 2018 at 3:10
  • 1
    Try this... boot to the GRUB menu. Select the desired boot device, like normal. Hit the "e" key. Find the line that contains "quiet splash", remove those two words, and make it "" instead. Then continue the boot. Look for lines were there's a long pause, or for the line immediately after a long pause. What do you see?
    – heynnema
    Commented Oct 3, 2018 at 19:10
2

Apart from the above suggestions by @heynnema these steps were useful:

  1. hit 'e' in the GRUB boot screen on Ubuntu to open the options
  2. In the line starting with Linux deleted the "quiet splash $vt_handoff" (i found if you are able to boot into Ubuntu, you can change "quiet splash" to "" in the file /etc/default/grub to make this setting permanent). This will show all the kernel outputs while booting up
  3. This helped me to find that system was getting stuck up with the output "Running scripts local premount"... "Begin waiting for suspend/resume device"... "Gave up waiting for suspend/resume device"
  4. I did some google search to find that the correct UUID of the swap disk needs to be changed in /etc/initramfs-tools/conf.d/resume (apart from the /etc/fstab file) as well
  5. Run sudo update-initramfs -u
  6. Enjoy..!
2
  • Excellent! Ah yes... the resume file.
    – heynnema
    Commented Oct 4, 2018 at 3:32
  • We do good work together :-)
    – heynnema
    Commented Oct 4, 2018 at 3:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .