Re: [Tails-dev] xfce, second option graphic interface in tai…

Delete this message

Reply to this message
Autor: David A. Wheeler
Data:  
Dla: The Tails public development discussion list
Temat: Re: [Tails-dev] xfce, second option graphic interface in tails?
It seems clear to me that some (potential) Tails users currently have computers with
not enough physical RAM for what they want to do with Tails.

Example 1:
> On Jan 31, 2023, 4qu1n4t1s@??? said:
>> I would suggest that the group of developers add the possibility of
>> using the xfce graphical interface to allow people who do not have good
>> computers to have access to this technology that tails provides...


Example 2:
> On Feb 5, 2023, at 5:39 PM, Anti-OOM in Tails via Tails-dev <tails-dev@???> wrote:


> Tails runs without any swap space (obviously, to maintain amnesia), the entire system may lock up at any moment due to heavy memory usage and opening of many Web browser tabs (which I usually do)...


I appreciate the current efforts to limit RAM use:
> On Feb 2, 2023, at 5:16 AM, boyska <boyska@???> wrote:
> By the way, we have regular QA tests to check that Tails is usable with 2GB of RAM. While I'm all for saving resources, I don't think it's realistic to bring down the requirement to 1GB. The best we can do is to try hard to not bump the requirement to 3GB.



However, that's not really enough for some users.
Websites are increasingly using more memory
expectations, and cross-site caches are no longer supported by web browsers
(for good security reasons, but this increases memory use further).
Some people are likely to have reliability problems, in particular, those
who use many tabs (e.g., for research), run the system a long time
(where memory leaks become a problem), use many memory-heavy websites/apps,
and/or have computers with less RAM.

Most general-purpose GUI systems enable swap space. Ubuntu comes with 2GB at least by default.
Tails is odd in that way. What's more, if the user has enabled a persistent store,
there's no reason it can't be used as a swap space to prevent crashes.

I think Tails should automatically use a swap space if it's configured on a persistent drive that's
enabled. As a bonus step, you could later provide a simple GUI to make it easy to set up.
Then, when memory goes short, the system will slow down instead of crash.
Even better: You do NOT need to install new software; "swapon" and "swapoff" are already installed.

I did a little experimenting & it appears that swapping works just fine on Tails.
Details about how to enable swapping on Tails is below.

--- David A. Wheeler


~~~~

Step 1: Automatically use a swapfile on startup, if one is configured in persistent storage
and the persistent storage is enabled. I would suggest using a swapfile (not partition)
at the top of the persistent storage. From here on I'll write $SWAPFILE to mean
"/live/persistence/TailsData_unlocked/swapfile".

The key for Tails, which isn't obvious, is setting swappiness. Writing to the swapfile
creates extra wear on the USB stick, which you d NOT want to do unnecessarily.
So before enabling swapping, I suggest setting vm.swappiness to 0 by default.
You can do this by editing /etc/sysctl.conf and adding this line:
    vm.swappiness=0
Or better yet, do the same in a file in /etc/sysctl.d/
You can also, at runtime, run `sysctl vm.swappiness=0`.
If snappiness is more important, a low value (say 10) isn't bad.


You can then enable swapping if the swap file is present. E.g.,
you can do this at startup by running as a startup script:
swapon -e $SWAPFILE
Or by doing the equivalent in fstab. I know systemd has systemd.swap,
you'd just need to ensure that the attempt to load the swap file happens
*after* the persistent store is mounted, but it's fine if there's no such file.

I would also recommend modifying /usr/local/lib/tails-backup-rsync
so it doesn't back up the swapfile, by adding this option to rsync:
--exclude $SWAPFILE

Step 2: Document how to create a swapfile (later you could create a
Tails GUI utility to create/remove/resize it). The basic steps to create one are
(as the administrator):

swapoff # In case it's on.
dd if=/dev/zero of=$SWAPFILE bs=1024 count=2097152 # count is for 2GiB
chmod 600 $SWAPFILE
mkswap $SWAPFILE

*Using* it, once created, is simple:

swapon $SWAPFILE

More info is at:
https://help.ubuntu.com/community/SwapFaq
https://www.linuxuprising.com/2018/08/how-to-use-swap-file-instead-of-swap.html