sonal
22 May 2021 17:42
1
Hello experts,
I was trying to enable systemd-swap,
i used following commands,
sudo pacman -S systemd-swap
sudo systemctl enable systemd-swap.service
and
sudo bash -c 'echo -e "zswap_enabled=1\nzram_enabled=0\nswapfc_enabled=1" > /etc/systemd/swap.conf.d/myswap.conf'
and on using this last command i am getting the below error
Please help in resolving the issue…thanks
Manually create the file /etc/systemd/swap.conf.d/myswap.conf
like so…
sudo nano /etc/systemd/swap.conf.d/myswap.conf
Add the lines…
zswap_enabled=1
zram_enabled=0
swapfc_enabled=1
… to the file, followed by a newline (i.e. an empty line).
Save the file with Ctrl+O followed by Enter , and exit the editor with Ctrl+X .
Hello,
I recommend zram-generator
instead.
1 Like
sonal
22 May 2021 17:57
4
even I am getting error using your method
Do you actually have a directory /etc/systemd/swap.conf.d
? If not, you have to create it first.
sudo mkdir /etc/systemd/swap.conf.d
Then create the file.
sonal
22 May 2021 18:10
6
i executed this command and it worked.
after this i created the file…
but after reboot, it is not showing any swap…
even in htop it is not showing any swap
omano
22 May 2021 18:12
7
Output of systemctl status systemd-swap.service
?
sonal
22 May 2021 18:14
8
here is the output…
[sonal@sonal-80e5 ~]$ systemctl status systemd-swap.service
● systemd-swap.service - Manage swap spaces on zram, files and partitions.
Loaded: loaded (/usr/lib/systemd/system/systemd-swap.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2021-05-22 23:34:17 IST; 8min ago
Main PID: 563 (systemd-swap)
Status: "Monitoring memory status..."
Tasks: 1 (limit: 9423)
Memory: 16.6M
CGroup: /system.slice/systemd-swap.service
└─563 /usr/bin/python3 -u /usr/bin/systemd-swap start
May 22 23:34:07 sonal-80e5 systemd-swap[563]: INFO: Zswap: backup current configuration: start
May 22 23:34:07 sonal-80e5 systemd-swap[563]: INFO: Zswap: backup current configuration: complete
May 22 23:34:07 sonal-80e5 systemd-swap[563]: INFO: Zswap: set new parameters: start
May 22 23:34:07 sonal-80e5 systemd-swap[563]: INFO: Zswap: Enable: 1, Comp: zstd, Max pool %: 25, Zpool: z3fold
May 22 23:34:07 sonal-80e5 systemd-swap[563]: INFO: Zswap: set new parameters: complete
May 22 23:34:07 sonal-80e5 systemd-swap[563]: INFO: Writing destroy info...
May 22 23:34:07 sonal-80e5 systemd-swap[563]: INFO: swapD: pick up devices from systemd-gpt-auto-generator
May 22 23:34:07 sonal-80e5 systemd-swap[563]: INFO: swapD: searching swap devices
May 22 23:34:17 sonal-80e5 systemd-swap[563]: INFO: swapFC: on-demand swap activation at >5116 MiB memory usage
May 22 23:34:17 sonal-80e5 systemd[1]: Started Manage swap spaces on zram, files and partitions..
[sonal@sonal-80e5 ~]$
Hi, avoid zram (that bloats ram and conficts with zswap)
Try this (translaton about ok )
1 Like
sonal
22 May 2021 18:25
10
but i just enabled zswap…i dont know if i am using zram or not…
how did you concluded that i am using zram…
I think it’s not showing because it isn’t actually swapping. It is using part of your RAM as swap instead.
2 Likes
sonal
22 May 2021 18:31
12
yes sir , you are correct…when i opened multiple app to fill up the RAM it started showing the swap…
Thank you for the help
1 Like
I didn’t, it’s just advice.
what are the answers of
cat /etc/systemd/swap.conf
ls /etc/systemd/swap.conf.d -1
sonal
25 May 2021 08:29
15
here…
[sonal@sonal-80e5 ~]$ cat /etc/systemd/swap.conf
# This file is part of systemd-swap.
#
# Entries in this file show the systemd-swap defaults as
# specified in /usr/share/systemd-swap/swap-default.conf
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See swap.conf(5) and /usr/share/systemd-swap/swap-default.conf for details.
#zswap_enabled=1
#zswap_compressor=zstd
#zswap_max_pool_percent=25
#zswap_zpool=z3fold
#zram_enabled=0
#zram_size=$(( RAM_SIZE / 4 ))
#zram_count=${NCPU}
#zram_streams=${NCPU}
#zram_alg=zstd
#zram_prio=32767
#swapfc_enabled=0
#swapfc_force_use_loop=0
#swapfc_frequency=1
#swapfc_chunk_size=256M
#swapfc_max_count=32
#swapfc_min_count=0
#swapfc_free_ram_perc=35
#swapfc_free_swap_perc=15
#swapfc_remove_free_swap_perc=55
#swapfc_priority=50
#swapfc_path=/var/lib/systemd-swap/swapfc/
#swapfc_nocow=1
#swapfc_directio=1
#swapfc_force_preallocated=0
#swapd_auto_swapon=1
#swapd_prio=1024
here
[sonal@sonal-80e5 ~]$ ls /etc/systemd/swap.conf.d -1
myswap.conf
Ohh …anyways I followed your tutorial and everything is working fine now…i guess
1 Like
Happy if it helped U !
Now just for check:
cat /etc/systemd/swap.conf.d/myswap.conf
cat /etc/systemd/swap.conf.d/overrides.conf
Hi, nice, I think the two first lines may be redundant.
Check with:
cat /usr/share/systemd-swap/swap-default.conf
What do you think @Aragorn ?
I have no idea ─ I don’t use systemd-swapd
, nor zram
, nor zswap
.
Either way, the OP has indicated that “everything is working fine” , so I guess the matter is resolved.
1 Like
Then, the point I raised must be checked : never good to have redundant instructions as they can ultimately conflict.
1 Like