You are not logged in.

#1 2015-01-27 10:43:57

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

[SOLVED] systemctl reports that loading swap failed, but it didn't

This system is fully functional, so this is more of an annoyance than anything.  If I run

systemctl --failed

I get the following failed state message:

● dev-disk-by\x2duuid-9f4a0440\x2dbf39\x2d468a\x2db6c8\x2d8d958c2c1208.swap loaded failed failed /dev/disk/by-uuid/9f4a0440-bf39-468a-b6c8-8d958c2c1208

Yet the swap partition is mounted and presumably functional:

[root@wizard ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda3                               partition       32275432        0       -1
[root@wizard ~]# free
              total        used        free      shared  buff/cache   available
Mem:       65952944      451708    65360192         864      141044    65296472
Swap:      32275432           0    32275432

When I check using

journalctl -b -l

it appears that the system is trying to load the swap partition twice, which appears to be the source of the error message:

Jan 26 03:33:15 wizard systemd[1]: Activating swap Swap Partition...
Jan 26 03:33:15 wizard systemd[1]: Activating swap /dev/disk/by-uuid/9f4a0440-bf39-468a-b6c8-8d958c2c1208...
Jan 26 03:33:15 wizard kernel: [TTM] Zone  kernel: Available graphics memory: 32976472 kiB
Jan 26 03:33:15 wizard kernel: [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
Jan 26 03:33:15 wizard kernel: [TTM] Initializing pool allocator
Jan 26 03:33:15 wizard kernel: [TTM] Initializing DMA pool allocator
Jan 26 03:33:15 wizard systemd[1]: Starting File System Check on /dev/disk/by-uuid/0c1f6d6e-bb0e-4d46-a741-60dd0e3f19c3...
Jan 26 03:33:15 wizard systemd[1]: Found device MR9271-8i BIOS\x20boot\x20partition.
Jan 26 03:33:15 wizard systemd[1]: Mounting /boot...
Jan 26 03:33:15 wizard kernel: mousedev: PS/2 mouse device common for all mice
Jan 26 03:33:15 wizard kernel: Adding 32275432k swap on /dev/sda3.  Priority:-1 extents:1 across:32275432k FS
Jan 26 03:33:15 wizard systemd[1]: Activated swap Swap Partition.
Jan 26 03:33:15 wizard systemd[1]: Activated swap /dev/disk/by-uuid/9f4a0440-bf39-468a-b6c8-8d958c2c1208.
Jan 26 03:33:15 wizard systemd[1]: Starting Swap.
Jan 26 03:33:15 wizard systemd[1]: Reached target Swap.
Jan 26 03:33:15 wizard kernel: igb 0000:04:00.0: DCA enabled
Jan 26 03:33:15 wizard kernel: igb 0000:04:00.0: added PHC on eth0
Jan 26 03:33:15 wizard kernel: igb 0000:04:00.0: Intel(R) Gigabit Ethernet Network Connection
Jan 26 03:33:15 wizard kernel: igb 0000:04:00.0: eth0: (PCIe:5.0Gb/s:Width x4) 00:25:90:ea:e9:a6
Jan 26 03:33:15 wizard kernel: igb 0000:04:00.0: eth0: PBA No: 106100-000
Jan 26 03:33:15 wizard kernel: igb 0000:04:00.0: Using MSI-X interrupts. 8 rx queue(s), 8 tx queue(s)
Jan 26 03:33:15 wizard systemd[1]: Mounted /boot.
Jan 26 03:33:15 wizard swapon[408]: swapon: /dev/disk/by-uuid/9f4a0440-bf39-468a-b6c8-8d958c2c1208: swapon failed: Device or resource busy
Jan 26 03:33:15 wizard systemd[1]: dev-disk-by\x2duuid-9f4a0440\x2dbf39\x2d468a\x2db6c8\x2d8d958c2c1208.swap swap process exited, code=exited status=255
Jan 26 03:33:15 wizard systemd[1]: Unit dev-disk-by\x2duuid-9f4a0440\x2dbf39\x2d468a\x2db6c8\x2d8d958c2c1208.swap entered failed state.

Of course I only have this partition listed once in fstab:

# /dev/sda3
UUID=9f4a0440-bf39-468a-b6c8-8d958c2c1208  none  swap  defaults  0  0

Any idea who else might be trying to mount a swap partition other than what is listed in /etc/fstab?

EDIT: Solved.  Apparently systemd looks for and automounts any swap partitions it finds (identified by Type=82.  The solution is to not list swap partitions in /etc/fstab

Last edited by pgoetz (2015-01-27 12:32:48)

Offline

#2 2015-01-27 11:03:44

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: [SOLVED] systemctl reports that loading swap failed, but it didn't

On further research, I discovered that you can also load swap using a systemd unit file ending in .swap.  However, I can't find such a file in

/etc/systemd/system

:

[root@wizard systemd]# pwd
/etc/systemd
[root@wizard systemd]# find . -depth -name \*.swap
[root@wizard systemd]#

Furthermore, the systemd.swap man page states that

If a swap device or file is configured in both /etc/fstab and a unit
file, the configuration in the latter takes precedence.

Now know more, but am still drawing a blank as to why I'm getting this failed state error message in the systemd log.

Last edited by pgoetz (2015-01-27 11:05:13)

Offline

#3 2015-01-27 11:17:36

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [SOLVED] systemctl reports that loading swap failed, but it didn't

Offline

#4 2015-01-27 12:29:31

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: [SOLVED] systemctl reports that loading swap failed, but it didn't

Thanks for that link.  I removed swap from /etc/fstab and that solved the problem.  The wiki link implies that systemd will automatically mount any swap partition it finds on the disk -- I'm not sure how I feel about this.  I prefer that systems only do things that I explicitly ask them to do (or that are required in order to do the stuff I ask them to do).

from the wiki entry:

systemd activates swap partitions based on two different mechanisms, both are executables in
 /usr/lib/systemd/system-generators. The generators are run on start-up and create native
systemd units for mounts. The first, systemd-fstab-generator, reads the fstab to generate units,
including a unit for swap. The second, systemd-gpt-auto-generator inspects the root disk to generate
units. It operates on GPT disks only, and can identify swap partitions by their type code 82. 

Offline

Board footer

Powered by FluxBB