7

Running Ubuntu 15.04. I was receiving messages about my root / partition running out of space, and so I looked up how to allocate more space to it. I followed the answer to this question: How to extend my root (/) partition?

After turning swapoff, deleting the swap parition, and hitting Apply all operations, I executed the command sudo resize2fs /dev/sda10 (in my case, I used sda8, as it is my root partition) and it said: The filesystem is already 2441472 (4k) blocks long. Nothing to do! . I restarted the machine, and once it reached the Ubuntu screen with the loading dots it stayed there for about 2 minutes before proceeding to the login screen.

I figured I messed something up with the boot process, so I thought I'd recreate the swap space. I opened up GParted and created a new parition in the unallocated space, allocated it as swap, hit swapon, Apply all operations, and restarted. Same thing happens. Every time I restart or do a fresh boot, it hangs on the loading screen for a good 2-3 minutes and then proceeds to the login screen.

I don't see why deleting the swap partition would have messed with the boot, as I understand it is only really used for hibernation.

1
  • Have you checked your /etc/fstab to make sure that after deleting (and recreating) the swap partition everything is in place and mounted properly on boot?
    – boshra
    May 18, 2015 at 3:06

6 Answers 6

7

If you want to remove the swap partition, you should first try by commenting its entry in /etc/fstab, then reboot.

As for the long boot time, it may be that one of your filesystems has been damaged. As soon as your system is up, run the appropriate fsck.* command for each of the file systems. If it reports errors, it will usually recommend how to fix them.

(Btw, running a system without swap is perfectly normal. I'm doing this since several years – these days, common machines have enough RAM.)

2
  • Commenting out the swap entry in /etc/fstab fixed the boot problem. Thanks! May 18, 2015 at 17:59
  • Thanks lxg. I have been dual-booting ubuntu-type OSs on 'modern systems' these past couple of years. Always annoying when the first installed system would take >1min 30 sec to boot. Your suggestion to delete swap entries from /etc/fstab, then delete swap partitions using Gparted, did the trick.
    – aarn
    Dec 18, 2016 at 3:14
6

I had about the same problem. When I removed my swap partition, the system kept booting very slowly. Although my situation was different from that of the OP, I hope it will be useful to others. I'm adding it here because this was my first hit when searching for solutions.

For me commenting out the relevant line in /etc/fstab as indicated by other answers did not yet solve it. It turned out that I had an encrypted swap partition enabled, which may be the default if your home directory is encrypted.

Look at /etc/crypttab, and comment out any lines referring to a partition that no longer exists. For me, removing this line reduced the boot time from ~3 minutes to the usual < 1.

2
  • 1
    Thanks... I knew that this was the problem but I couldn't find where erase the partition. Thanx.
    – Torrien
    Jan 16, 2019 at 0:49
  • Thank you so much man, i don't really know how to thank you. Dec 12, 2021 at 12:00
6

From Terminal run

    sudo blkid

Then

    cat /etc/fstab

Double check that the fstab entry for swap partition matches all entries in the blkid

Your fstab entry should look something like this=>

    UUID=your/UUID/here none      swap    sw        0       0

If they don't match with each other, change UUID in fstab using your preferred text editor, to match the one you get from command sudo blkid. Then reboot and you'll see the effect.

6

You may also need to edit the /etc/initramfs-tools/conf.d/resume file and comment out any references to the deleted Swap partition

sudo nano /etc/initramfs-tools/conf.d/resume
#RESUME=UUID=2854a8db-6494-44ac-9cee-974714bb0b00

Afterwards, run update-initramfs -u (thanks @Stefan)

I commented out the swap entries in /etc/fstab and the slow boot wasn't resolved. I also made sure that my swap wasn't encrypted, since no /etc/crypttab existed as suggested by @ankit7540. In the end, i came across this error message while installing a virtualization package and this gave me the right direction

W: initramfs-tools configuration sets RESUME=UUID=2854a8db-6494-44ac-9cee-974714bb0b00
W: but no matching swap device is available.

From the docs:

The initramfs is an cpio archive. At boot time, the kernel unpacks that archive into ram, mounts and uses it as initial root file system. From there on the mounting of the real root file system occurs in user space.

resume
      The resume hook tries to autodetect the resume partition and uses  the  first  swap
      partition   as  valid  guess.  It  is  possible  to  set  the  RESUME  variable  in
      /etc/initramfs-tools/conf.d/resume.  The boot variable noresume overrides it.

In simpler words, since a swap partition is a requirement for hibernation in Ubuntu, it makes sense that it'll be defined in some boot config as the RESUME parition and the boot process will look for it.

3
  • Also during boot for a very short time it will show a message: Gave up waiting for suspend/resume device
    – Stefan
    Sep 18, 2020 at 15:13
  • Also, after changing the resume file described in this answer I had to run the command: update-initramfs -u
    – Stefan
    Sep 18, 2020 at 15:25
  • Thanks for this, this extra delay when booting was driving me crazy and this fixed it Nov 3, 2021 at 13:32
0

In 2023 i experienced this problem after i tried to delete th the swap partition completely after watching stupid incomplete yt video after googling it i found this ask page after long fiddling iwas able to reduce boot tim of my pc again so i am just summarising this whole page and what worked for me. First problem after you delete or resize swaps UUID changes but your system dosent know about it to tell it go to etc/fstab Comment the line of swap if you deleted it. If you resize it or create new go to this command in terminal

    Sudo blkid | grep swap

Copy UUID= AND paste it in fstab swap line in previus uuid

After this your boot time will come to around 50sec but theres one more problem In etc/initramfs-tool/conf.d/resume

If resume file not present create it by using

    sudo touch resume 

in terminal

Open it insert

If you created new or resize swap partition RESUME=UUID=[the one you copied before]

And this if deleted it

RESUME=none

And then in terminal run this command

   sudo update-intiramfs -u

Done now your boot should be fine completely you can check it by

   systemd-analyze

Also if you are using gnome you will have to give gedit or other text editor sudo permission in terminal because you can't edit system file without root permission. I use kde plasma with kate you can edit any file and then it will ask for password when saving.

-1

Had the same problem: userspace booted for 3 minutes. Before it i have deleted swap partition on another disk. Once I commented related line in /etc/fstab and rebooted, linux booted in 48 seconds

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 8, 2022 at 11:24

You must log in to answer this question.

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