So you were using Ubuntu with full home folder and swap sector encryption without any problem. But you have recently updated your Ubuntu, finished your work and then rebooted. Boom! A weird error on the boot screen…

cryptsetup: Waiting for encrypted source device /swapfile

By pressing F11, you can see some detailed explanation… it is probably showing that there is something wrong with your cryptsetup. Apparently the size filed is missing from some configuration. But your PC was working fine. So what can go wrong?!

After waiting for some time (about 2 minutes), it will enable you to write on the initramfs shell. But you have no idea how to solve this issue. Rebooting the PC again will again show you this intiramfs shell screen.

But don’t worry. The solution is simple. Just type “exit” and press Enter. It will move you back to your Login screen.

You login to your PC and everything seems working fine, right? Then you rebooted and again this same annoying problem. Wait for 2 minute, type exit, press enter and then Login to your PC.

So how to solve this issue permanently? The error message was saying something related to size is missing. So, where can you add this?

You need to add this to your encrypted swap file configuration, which is located in etc > crypttab file.

To access this file from GUI, you need to open your File application (or whatever file system you are using).

Press CTRL + L to access the address bar and type “/etc/” to access the folder.

There you will find the crypttab file.

Open it with any text editor (in my case it is Visual Studio Code) and add “,size=256” at the end of the cryptswap target lines.

Save it. It may ask your root password (PC Password) to save properly.

It should solve this size problem, right? Actually no. You will still see same intiramfs shell screen prompt upon startup (error message is gone but need to type exit and enter every time).

So how to solve it permanently. For this, you need to comment out (putting ‘#’ before the lines) all cryptswap related configuration in your fstab and crypttab file first. Both of these files are located in the same etc folder as before. After commenting out, both of these files will look like this —

Now open the terminal application and type this command and press enter (it will ask for your root password) —

sudo swapoff -a && sudo update-initramfs -u

It will take some time to update. After that, you uncomment the lines you have previously commented in fstab and crypttab file and save them again (you may require to enter root password). Now they will look like this —

After doing all of these steps, if you reboot now – those errors will go away this time. You can now normally login to your Linux PC.

But you may see this error appearing again after any kernel update. Following these steps will hopefully solve those issues.

You can find the root cause of this problem and more explanation in the links given below.

Additional source —

(Visited 248 times, 1 visits today)

Leave A Comment

Your email address will not be published. Required fields are marked *