Swap file fails to load on 5.19 kernel with btrfs

[ricklinux@rick-ms7c37 ~]$ systemctl --failed
  UNIT                    LOAD   ACTIVE SUB    DESCRIPTION    
● vmware-networks.service loaded failed failed VMware Networks
● swap-swapfile.swap      loaded failed failed /swap/swapfile

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
2 loaded units listed.
[ricklinux@rick-ms7c37 ~]$ 

I was getting this error before using the amd 5.19 kernel. Now the arch 5.19 kernel is showing the same since i just updated? This is on btrfs also that was installed with swap file. Also running btrfs-assistant with snapshots.

Edit:

[ricklinux@rick-ms7c37 ~]$ sudo btrfs subvol list /
[sudo] password for ricklinux: 
ID 257 gen 119416 top level 5 path @home
ID 258 gen 119401 top level 5 path @cache
ID 259 gen 119415 top level 5 path @log
ID 260 gen 66382 top level 5 path @swap
ID 261 gen 66382 top level 1272 path var/lib/portables
ID 262 gen 66382 top level 1272 path var/lib/machines
ID 263 gen 119286 top level 1272 path .snapshots
ID 264 gen 66574 top level 263 path .snapshots/1/snapshot
ID 303 gen 66592 top level 263 path .snapshots/40/snapshot
ID 411 gen 66646 top level 263 path .snapshots/148/snapshot
ID 489 gen 66646 top level 263 path .snapshots/226/snapshot
ID 693 gen 66646 top level 263 path .snapshots/429/snapshot
ID 851 gen 76915 top level 263 path .snapshots/586/snapshot
ID 902 gen 87546 top level 263 path .snapshots/637/snapshot
ID 1107 gen 98234 top level 263 path .snapshots/792/snapshot
ID 1162 gen 103571 top level 263 path .snapshots/846/snapshot
ID 1223 gen 109421 top level 263 path .snapshots/907/snapshot
ID 1241 gen 111450 top level 263 path .snapshots/925/snapshot
ID 1246 gen 112036 top level 263 path .snapshots/930/snapshot
ID 1258 gen 113140 top level 263 path .snapshots/942/snapshot
ID 1267 gen 114028 top level 263 path .snapshots/950/snapshot
ID 1269 gen 114157 top level 263 path .snapshots/951/snapshot
ID 1272 gen 119416 top level 5 path @
ID 1280 gen 115113 top level 263 path .snapshots/960/snapshot
ID 1288 gen 115872 top level 263 path .snapshots/968/snapshot
ID 1293 gen 116550 top level 263 path .snapshots/973/snapshot
ID 1298 gen 117044 top level 263 path .snapshots/978/snapshot
ID 1307 gen 117950 top level 263 path .snapshots/987/snapshot
ID 1308 gen 118052 top level 263 path .snapshots/988/snapshot
ID 1309 gen 118168 top level 263 path .snapshots/989/snapshot
ID 1310 gen 118260 top level 263 path .snapshots/990/snapshot
ID 1311 gen 118445 top level 263 path .snapshots/991/snapshot
ID 1312 gen 118544 top level 263 path .snapshots/992/snapshot
ID 1313 gen 118642 top level 263 path .snapshots/993/snapshot
ID 1314 gen 118743 top level 263 path .snapshots/994/snapshot
ID 1315 gen 118828 top level 263 path .snapshots/995/snapshot
ID 1316 gen 118937 top level 263 path .snapshots/996/snapshot
ID 1317 gen 119072 top level 263 path .snapshots/997/snapshot
ID 1318 gen 119177 top level 263 path .snapshots/998/snapshot
ID 1319 gen 119286 top level 263 path .snapshots/999/snapshot
[ricklinux@rick-ms7c37 ~]$ 

This is what I get on 5.18.16-arch1-1:

[scott@EndeavourOS ~]$ systemctl --failed
  UNIT LOAD ACTIVE SUB DESCRIPTION
0 loaded units listed.
[scott@EndeavourOS ~]$ 

I’m on btrfs with half my ram to Swap (8GB) setup from the defaults for Calamares install. Just installed 5.19.1.arch2-1, so gonna reboot and see if my system has similar errors or not, so will edit this in a moment. Sorry you’re having some issues mate.

Edit: Now on 5.19.1.arch2-1 and I get the same results as before, no errors to report on my system.

[scott@EndeavourOS ~]$ systemctl --failed
  UNIT LOAD ACTIVE SUB DESCRIPTION
0 loaded units listed.
[scott@EndeavourOS ~]$ 

I sadly appears to have the same issue as @ricklinux :

swap-k19

I’m on 5.19.1-zen1-1-zen. no errors to report on my system

# swh @ ryzen in ~ [9:10:48] 
$ systemctl --failed  
  UNIT LOAD ACTIVE SUB DESCRIPTION
0 loaded units listed.

# swh @ ryzen in ~ [9:10:58] 
$ uname -r
5.19.1-zen1-1-zen

On the LTS kernet (Still 5.15) the Swap file is normaly activated

swap-k15

Perhaps

systemctl status swap-swapfile.swap

and/or

journalctl -u swap-swapfile.swap

could give some clues?

No issues on my end:

$ systemctl status swap-swapfile.swap  
● swap-swapfile.swap - /swap/swapfile
     Loaded: loaded (/etc/fstab; generated)
     Active: active since Sun 2022-08-14 10:10:52 CEST; 1min 38s ago
      Until: Sun 2022-08-14 10:10:52 CEST; 1min 38s ago
       What: /swap/swapfile
       Docs: man:fstab(5)
             man:systemd-fstab-generator(8)
      Tasks: 0 (limit: 9081)
     Memory: 792.0K
        CPU: 3ms
     CGroup: /system.slice/swap-swapfile.swap

Aug 14 10:10:52 arch-gnome systemd[1]: Activating swap /swap/swapfile...
Aug 14 10:10:52 arch-gnome systemd[1]: Activated swap /swap/swapfile.
$ uname -r
5.19.1-zen1-1-zen

Here is what I get from systemctl:
image

And from the journal:
image

EDIT: I also run again the swapon, as I see in the above log there is “invalid argument”… I indeed I got this:
image

1 Like

Swap working, but mine is not a swapfile - could that be the problem?

swapon -s
Filename                                Type            Size            Used            Priority
/dev/nvme1n1p3                          partition       9227464         518348          -2

Just adding another bit of information: my system is fully Luks Encrypted. (included the Swapfile).
Not sure it has something to do with the issue, but…
And just to confirm: Swapfile works as it should on the LTS Kernel. The issue appears to be at the moment only with the 5.19 and 5.19-Zen Kernels

I also configured manually the Swapfile 2 months ago, AFTER installing the system with Calamares and without Swap. (In others words: the Swap was not configured by Calamares)

@ricklinux , I have found a workaround… I have just deleted my swapfile and recreated it.
Now it works with the 5.19 Kernel.
As I want a 16Gb Swapfile, I used count=16384

Below are the steps I took:

sudo rm /swap/swapfile
sudo chattr +C /swap
sudo dd if=/dev/zero of=/swap/swapfile bs=1M count=16384 status=progress
sudo chmod 0600 /swap/swapfile
sudo mkswap /swap/swapfile
sudo swapon /swap/swapfile

Then check with swapon -s
image

2 Likes

What does this command do exactly?

Seems like this worked now to activate swap. I noticed the error message using the amd kernel originally which was 5.19 version but i didn’t have the error message on boot with the current kernel. I thought it was just an amd kernel issue but then it showed up with the 5.19 current kernel. Thanks for the info.

chattr +C : No copy-on-write. If two processes request access to a file, they can be given pointers to the same file. They are only given their own unique copy of the file if they try to write to the file, making it unique to that process.

See more about chattr here : https://www.howtogeek.com/790679/how-to-use-the-chattr-command-on-linux/

I don’t really understand the no copy on write very well. I’m not well versed in this area with permissions and files. Guess i need to read more and try to.

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