swap-file-creator

From Kicksecure
Jump to navigation Jump to search
swap-file-creator logo

Adds encrypted swap file to the system.

Introduction[edit]

swap-file-creator adds an encrypted swap file to the system. On every boot, it creates a new encrypted swapfile with a random password.

This is useful for systems with low RAM such as those inside virtual machines. Prevents common cases of freezing of VMs with low RAM during upgrades. [1]

It has an ENOUGH_RAM setting which defaults to 1950 MB. If there is more than enough RAM, it will not advice to increase RAM.

An optional option exists to shred the swapfile on shutdown but this is slow. [2]

For further information, see: https://github.com/Kicksecure/swap-file-creatorarchive.org

Installation[edit]

Platform dependent.

Configuration[edit]

The config file is located at /etc/default/swap-file-creatorarchive.org. Here you can change various parameters for the swapfile creation such as the path for where to create the swapfile at startup. [5]

Open file /etc/default/swap-file-creator in an editor with root rights.

Kicksecure

See Open File with Root Rights The Web Archive Onion Version for detailed instructions on why to use sudoedit for better security and how to use it.

sudoedit /etc/default/swap-file-creator

Kicksecure for Qubes

NOTES:

sudoedit /etc/default/swap-file-creator

  • After applying this change, shutdown the Template.
  • All App Qubes based on the Template need to be restarted if they were already running.
  • This is a general procedure required for Qubes and unspecific to Kicksecure for Qubes.

Others and Alternatives

  • This is just an example. Other tools could achieve the same goal.
  • If this example does not work for you or if you are not using Kicksecure, please refer to this link.

sudoedit /etc/default/swap-file-creator

For example, to set a custom swap file size of 1024 MB, add.

SWAP_FILE_SIZE_CUSTOM_MB=1024

Save.

Done. Settings will be applied after reboot (or when swap-file-creator is restarted).

Other configuration options.

  • SWAPFILE=/var/swapfile

Check Swap File Size[edit]

sudo du -sh /var/swapfile

Functionality Test[edit]

To check it is working correctly, check the amount of free and used memory in the system.

free -m

Next, enable swapping and display the swap usage summary.

sudo swapon -s

For troubleshooting purposes, Check Daemon Log and search for unit-name: swap-file-creator.

Live Mode[edit]

swap-file-creator does not run if live mode is detected. [6]

Debugging[edit]

Only required in case of issues. Otherwise the user can skip this wiki chapter.

Error States[edit]

In case swap-file-creator is failing at boot time, it does not break the boot process.

For example, host kernel versions other than the one recommended on the recommended VirtualBox version wiki page are are likely to break VirtualBox VMs in many ways if these are unsupported by VirtualBox. [7] In this case, swap-file-creator might be brokenarchive.org and this being the only visiblearchive.org error but this still does not break the boot process. However, when using kernel versions unsupported by VirtualBox, many other things will be broken and the system will be unbootable anyhow.

Manual Swap File Creation[edit]

TODO: document

Disable[edit]

sudo systemctl stop swap-file-creator

sudo systemctl disable swap-file-creator

sudo rm -f /var/swapfile

Development[edit]

See Also[edit]

Footnotes[edit]

  1. Such as during Linux kernel module building (VirtualBox guest additions) as well as kernel header package upgrades.
  2. https://github.com/Kicksecure/swap-file-creator/blob/master/etc/default/swap-file-creatorarchive.org
  3. Install package(s) swap-file-creator following these instructions

    1 Platform specific notice.

    2 Update the package lists and upgrade the system The Web Archive Onion Version .

    sudo apt update && sudo apt full-upgrade

    3 Install the swap-file-creator package(s).

    Using apt command line --no-install-recommends option The Web Archive Onion Version is in most cases optional.

    sudo apt install --no-install-recommends swap-file-creator

    4 Platform specific notice.

    5 Done.

    The procedure of installing package(s) swap-file-creator is complete.

  4. Setting up swap and/or encryption of any kind is completely up to Qubes. Unspecific to Kicksecure.
  5. Useful in case you have a copy-on-write system like ZFS or BtrFS.
  6. Live mode is detected if file /proc/cmdline contains string boot=live.
  7. https://www.virtualbox.org/ticket/17055#comment:3archive.org

We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 12 year success story and maybe DONATE!