Try to recreate your swap partition as following steps:
Step 1. Format /dev/sda6
to be a valid swap mkswap /dev/sda6
Step 2. Activate the swap by swapon /dev/sda6
Step 3. Additionally modify /etc/fstab
to make swap start after every boot. The swap line will probably be already there. You will just need to update UUID
received as output of step 1.
For example in your case REMOVE these lines (IF you don't want Encrypted swap partition):
#UUID=6ea517a3-a80a-4acb-bea9-4efea2a71acf none swap sw 0 0
/dev/mapper/cryptswap1 none swap sw 0 0
And add this line instead at the end with NEW UUID that you get in step 1:
UUID=0c9f1cb4-a539-4ca4-8eb2-712d0efc3d10 none swap sw 0 0
see here and my answer there
IF you want to keep your Encrypted swap partition do the following
steps:
First things first, we need to know where your swap file is located on
your hard drive. dmesg
can help here (or you could also check
/etc/fstab
)
So in your case you can see the swap is on /dev/sda6
. Next thing to
do is ensure the system is fully up to date, turn swap off so we can
work with the partition and install the necessary files. Ensure to
replace /dev/sda6
with the partition you got from dmesg
(or
/etc/fstab
) in the step above:
sudo apt-get update
sudo apt-get upgrade
sudo swapoff /dev/sda6
sudo apt-get install lvm2 cryptsetup
Next up, load the module and verify its running.
$ sudo modprobe dm-crypt
You should see something like below
$ sudo lsmod | egrep 'aes|dm_crypt'
dm_crypt 12928 0
aes_i586 8124 1
aes_generic 27484 1 aes_i586
Now we clear the partition of existing data by filling it with random
data. This has two purposes, first so that any old unencrypted data is
overwritten and second so that your encrypted data does not stand out
if your drive is analysed. What I mean by this is, if you have 750 meg
of unused swap and only 250 meg used, then 3/4 of your drive will
contain no data at all, just zeros. This makes the encrypted data
stick out like a sore thumb. If you fill the drive with random data,
the encrypted data just ‘blends in’
$ sudo dd if=/dev/urandom of=/dev/sda6 bs=1M
Again, replace /dev/sda6
with the partition you got from dmesg
or
fstab
. This command will take a while (about 10 mins or so) and
should produce output similar to this:
dd: writing `/dev/sda6': Input/output error
1028+0 records in
1027+0 records out
1077510144 bytes (1.1 GB) copied, 642.306 s, 1.7 MB/s
Then you need to tell crypttab
to set up the partition as encrypted
swap, again ensure to change /dev/sda6
to your partition:
sudo echo cryptoswap /dev/sda6 /dev/urandom cipher=aes-cbc-essiv:sha256,size=256,hash=sha256,swap >> /etc/crypttab
Next, edit the /etc/fstab
file and search for the line with ‘swap’
in it. Comment that line out by inserting a #
character at the
beginning of the line, then insert the following line and save the
file:
/dev/mapper/cryptoswap none swap sw 0 0
That is now your system set up with encrypted swap. Reboot your system
for the changes to be picked up and the encrypted swap to be started.
To ensure that the swap partition is encrypted after you boot you can
check dmesg
again, it should specifically mention cryptoswap:
dmesg | grep swap
[ 73.063397] Adding 979924k swap on /dev/mapper/cryptoswap. Priority:-1 extents:1 across:979924k
If you notice a delay during boot time, or see a message such as
‘waiting for swap’ then move the mouse around a bit. It means the
system is low on entropy to generate random data for initialization of
the encryption. It should only take a second or two.
source
/etc/crypttab
please? You can edit your question to improve it with additional info.