Why is swap not enabled after boot? I always need to run `swapon -a`

~ ❯ swapon -s
                                                                                                              
~ ❯ cat /etc/fstab
# <file system>                           <mount point>  <type>  <options>        <dump>  <pass>
UUID=DE1B-5974                            /boot/efi      vfat    umask=0077       0       2
UUID=7c0a971b-bc55-40bb-8e24-90f3bb31883d /              ext4    defaults,noatime 0       1
UUID=2d2476ca-269a-41e3-8666-153465a279e5 none           swap    defaults         0       0

~ ❯ ls -l /dev/disk/by-uuid/2d2476ca-269a-41e3-8666-153465a279e5
lrwxrwxrwx 1 root root 15 May 24 12:58 /dev/disk/by-uuid/2d2476ca-269a-41e3-8666-153465a279e5 -> ../../nvme1n1p3

~ ❯ sudo swapon -a
[sudo] password for trusktr: 

~ ❯ swapon -s
Filename				Type		Size		Used		Priority
/dev/nvme1n1p3                          partition	9227464		0		-2

What else is needed?

Run

systemctl --type swap

to verify if you have accidently masked the corresponding swap unit. Usually, systemd activates swap at boot with the correct fstab entry.

2 Likes
~ ❯ systemctl --type swap
  UNIT               LOAD   ACTIVE SUB    DESCRIPTION   
  dev-nvme1n1p3.swap loaded active active /dev/nvme1n1p3

Legend: 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.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

I don’t recall having ever messed with that.

Also you could check if the swap partition carries already the partition type GUID 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F.

Reference:
https://wiki.archlinux.org/title/Swap#Swap_partition

1 Like

The partition has the matching swap type GUID:

~ ❯ lsblk --all --output name,type,fstype,parttype
NAME        TYPE FSTYPE PARTTYPE
nvme0n1     disk        
nvme1n1     disk        
├─nvme1n1p1 part vfat   c12a7328-f81f-11d2-ba4b-00a0c93ec93b
├─nvme1n1p2 part ext4   0fc63daf-8483-4772-8e79-3d69d8477de4
└─nvme1n1p3 part swap   0657fd6d-a4ab-43c4-84e5-0933c84b4f4f

Anything else that could cause swap not to be auto enabled after boot?

Does the journal indicate any issues with swap? Maybe do a search for all entries containing the text swap:

journalctl -g swap

If the list is too long, you can use tail to prune it to the the n most recent entries. You want to go back to at least your last boot, when swap should have been automatically activated. This will list the most recent 75 journal entries:

journalctl -g swap | tail -75

Also, make a note of any times that you manually activate swap, so that you can see if there is any difference between what happens at boot and after you manually enable swap.

1 Like

There is this - if the swap resides at the same physical device as the EFI partition and root and has the swap GUID type then swap will be autodetected.

However - if the above is not true - you need to specifically mount the device in your system’s fstab.

Discoverable Partitions Specification | UAPI Group Specifications

I think this should be

UUID=2d2476ca-269a-41e3-8666-153465a279e5 swap           swap    defaults         0       0

As your system is on the same partitio - you can comment the line

# UUID=2d2476ca-269a-41e3-8666-153465a279e5 none           swap    defaults         0       0

If you root file system has the Linux x86-64 root (/) GUID (4f68bce3-e8cd-4db1-96e7-fbcaf984b709 or 0x8304) type you can comment the entire fstab and your system would still boot.

3 Likes

They should be equivalent.

1 Like

Yes, they are, and have always been. :wink:

1 Like

I turned on the computer today, and the only three entries for today from journalctl -g swap are:

-- Boot a796cf3906814b2ab5ae7583bf339900 --
May 25 09:55:47 manjattan kernel: Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
May 25 09:55:52 manjattan /usr/lib/gdm-x-session[844]: (**) Allowing byte-swapped clients
May 25 10:09:45 manjattan /usr/lib/gdm-x-session[1780]: (**) Allowing byte-swapped clients

Arch wiki shows none swap here and here. But if swap swap is the same, there should be no issue.

What else can I check to figure why swap is not auto enabled after boot?

Some system information might be useful for troubleshooting this issue. Please post the full output of:

inxi -zv8
1 Like

You could try sw in options

UUID=2d2476ca-269a-41e3-8666-153465a279e5 none           swap    sw         0       0

Apparently sw indicates that the swap partition is to be activated with swapon -a.

When the none swap and swap swap mount point and file system is providing identical handling and the partition has the correct partition type GUID there is no reason why swap is not assigned.

For verification - after a fresh boot - you can check - If swap is assigned you will get a result similar to my example otherwise the result will be empty

 $ swapon
NAME           TYPE       SIZE USED PRIO
/dev/nvme1n1p3 partition 68,9G   0B   -2

I cannot see why the swap shouldn’t be mounted automagically.

If you installed the system by hand - there is the possibility the partition has not been formatted for swap - or the formatting has been damaged somehow.

sudo mkswap <device>

This is likely to alter the partition’s guid (not partition type guid) but as described above - you don’t actually need an fstab entry - systemd can figure it out on it’s own.

3 Likes
output of inxi -zv8 before running swapon -a:
System:
  Kernel: 6.12.28-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 15.1.1
    clocksource: tsc avail: acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.12-x86_64
    root=UUID=7c0a971b-bc55-40bb-8e24-90f3bb31883d rw quiet
    udev.log_priority=3
  Desktop: GNOME v: 48.1 tk: GTK v: 3.24.49 wm: gnome-shell
    tools: gsd-screensaver-proxy dm: GDM v: 48.0 Distro: Manjaro
    base: Arch Linux
Machine:
  Type: Laptop System: HP product: HP ZBook Studio x360 G5 v: N/A
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: HP model: 844F v: KBC Version 16.3E.01 serial: <superuser required>
    part-nu: 8AJ07AV uuid: <superuser required> UEFI: HP v: Q71 Ver. 01.09.02
    date: 11/29/2019
Battery:
  ID-1: BAT0 charge: 76.7 Wh (99.5%) condition: 77.1/77.1 Wh (100.0%)
    volts: 12.6 min: 11.6 model: Hewlett-Packard Primary type: Li-ion
    serial: <filter> status: not charging
Memory:
  System RAM: total: 16 GiB available: 15.4 GiB used: 9.82 GiB (63.8%)
  Message: For most reliable report, use superuser + dmidecode.
  Array-1: capacity: 32 GiB slots: 2 modules: 2 EC: None
    max-module-size: 16 GiB note: est.
  Device-1: Bottom-Slot 1(left) type: DDR4 detail: synchronous size: 8 GiB
    speed: 2400 MT/s volts: curr: 1 width (bits): data: 64 total: 64
    manufacturer: Micron part-no: 8ATF1G64HZ-2G3H1 serial: <filter>
  Device-2: Bottom-Slot 2(right) type: DDR4 detail: synchronous size: 8 GiB
    speed: spec: 3200 MT/s actual: 2400 MT/s volts: curr: 1 width (bits):
    data: 64 total: 64 manufacturer: N/A part-no: NMSO480E82-3200E
    serial: <filter>
PCI Slots:
  Permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: Intel Core i9-9980HK bits: 64 type: MT MCP arch: Coffee Lake
    gen: core 9 level: v3 note: check built: 2018 process: Intel 14nm family: 6
    model-id: 0x9E (158) stepping: 0xD (13) microcode: 0x102
  Topology: cpus: 1x dies: 1 clusters: 8 cores: 8 threads: 16 tpc: 2
    smt: enabled cache: L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 2 MiB
    desc: 8x256 KiB L3: 16 MiB desc: 1x16 MiB
  Speed (MHz): avg: 800 min/max: 800/5000 scaling: driver: intel_pstate
    governor: powersave cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800
    8: 800 9: 800 10: 800 11: 800 12: 800 13: 800 14: 800 15: 800 16: 800
    bogomips: 76816
  Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat
    arch_capabilities arch_perfmon art avx avx2 bmi1 bmi2 bts clflush
    clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64
    dtherm dts epb ept ept_ad erms est f16c flexpriority flush_l1d fma fpu
    fsgsbase fxsr ht hwp hwp_act_window hwp_epp hwp_notify ibpb ibrs
    ibrs_enhanced ida intel_pt invpcid lahf_lm lm mca mce md_clear mmx
    monitor movbe mpx msr mtrr nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq
    pdcm pdpe1gb pebs pge pln pni popcnt pse pse36 pts rdrand rdseed rdtscp
    rep_good sdbg sep smap smep ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp
    syscall tm tm2 tpr_shadow tsc tsc_adjust tsc_deadline_timer vme vmx vnmi
    vpid x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr
  Vulnerabilities:
  Type: gather_data_sampling mitigation: Microcode
  Type: itlb_multihit status: KVM: Split huge pages
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed mitigation: Enhanced IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Enhanced / Automatic IBRS; IBPB:
    conditional; PBRSB-eIBRS: SW sequence; BHI: SW loop, KVM: SW loop
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort mitigation: TSX disabled
Graphics:
  Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] vendor: Hewlett-Packard
    driver: i915 v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20
    ports: active: none off: eDP-1 empty: DP-3, DP-4, HDMI-A-2, HDMI-A-3,
    HDMI-A-4 bus-ID: 00:02.0 chip-ID: 8086:3e9b class-ID: 0300
  Device-2: NVIDIA GP107GLM [Quadro P2000 Mobile] vendor: Hewlett-Packard
    driver: nvidia v: 570.144 alternate: nouveau,nvidia_drm
    non-free: 550-570.xx+ status: current (as of 2025-04; EOL~2026-12-xx)
    arch: Pascal code: GP10x process: TSMC 16nm built: 2016-2021 pcie: gen: 3
    speed: 8 GT/s lanes: 16 ports: active: none off: DP-1 empty: DP-2,HDMI-A-1
    bus-ID: 01:00.0 chip-ID: 10de:1cba class-ID: 0300
  Device-3: Chicony HP HD Camera driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-7:2 chip-ID: 04f2:b5e7
    class-ID: 0e02 serial: <filter>
  Display: x11 server: X.org v: 1.21.1.16 with: Xwayland v: 24.1.6
    compositor: gnome-shell driver: X: loaded: modesetting,nvidia dri: iris
    gpu: i915,nvidia,nvidia-nvswitch display-ID: :1 screens: 1
  Screen-1: 0 s-res: 3840x2160 s-size: <missing: xdpyinfo>
  Monitor-1: DP-1 mapped: DP-0 note: disabled pos: primary
    model: LG (GoldStar) HDR 4K serial: <filter> built: 2018 res:
    mode: 3840x2160 hz: 60 scale: 100% (1) dpi: 163 gamma: 1.2 chroma: red:
    x: 0.682 y: 0.314 green: x: 0.278 y: 0.675 blue: x: 0.153 y: 0.047 white:
    x: 0.314 y: 0.329 size: 600x340mm (23.62x13.39") diag: 690mm (27.2")
    ratio: 16:9 modes: 3840x2160, 2560x1440, 1920x1080, 1600x900, 1280x1024,
    1280x800, 1152x864, 1280x720, 1024x768, 800x600, 720x480, 640x480
  Monitor-2: eDP-1 mapped: eDP-1-1 note: disabled model: AU Optronics 0x33eb
    built: 2017 res: 3840x2160 dpi: 284 gamma: 1.2 chroma: red: x: 0.651
    y: 0.329 green: x: 0.204 y: 0.714 blue: x: 0.145 y: 0.055 white: x: 0.314
    y: 0.329 size: 344x193mm (13.54x7.6") diag: 394mm (15.5") ratio: 16:9
    modes: 3840x2160
  EDID-Warnings: 1: parse_edid: unknown flag 3
  API: EGL v: 1.5 hw: drv: intel iris drv: nvidia nouveau drv: nvidia
    platforms: device: 0 drv: nvidia device: 1 drv: iris device: 2 drv: nouveau
    device: 3 drv: swrast gbm: drv: iris surfaceless: drv: nvidia x11:
    drv: nvidia inactive: wayland
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 570.144
    glx-v: 1.4 direct-render: yes renderer: Quadro P2000/PCIe/SSE2
    memory: 3.91 GiB
  Info: Tools: api: eglinfo,glxinfo gpu: nvidia-settings,nvidia-smi
    x11: xprop,xrandr
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel alternate: snd_soc_avs,snd_sof_pci_intel_cnl
    bus-ID: 00:1f.3 chip-ID: 8086:a348 class-ID: 0403
  Device-2: NVIDIA GP107GL High Definition Audio driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 01:00.1
    chip-ID: 10de:0fb9 class-ID: 0403
  API: ALSA v: k6.12.28-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: JACK v: 1.9.22 status: off tools: N/A
  Server-3: PipeWire v: 1.4.2 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Cannon Lake PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 00:14.3 chip-ID: 8086:a370 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  IF-ID-1: docker0 state: down mac: <filter>
  IP v4: <filter> scope: global broadcast: <filter>
  Info: services: NetworkManager, systemd-timesyncd, wpa_supplicant
  WAN IP: <filter>
Bluetooth:
  Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) driver: btusb
    v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-14:5
    chip-ID: 8087:0aaa class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 1 state: up address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 1.14 TiB used: 199.4 GiB (17.0%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 980 PRO 1TB
    size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: 2B2QGXA7 temp: 45.9 C
  ID-2: /dev/nvme1n1 maj-min: 259:1 vendor: Samsung
    model: MZVLB256HAHQ-000H7 size: 238.47 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: EXD70H2Q temp: 44.9 C scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 229.37 GiB size: 224.71 GiB (97.97%)
    used: 199.4 GiB (88.7%) fs: ext4 dev: /dev/nvme1n1p2 maj-min: 259:3
    label: N/A uuid: 7c0a971b-bc55-40bb-8e24-90f3bb31883d
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 320 KiB (0.1%) fs: vfat dev: /dev/nvme1n1p1 maj-min: 259:2 label: N/A
    uuid: DE1B-5974
Swap:
  Alert: No swap data was found.
Unmounted:
  ID-1: /dev/nvme1n1p3 maj-min: 259:4 size: 8.8 GiB fs: swap label: N/A
    uuid: 2d2476ca-269a-41e3-8666-153465a279e5
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 16 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 1-7:2 info: Chicony HP HD Camera type: video driver: uvcvideo
    interfaces: 4 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0
    power: 500mA chip-ID: 04f2:b5e7 class-ID: 0e02 serial: <filter>
  Device-2: 1-8:3 info: Validity Sensors type: <vendor specific> driver: N/A
    interfaces: 1 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1
    power: 100mA chip-ID: 138a:00ab class-ID: ff00 serial: <filter>
  Hub-2: 1-11:4 info: Realtek RTS5411 Hub ports: 4 rev: 2.1
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 0bda:5411
    class-ID: 0900
  Device-1: 1-11.1:6 info: Realtek BillBoard Device type: billboard
    driver: N/A interfaces: 1 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1
    mode: 1.1 chip-ID: 0bda:5400 class-ID: 1100 serial: <filter>
  Device-2: 1-11.4:15 info: Texas Instruments TUSB3410 Microcontroller
    type: <vendor specific> driver: ti_usb_3410_5052,ti_usb_3410_5052_1
    interfaces: 1 rev: 1.1 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1
    power: 100mA chip-ID: 0451:3410 class-ID: ff00 serial: <filter>
  Device-3: 1-14:5 info: Intel Bluetooth 9460/9560 Jefferson Peak (JfP)
    type: bluetooth driver: btusb interfaces: 2 rev: 2.0
    speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1 power: 100mA
    chip-ID: 8087:0aaa class-ID: e001
  Hub-3: 2-0:1 info: super-speed hub ports: 10 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 58.0 C pch: 57.0 C mobo: N/A gpu: nvidia
    temp: 55 C
  Fan Speeds (rpm): N/A
Repos:
  Packages: pm: pacman pkgs: 1392 libs: 338 tools: gnome-software,pamac
    pm: rpm pkgs: 0 pm: flatpak pkgs: 0
  Active pacman repo servers in: /etc/pacman.d/mirrorlist
    1: https://ohioix.mm.fcix.net/manjaro/stable/$repo/$arch
    2: https://mirrors.atlas.net.co/manjaro/stable/$repo/$arch
    3: https://ftp.psnc.pl/linux/manjaro/stable/$repo/$arch
    4: https://www.mirrorservice.org/sites/repo.manjaro.org/repos/stable/$repo/$arch
    5: https://mirror.bouwhuis.network/manjaro/stable/$repo/$arch
    6: https://manjaro.mirror.garr.it/manjaro/stable/$repo/$arch
    7: https://mirror.ufro.cl/manjaro/stable/$repo/$arch
    8: https://linorg.usp.br/manjaro/stable/$repo/$arch
Processes:
  CPU top: 5 of 436
  1: cpu: 88.0% command: pamac-manager pid: 75897 mem: 834.8 MiB (5.2%)
  2: cpu: 23.4% command: gnome-contacts-search-provider pid: 75892
    mem: 61.4 MiB (0.3%)
  3: cpu: 23.2% command: kgx pid: 76012 mem: 165.6 MiB (1.0%)
  4: cpu: 15.4% command: nautilus pid: 75893 mem: 136.4 MiB (0.8%)
  5: cpu: 13.1% command: gnome-characters started-by: gjs-console pid: 75891
    mem: 128.7 MiB (0.8%)
  Memory top: 5 of 436
  1: mem: 834.8 MiB (5.2%) command: pamac-manager pid: 75897 cpu: 88.0%
  2: mem: 803.3 MiB (5.0%) command: electron pid: 3490 cpu: 7.7%
  3: mem: 558.9 MiB (3.5%) command: electron pid: 3483 cpu: 1.1%
  4: mem: 530.6 MiB (3.3%) command: msedge pid: 2550 cpu: 2.1%
  5: mem: 461.3 MiB (2.9%) command: gnome-shell pid: 1792 cpu: 6.2%
Info:
  Processes: 436 Power: uptime: 8h 9m states: freeze,mem,disk suspend: deep
    avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
    suspend, test_resume image: 6.15 GiB services: gsd-power,
    power-profiles-daemon, upowerd Init: systemd v: 257 default: graphical
    tool: systemctl
  Compilers: gcc: 15.1.1 Shell: Zsh v: 5.9 running-in: kgx inxi: 3.3.38

There is no clear reason why this is happening on your system - I have no idea.

Please test - it will cause no harm to the file system and will not prevent your system from starting.

First step: your root partition to be of Linux x86-64 root (/) partition type.

This is easily done using sgdisk (from package gptfdisk) and the -t, --typecode=partnum:{hexcode|GUID} argument.

Partition:
  ID-1: / raw-size: 229.37 GiB size: 224.71 GiB (97.97%)
    used: 199.4 GiB (88.7%) fs: ext4 dev: /dev/nvme1n1p2 maj-min: 259:3
    label: N/A uuid: 7c0a971b-bc55-40bb-8e24-90f3bb31883d

According to above you root resides on nvme1n1 using the second partition

sgdisk /dev/nvme1n1 --typecode=2:8304

Second step: To rule out any typos - edit your fstab to read (you can revert after the test)

# <file system>                           <mount point>  <type>  <options>        <dump>  <pass>
#UUID=DE1B-5974                            /boot/efi      vfat    umask=0077       0       2
#UUID=7c0a971b-bc55-40bb-8e24-90f3bb31883d /              ext4    defaults,noatime 0       1
#UUID=2d2476ca-269a-41e3-8666-153465a279e5 none           swap    defaults         0       0

Then restart your system and check if systemd found your swap automagically.

Do not run swapon but use journalctl, you should get something like

 $ journalctl -g swap --no-pager | tail -2
maj 26 14:04:02 tiger (udev-worker)[40476]: nvme1n1p3: /usr/lib/udev/rules.d/60-persistent-storage.rules:139 Added SYMLINK 'disk/by-label/swap'
maj 26 14:04:02 tiger (udev-worker)[40476]: nvme1n1p3: /usr/lib/udev/rules.d/60-persistent-storage.rules:157 Added SYMLINK 'disk/by-path/pci-0000:22:00.0-nvme-1-part/by-label/swap'

You can revert the changes to fstab after the test.

If this does not activate the swap there must be something partition related which prevents systemd from activating swap.

I would remove the partition and recreate it using a partitioning tool.

Swap devices are unformatted. The kernel accesses the raw disk blocks directly. :wink:

1 Like

What I am referring to is the mkswap command which is preparing the block device for swap use - the only truly unformatted partition is a BIOS GPT partition.

 $ mkswap --help

Usage:
 mkswap [options] device [size]

Set up a Linux swap area.

Options:
 -c, --check               check bad blocks before creating the swap area
 -f, --force               allow swap size area be larger than device
 -q, --quiet               suppress output and warning messages
 -p, --pagesize SIZE       specify page size in bytes
 -L, --label LABEL         specify label
 -v, --swapversion NUM     specify swap-space version number
 -U, --uuid UUID           specify the uuid to use
 -e, --endianness=<value>  specify the endianness to use (native, little or big)
 -o, --offset OFFSET       specify the offset in the device
 -s, --size SIZE           specify the size of a swap file in bytes
 -F, --file                create a swap file
     --verbose             verbose output
     --lock[=<mode>]       use exclusive device lock (yes, no or nonblock)
 -h, --help                display this help
 -V, --version             display version

For more details see mkswap(8).

2 Likes

What you get when you execute lsblk -f ?