Failed to activate swap - On boot

On boot, it shows:

[FAILED] Failed to activate swap /swapfile
[DEPEND] Dependency failed for Swap.

four times, before continuing to the log in screen.

swapon returns:

/dev/sda3 partition 8.8G   0B   -2

I played around with the swap settings a few weeks ago for an issue I was having regarding hibernation/sleep, where I created a swapfile and disabled the partition. I’ve since deleted the swapfile and thought I activated the swap partition again?

inxi -Fazy returns:

  Kernel: 5.8.18-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.8-x86_64 
  root=UUID=3aa0ac64-1933-4b2b-b9c7-d7d5cdbb7a48 rw quiet apparmor=1 
  security=apparmor resume=UUID=f9620ed0-383b-482f-9df0-473fc0c365f5 
  Desktop: Xfce 4.14.3 tk: Gtk 3.24.23 info: xfce4-panel wm: xfwm4 
  dm: LightDM 1.30.0 Distro: Manjaro Linux 
  Type: Laptop System: ASUSTeK product: N56VZ v: 1.0 serial: <filter> 
  Mobo: ASUSTeK model: N56VZ v: 1.0 serial: <filter> UEFI: American Megatrends 
  v: N56VZ.215 date: 11/02/2012 
  ID-1: BAT0 charge: 21.6 Wh condition: 22.4/57.7 Wh (39%) volts: 11.1/11.1 
  model: ASUSTeK N56--52 type: Li-ion serial: N/A status: Unknown cycles: 577 
  Info: Quad Core model: Intel Core i7-3630QM bits: 64 type: MT MCP 
  arch: Ivy Bridge family: 6 model-id: 3A (58) stepping: 9 microcode: 21 
  L2 cache: 6144 KiB 
  flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 38335 
  Speed: 1198 MHz min/max: 1200/3400 MHz Core speeds (MHz): 1: 1198 2: 1197 
  3: 1197 4: 1197 5: 1197 6: 1197 7: 1197 8: 1197 
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
  Type: l1tf 
  mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, 
  IBRS_FW, STIBP: conditional, RSB filling 
  Type: srbds status: Vulnerable: No microcode 
  Type: tsx_async_abort status: Not affected 
  Device-1: Intel 3rd Gen Core processor Graphics vendor: ASUSTeK N56VZ 
  driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:0166 
  Device-2: NVIDIA GK107M [GeForce GT 650M] driver: N/A 
  alternate: nouveau, nvidia_drm, nvidia bus ID: 01:00.0 chip ID: 10de:0fd1 
  Device-3: Sunplus Innovation Asus Webcam type: USB driver: uvcvideo 
  bus ID: 1-1.3:4 chip ID: 1bcf:2883 
  Display: x11 server: X.Org 1.20.9 driver: intel display ID: :0.0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") 
  s-diag: 582mm (22.9") 
  Monitor-1: LVDS1 res: 1920x1080 hz: 60 dpi: 143 size: 340x190mm (13.4x7.5") 
  diag: 389mm (15.3") 
  OpenGL: renderer: Mesa DRI Intel HD Graphics 4000 (IVB GT2) 
  v: 4.2 Mesa 20.2.2 compat-v: 3.0 direct render: Yes 
  Device-1: Intel 7 Series/C216 Family High Definition Audio 
  vendor: ASUSTeK N56VZ driver: snd_hda_intel v: kernel bus ID: 00:1b.0 
  chip ID: 8086:1e20 
  Device-2: NVIDIA GK107 HDMI Audio driver: snd_hda_intel v: kernel 
  bus ID: 01:00.1 chip ID: 10de:0e1b 
  Sound Server: ALSA v: k5.8.18-1-MANJARO 
  Device-1: Intel Centrino Wireless-N 2230 driver: iwlwifi v: kernel 
  port: f040 bus ID: 03:00.0 chip ID: 8086:0887 
  IF: wlp3s0 state: up mac: <filter> 
  Device-2: Qualcomm Atheros AR8161 Gigabit Ethernet vendor: ASUSTeK N56VZ 
  driver: alx v: kernel port: d000 bus ID: 04:00.0 chip ID: 1969:1091 
  IF: enp4s0 state: down mac: <filter> 
  Local Storage: total: 937.65 GiB used: 116.42 GiB (12.4%) 
  SMART Message: Required tool smartctl not installed. Check --recommends 
  ID-1: /dev/sda vendor: Seagate model: ST750LM022 HN-M750MBB size: 698.64 GiB 
  block size: physical: 4096 B logical: 512 B speed: 3.0 Gb/s 
  rotation: 5400 rpm serial: <filter> rev: 0001 scheme: GPT 
  ID-2: /dev/sdb type: USB vendor: Samsung model: Flash Drive size: 239.02 GiB 
  block size: physical: 512 B logical: 512 B serial: <filter> rev: 1100 
  scheme: MBR 
  ID-1: / raw size: 689.54 GiB size: 677.72 GiB (98.29%) 
  used: 109.65 GiB (16.2%) fs: ext4 dev: /dev/sda2 
  Kernel: swappiness: 10 (default 60) cache pressure: 100 (default) 
  ID-1: swap-1 type: partition size: 8.80 GiB used: 0 KiB (0.0%) priority: -2 
  dev: /dev/sda3 
  System Temperatures: cpu: 55.0 C mobo: N/A 
  Fan Speeds (RPM): cpu: 2500 
  Processes: 234 Uptime: 3h 57m Memory: 7.66 GiB used: 1.93 GiB (25.2%) 
  Init: systemd v: 246 Compilers: gcc: 10.2.0 clang: 11.0.0 Packages: 
  pacman: 1262 lib: 369 flatpak: 0 Shell: Bash v: 5.0.18 
  running in: xfce4-terminal inxi: 3.1.08 

sudo systemctl --failed returns:

● swapfile.swap loaded failed failed /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.

1 loaded units listed.


Hi @rocket19 :wink:

Did you add the swapfile to /etc/fstab?

Hi megavolt,

When I originally made the swapfile, I did:

sudo mkswap /swapfile
sudo chmod u=rw,go= /swapfile
sudo swapon /swapfile
sudo bash -c "echo /swapfile none swap defaults 0 0 >> /etc/fstab"

Hi @rocket19,

Looking at you first comment, you are using a swap partition (/dev/sda3) and not a swap file.
On my laptop, the output of the command swapon --show is:

/swapfile file   4G   0B   -2

If you want to use a swapfile, I would suggest to disable the swap partition, remove the swap partition from /etc/fstab and create the swapfile.

You will find everything you need in the ArchWiki: Swap - ArchWiki

If the new settings are running fine, you can reallocate swap partition space on /dev/sda3 with GParted.

Hi @vcottineau thanks for your response.

Yeah I would like to use my swap partition and not a swap file for the swap space.

I installed originally with the swap partition assigned, but tried using a swap file for an issue with hibernation I am having. I want to just use the partition and not a swap file. What’s the best way to go back to that setting?

Hi @rocket19,

All you need is mentionned in the ArchWiki: Swap - ArchWiki
You may also need this page: fstab - ArchWiki

  1. Remove the swap file:
swapoff /swapfile
rm -f /swapfile
  1. Remove the swap file entry from /etc/fstab
  2. If /dev/sda3 is already a swap partition then swapon /dev/sd3
  3. Get the UUID of your swap partition:
lsblk -dno UUID /dev/sda3
  1. Add an entry in /etc/fstab for you swap parititon and replace *device_UUID* with the UUID you got at step 4 to enable this swap partition on boot:
UUID= *device_UUID* none swap defaults 0 0
  1. Reboot and check if all is running fine

sudo swapon /dev/sda3 returns:

swapon: /dev/sda3: swapon failed: Device or resource busy

Can you give the output of the following commands:

cat /etc/fstab
swapon -s
fdisk -l
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=3984-1FEC                            /boot/efi      vfat    umask=0077 0 2
UUID=3aa0ac64-1933-4b2b-b9c7-d7d5cdbb7a48 /              ext4    defaults,noatime 0 1
UUID=f9620ed0-383b-482f-9df0-473fc0c365f5 swap           swap    defaults,noatime 0 2
/swapfile none swap defaults 0 0
UUID=f9620ed0-383b-482f-9df0-473fc0c365f5 none swap defaults 0 0
Filename				Type		Size	Used	Priority
/dev/sda3                              	partition	9226236	0	-2
Device          Start        End    Sectors   Size Type
/dev/sda1        4096     618495     614400   300M EFI System
/dev/sda2      618496 1446689125 1446070630 689.5G Linux filesystem
/dev/sda3  1446692864 1465145343   18452480   8.8G Linux swap

In your /etc/fstab you have a duplicate on the swap partition and still a reference to your swapfile.
I would suggest to remove these two lines:

/swapfile none swap defaults 0 0
UUID=f9620ed0-383b-482f-9df0-473fc0c365f5 none swap defaults 0 0

Then reboot and check if it’s better.

Excellent. Thanks for your help. That seems to have fixed the issue!

sudo systemctl --failed now returning:

0 loaded units listed.

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