Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm in dire need of help.

My system has become incredibly laggy and hardly usable. I have realised that this is because for some reason I'm running without virtual memory (this is not intentional). It is a recent phenomenon and the system was much more responsive until a couple of days ago, so I can only summarise it is a recent phenomenon. I cannot think of anything I did to cause this (except attempt to use the Hibernation feature, which failed - did it maybe fill up my swap partition with garbage and leave it there? I do not know. How could I find out?)

As a novice my difficulty is compounded by the fact that I am running on a fully encrypted SSD using LUKS. Everybody keeps posting me links to pages where people have posted links, and honestly I am hopelessly out of my depth. Searching for information with a machine that takes ten seconds to register a keypress is no fun, I assure you.

(Of course this situation persists across reboots)

First, proof of the situation: swapon indicates I have no swap:

user@host:~$ sudo swapon -s
[sudo] password for user: 
Filename                Type        Size    Used    Priority

Secondly, the output of df, indicating how my filesystems are mounted:

user@user~$ df
Filesystem                  1K-blocks     Used Available Use% Mounted on
/dev/mapper/ubuntu--vg-root 237978256 14110548 211756044   7% /
none                                4        0         4   0% /sys/fs/cgroup
udev                          3829132        4   3829128   1% /dev
tmpfs                         3844736        8   3844728   1% /tmp
tmpfs                          768948     1256    767692   1% /run
none                             5120        0      5120   0% /run/lock
none                          3844736    20948   3823788   1% /run/shm
none                           102400       16    102384   1% /run/user
tmpfs                         3844736        0   3844736   0% /var/spool
tmpfs                         3844736       24   3844712   1% /var/tmp
tmpfs                         3844736      624   3844112   1% /var/log
/dev/sda1                      240972    84550    143981  37% /boot
/home/user/.Private        237978256 14110548 211756044   7% /home/user

Next, my /etc/fstab file, as it currently stands:

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/ubuntu--vg-root /               ext4 discard,noatime,nodiratime,errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation UUID=db8c65e2-82fd-492c-8f02-8ad140f7337b /boot           ext2    defaults        0       2
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

tmpfs   /tmp    tmpfs   defaults,noatime,mode=1777  0   0
tmpfs   /var/spool  tmpfs   defaults,noatime,mode=1777  0   0
tmpfs   /var/tmp    tmpfs   defaults,noatime,mode=1777  0   0
tmpfs   /var/log    tmpfs   defaults,noatime,mode=1777  0   0

Finally, I'd like to mention that I booted into a Live-USB distro, and used system-config-lvm to have a look at my unmouned LVM, and /dev/ubuntu-vg/swap_1 is indeed there.

I don't know what else to do. It's taken three hours to type this.

EDIT: adding output of cat /etc/exports/:

user@host:~$ cat /etc/exports
cat: /etc/exports: No such file or directory

and the output of top

top - 19:10:16 up 32 min,  3 users,  load average: 0.18, 0.11, 0.07
Tasks: 202 total,   1 running, 201 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.7 us,  0.7 sy,  0.0 ni, 98.5 id,  0.1 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   7689472 total,  1220864 used,  6468608 free,    44020 buffers
KiB Swap:        0 total,        0 used,        0 free.   549276 cached Mem

PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                      
1396 root      20   0  288660  48264  40612 S   1.7  0.6   0:03.80 Xorg                                                                         
2279 user     20   0  856444  16252  11668 S   1.0  0.2   0:01.67 lxterminal                                                                   
3140 user     20   0 1169836 142804  60396 S   0.7  1.9   0:09.86 chrome                                                                       
635 root     -51   0       0      0      0 S   0.3  0.0   0:00.41 irq/62-iwlwifi                                                               
3118 ntp       20   0   33504   2136   1528 S   0.3  0.0   0:00.04 ntpd                                                                         
3326 user     20   0 1038132 111152  48620 S   0.3  1.4   0:11.06 chrome                                                                       
3374 user     20   0   29192   1736   1212 R   0.3  0.0   0:00.03 top                                                                          
1 root      20   0   34052   3436   1484 S   0.0  0.0   0:03.97 init                                                                         
2 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kthreadd                                                                     
3 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ksoftirqd/0                                                                  
5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H                                                                 
7 root      20   0       0      0      0 S   0.0  0.0   0:00.24 rcu_sched                                                                    
8 root      20   0       0      0      0 S   0.0  0.0   0:00.08 rcuos/0                                                                      
9 root      20   0       0      0      0 S   0.0  0.0   0:00.06 rcuos/1                                                                      
10 root      20   0       0      0      0 S   0.0  0.0   0:00.07 rcuos/2                                                                      
11 root      20   0       0      0      0 S   0.0  0.0   0:00.10 rcuos/3                                                                      
12 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcuos/4              

Searching around desperately (as best one can while faced with my present situation, anyway) I have found this ancient thread about somebody having problems with cryptswap, but honestly I'm too much of a novice to understand what he is on about and how to use mkswap to remake the swap partition (honestly, it isn't even clear to me what parameters I would need to pass to mkswap to avoid nuking my system by accidentally overwriting my main partition... I saw in fstab that I seem to have two entries that look swap-like (swap_1 and cryptswap) and I do not know which of the two would be the hypothetical target, not to mention all the deep jargon.)

share|improve this question
Are you sharing a folder using NFS? My CPU was eaten by the kworker thread by sharing a folder on an encrypted drive. Using sshfs, or using unencrypted drives resolved the issue for me. – Programster May 18 '14 at 16:26
Not having swap should appear to increase performance, not decrease it. However if you run out of RAM your processes may die "silently" – Programster May 18 '14 at 16:28
How can I check what is happening? All I know is that it is unusably slow (so slow that sudo times out while I laboriously type in my long superuser password, severly hampering my ability to fix things) and that, contrary to my expectations, I have no virtual memory or swap partition enabled. Beyond that it is all idle speculation. If somebody can indicate how I can find these facts out, I will do so gladly so as to increase chances of somebody diagnosing the problem. I don’t think I am using NFS but how do I find out if I am, and how do I kill it while I figure things out?? – qubex May 18 '14 at 16:44
If you are the only person who has configured the computer and you don't know if you are using NFS, then chances are that you're not. You can always check by running cat /etc/exports and check there is nothing in there. As for virtual memory, I'd be amazingly surprised if you indeed weren't using any (You use virt memory even if you aren't using swap, just see under VIRT when you run top). It would be helpful me and others if you took the largest possible screenshot of your top, or htop so we can see your running processes. – Programster May 18 '14 at 17:06
Looking at top, I couldn't see anything unusual but maybe someone else will. I believe the reason nobody else has added anything is because they can't see anything obvious either and more context may be required. I really don't think the issue is that you don't have any swap partition mounted. If you really think it is, go ahead and give this a try this to manually add swap‌​. If I was in your position I would reinstall ubuntu without encrypting my drive and see if the problem goes away. – Programster May 19 '14 at 6:42

3 Answers 3

I’m not sure whether this qualifies as a ‘solution’ (insofar as I am not quite sure what I have solved beyond successfully re-enabling virtual memory) but by commenting out the ‘cryptoswap’ line in /etc/fstab so it reads

# /dev/mapper/cryptswap1 none swap sw 0 0

allows swapon to succeed in activating swap on /dev/mapper/ubuntu—-vg-swap_1

The lag I had noticed seems to be related to TPM (power management), but I don’t know how to solve that yet. I’ve just discovered that by connecting to an external power supply the issue disappears until the next reboot.

share|improve this answer

I was having the same issue, Eliah Kagan's answer on this other thread did the trick for me.
Here's the most important bit:

  1. Open a Terminal window (Ctrl+Alt+T) or a virtual console and run: sudo swapoff -a
  2. Open /etc/crypttab (e.g., sudo nano -w /etc/crypttab or sudo -H gedit /etc/cryptab for a GUI editor) and put a # at the beginning of the line that starts with cryptswap1. Save the file.
  3. Do the same thing with the line that starts with /dev/mapper/cryptswap1 in /etc/fstab.
  4. Install gparted Install gparted. Run it and format your swap partition as linux-swap. Make sure to get the right partition; if you get the wrong one, you'll lose possibly important data! The line you commented out in crypttab should give the correct partition name (it comes right after /dev/).
  5. Run sudo mkswap /dev/..., repacing ... with that same device name. Part of that command's output should be text that says UUID=..... where ..... is a string of letters and numbers.
  6. In the file /etc/initramfs-tools/conf.d/resume, find the line that says RESUME=UUID= followed by letters and numbers like (but not identical to) ..... from the last step. Replace them with ..... (i.e., with the letters and numbers mkswap gave after UUID=.
  7. Run sudo swapon /dev/... (with the same /dev/... as you had in steps 4 and 5 above).
  8. Run sudo ecryptfs-setup-swap.

swapon -s will check to see if swap is successfully enabled. See that blog post for more information, and example output, for checking this.

No more laggy behavior ð‿ð enter image description here hey look, imgur gave the image a palindromic name

share|improve this answer

Your basic problem has nothing to do with swap. Lack of swap leads to OOM crashes, not lags. I think your problem is that you have LUKS encrypted disk, and put ecryptfs encrypted home folder over it (unless, of cause, you manually called your mount point ~/.Private for some reason ) This leads to vast overusage of CPU, which only increases the more files you put in you home directory.
I suggest you remove home folder encryption or at least move all your non-hidden files out of it somewhere else.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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