Systemd swap error at boot

Hello!

I get an error at boot (it’s not critical) regarding swap and I do not know how to solve since most solutions around do not seem to apply to my case.

This is the error:

$ sudo systemctl --failed
  UNIT                 LOAD   ACTIVE SUB    DESCRIPTION                                      
● systemd-swap.service loaded failed failed Manage swap spaces on zram, files and partitions.

1 loaded units listed.

Any info?
I used to have a swap partition that later I ditched to use it for / space I needed, and I think this error appeared after this. The thing is I had removed the partition from fstab and had done some other things so I thought I had covered everything.

Anyway, the swapon -s command returns nothing all, and the swap line in my fstab is commented out, I just checked.

Thanks in advance.

You have to also remove the reference to the swap partition’s UUID in /etc/default/grub and then run… :arrow_down:

sudo update-grub

Did you also change the partition type, or just only reformatted the partition for use?

@Chuhtra, I would follow @Aragorn’s recommendations and then stop swap by

sudo swapoff -a

then disable and mask the unneeded service by

systemctl disable --now systemd-swap.service
systemctl mask systemd-swap.service

and finally remove the corresponding package by

sudo pacman -Rsn systemd-swap

After a reboot you should be fine.

1 Like

You should not disable let alone remove systemd portions just because you don’t understand it…

You should not post such unhelpful things if you have no idea of what you are saying… :sneezing_face:

1 Like

Of course uhhu, let’s not start a flamewar and keep on topic to help the OP…

I think I must have done that too, but here is my /etc/default/grub anyway in case you see something relevant:

GRUB_DEFAULT=saved
GRUB_TIMEOUT=10
GRUB_TIMEOUT_STYLE=hidden
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="quiet apparmor=1 security=apparmor udev.log_priority=3"
GRUB_CMDLINE_LINUX=""

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command 'videoinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/usr/share/grub/themes/manjaro/theme.txt"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

I reformated the partition entirely. I deleted it and added the free space to the root partition.

Your grub file is clean. You could start with the commands I gave you.

I would like to be on the safe side truth be told since this is my daily machine :eyes:

1 Like

Don’t worry the commands are safe.

Could you provide the output of journalctl -u systemd-swap, so we can see the reason why it failed?

Here:

$ journalctl -u systemd-swap
-- Logs begin at Thu 2020-11-05 21:51:31 EET, end at Thu 2020-11-05 23:20:29 EET. --
Νοε 05 22:57:35 Ristvakbaen-L systemd[1]: Starting Manage swap spaces on zram, files and partitions....
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: Removing working directory...
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: Removing files in /var/lib/systemd-swap/swapfc/...
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: Zswap: backup current configuration: start
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: Zswap: backup current configuration: complete
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: Zswap: set new parameters: start
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: Zswap: Enable: 1, Comp: lz4, Max pool %: 25, Zpool: zbud
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: Zswap: set new parameters: complete
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: Writing destroy info...
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: swapD: pick up devices from systemd-gpt-auto-generator
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: INFO: swapD: searching swap devices
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: Traceback (most recent call last):
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:   File "/usr/bin/systemd-swap", line 904, in <module>
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:     main()
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:   File "/usr/bin/systemd-swap", line 892, in main
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:     start()
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:   File "/usr/bin/systemd-swap", line 733, in start
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:     swap_fc = SwapFc(config, sem)
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:   File "/usr/bin/systemd-swap", line 156, in __init__
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:     self.assign_config(config)
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:   File "/usr/bin/systemd-swap", line 289, in assign_config
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:     self.swapfc_frequency = config.get("swapfc_frequency", int)
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:   File "/usr/bin/systemd-swap", line 103, in get
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]:     return as_type(self.config[key])
Νοε 05 22:57:35 Ristvakbaen-L systemd-swap[940]: ValueError: invalid literal for int() with base 10: '1s'
Νοε 05 22:57:35 Ristvakbaen-L systemd[1]: systemd-swap.service: Main process exited, code=exited, status=1/FAILURE
Νοε 05 22:57:35 Ristvakbaen-L systemd[1]: systemd-swap.service: Failed with result 'exit-code'.
Νοε 05 22:57:35 Ristvakbaen-L systemd[1]: Failed to start Manage swap spaces on zram, files and partitions..

That means you are using that AUR package (forgot the name of it) to configure a zswap device that uses a partition as filesystem.

So check your config of that…

I would suggest to use Improved zramswap

So searching swap in my Pamac I see only mkinitcpio-openswap and systemd-swap.

For the second package, this is the /etc/systemd/swap.conf

################################################################################
# Defaults are optimized for general usage
################################################################################

################################################################################
# You can override any settings by files in:
# /etc/systemd/swap.conf.d/*.conf
################################################################################

################################################################################
# Zswap
#
# Kernel >= 3.11
# Zswap create compress cache between swap and memory for reduce IO
# https://www.kernel.org/doc/Documentation/vm/zswap.txt

zswap_enabled=1
zswap_compressor=lz4      # lzo lz4
zswap_max_pool_percent=25 # 1-99
zswap_zpool=zbud          # zbud z3fold

################################################################################
# ZRam
#
# Kernel >= 3.15
# Zram compression streams count for additional information see:
# https://www.kernel.org/doc/Documentation/blockdev/zram.txt

zram_enabled=0
zram_size=$(($RAM_SIZE/4))      # This is 1/4 of ram size by default.
zram_streams=$NCPU
zram_alg=lz4                    # lzo lz4 deflate lz4hc 842 - for Linux 4.8.4
zram_prio=32767                 # 1 - 32767

################################################################################
# Swap File Chunked
# Allocate swap files dynamically
# For btrfs fallback to swapfile + loop will be used
# ex. Min swap size 512M, Max 8*512M
swapfc_enabled=1
swapfc_force_use_loop=0     # Force usage of swapfile + loop
swapfc_frequency=1s         # How often check free swap space
swapfc_chunk_size=512M      # Allocate size of swap chunk
swapfc_max_count=8          # 0 - unlimited, note: 32 is a kernel maximum
swapfc_free_swap_perc=15    # Add new chunk if free < 15%
                            # Remove chunk if free > 15+40% & chunk count > 2
swapfc_path=/var/lib/systemd-swap/swapfc/
# Only for swapfile + loop
swapfc_nocow=1              # Disable CoW on swapfile
swapfc_directio=1           # Use directio for loop dev
swapfc_force_preallocated=0 # Will preallocate created files

################################################################################
# Swap devices
# Find and auto swapon all available swap devices
swapd_auto_swapon=1
swapd_prio=1024

I am not very experienced so sorry if there is an error in front of my nose and I don’t see it :stuck_out_tongue:
Maybe this line should have 1 instead of 1s?

swapfc_frequency=1s         # How often check free swap space

I have checked and I don’t see any /etc/systemd/swap.conf.d/*.conf file in my system. Also I see a /usr/share/systemd-swap/swap-default.conf I can include if you think it’s relevant.

As I quoted in previous reply, I would start with that indeed :wink:

It’s now past 1am here so I go sleep, let us know and don’t forget to mark the post that helped to fix the title the most as solution :wink: :+1:

1 Like

It was indeed the removal of this ‘s’ that fixed it! Thank you @TriMoon for your help! Hope you had a nice sleep :grin:

Thank you too @Wollie, but it seems the more investigative approach was the way to go :wink:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.