No Swap Partition!
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
user@host:~$
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
user@host:~$
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
user@host:~$
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.)
Solution 1:
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:
- Open a Terminal window (Ctrl+Alt+T) or a virtual console and run:
sudo swapoff -a
- Open
/etc/crypttab
(e.g.,sudo nano -w /etc/crypttab
orsudo -H gedit /etc/cryptab
for a GUI editor) and put a#
at the beginning of the line that starts withcryptswap1
. Save the file. - Do the same thing with the line that starts with
/dev/mapper/cryptswap1
in/etc/fstab
. - 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 incrypttab
should give the correct partition name (it comes right after/dev/
). - Run
sudo mkswap /dev/...
, repacing...
with that same device name. Part of that command's output should be text that saysUUID=.....
where.....
is a string of letters and numbers. - In the file
/etc/initramfs-tools/conf.d/resume
, find the line that saysRESUME=UUID=
followed by letters and numbers like (but not identical to).....
from the last step. Replace them with.....
(i.e., with the letters and numbersmkswap
gave afterUUID=
. - Run
sudo swapon /dev/...
(with the same/dev/...
as you had in steps 4 and 5 above). - 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 ð‿ð hey look, imgur gave the image a palindromic name
Solution 2:
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.
Solution 3:
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.