Swap file creation broken?

I try to create a swap file on my odroid and my pi 3.
I do dietpi-drive_manager → selecting the drive → create swap → 1 → enter (or tab enter) → magic things happening. After that there is no X in the “[]”. When I navigate again in the create swap menu the value is again 0. This happens everytime.
Is this normal?

if you are connected via SSH, you should be able to scroll up a little bit. There you should see some information above the blue text box. Could you share that information pls.

sudo dietpi-drive_manager
[sudo] password for nick: 
[ INFO ] DietPi-Drive_Manager | Detecting drives, please wait...
[ INFO ] DietPi-Drive_Manager |  - Detected mounted physical drive: /dev/mmcblk1p1 > /
[ INFO ] DietPi-Drive_Manager |  - Detected mounted network drive: > /mnt/nas
[ INFO ] DietPi-Drive_Manager |  - Detected mounted physical drive: /dev/sda2 > /mnt/0CB818880CB81888
[ INFO ] DietPi-Drive_Manager |  - Detected unmounted drive: /dev/sda1
[  OK  ] DietPi-Drive_Manager | mv .fstab /etc/fstab
[  OK  ] DietPi-Drive_Manager | systemctl daemon-reload
[ INFO ] DietPi-Drive_Manager | Checking for required APT packages: e2fsprogs ntfs-3g
[  OK  ] DietPi-Drive_Manager | sync
[ SUB1 ] DietPi-Services > stop 
[  OK  ] DietPi-Services | stop : cron
[  OK  ] DietPi-Services | stop : docker
[  OK  ] DietPi-Services | stop : noip2
[ SUB1 ] DietPi-Set_swapfile > Applying 1 /var/swap
[ INFO ] DietPi-Set_swapfile | Disabling and deleting all existing swap files
[  OK  ] DietPi-Set_swapfile | swapoff -a
[  OK  ] DietPi-Set_swapfile | Desired setting in /boot/dietpi.txt was already set: AUTO_SETUP_SWAPFILE_SIZE=0
[  OK  ] DietPi-Set_swapfile | Desired setting in /boot/dietpi.txt was already set: AUTO_SETUP_SWAPFILE_LOCATION=/var/swap
[ INFO ] DietPi-Set_swapfile | Setting /tmp tmpfs size: 1891 MiB
[  OK  ] DietPi-Set_swapfile | mount -o remount /tmp

where do you like to store the SWAP file on? On which file system? Can you share following pls

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
sda               931.5G  0 disk                                                 
│    vfat   ESD-USB
│                    32G  0 part            3571e14c-01                          90D9-1ECC
     ntfs   Daten 899.5G  0 part /mnt/0CB81 3571e14c-02                          0CB818880CB81888
│                  29.1G  0 disk                                                 
     ext4          29.1G  0 part /          096cb72a-01                          9ff8c837-9bfd-4325-a808-88d6a5ffd817
                      4M  1 disk                                                 
                      4M  1 disk

I tried to store it on mmcblk1 it’s a emmc module.
For the odroid n2+…
Do you want the same information of my pi?

If you try to create the swap space on the drive manager, you will be ask on the size. What value did you specify there? How much physical memory you have?

I have the 4GB Odroid n2+ model.
I want the auto mode.
So I Type „1“ into the field.

In case of 4GB physical memory, no SWAP file is created using the automatic option 1. We create SWAP files for system having less than 2 GB memory only. If you require a SWAP file anyhow, you need to specify the size manually :slight_smile:

Background is that for most installations 2 GiB memory are sufficient, so the auto mode is only to assure that users don’t run into dietpi-software installation errors and all services start up. For more intense usage we cannot reasonably predict how large the swap file needs to be.

Good to know, thank you.

Well I had to google for this phenomena just to find it here in the forum.

In case of 4GB physical memory, no SWAP file is created

Dont you think you should explain that in the program instead of some place in the internet.
If you decide to limit the auto function to something to your liking, that’s fine.
But for someone who doesn’t know that, this is completly unlogic.
So please explain it in the programm.

for most installations 2 GiB memory are sufficient

I respectfully disagree

You can create every size of swap file you like using our tools. Just enter your preferred value and you are done. This will overwrite the automatic within our script. However the statement is still valid. For majority of devices, 2GB are enough. But we don’t prevent users from creating lager swap files if needed.

Yeah I get it. But still, I was setting it on auto because it is an intuitive choice.
Not knowing it’s limitations led to asking myself ‘why doesn’t it work’.
No explanation is to be found for that limitation.
So you have to assume it is a bug.

There is a descibing text right in the menu inside dietpi-drive_manager where you can set the swap.

  • 0 = Disable swap file
    1 = Auto size: 2 GB minus physical RAM size
    2 and above = Manual size

not the obvious, but a hidden hint within the script

OK, so maybe you agree with me that explanationwise there is potential for improvement, right?

And btw, I have 4GB of RAM and I still need a swap file!

SWAP is the worst thing in terms of performance and probably your use case is not that typical for our users. Majority of users is fine as it is. Of course, there will be some who need more SWAP and for them we have the possibility to create as much as needed using our tool dietpi-drive_manager or call the script directly.

I don’t agree, there is a message displayed when you try to change it, idk what would be more sufficient.