You are not logged in.

#1 2014-02-18 06:12:34

unregistered
Member
Registered: 2008-04-09
Posts: 134

[SOLVED] Swap fail to start during boot

-During boot I can see [FAIL] during swapon
-I don't have any duplicate entries in my /etc/fstab
-Similar thread can be found here: https://bbs.archlinux.org/viewtopic.php?id=62129
Any ideas?

[root@node-0 ~]# systemctl status dev-sda2.swap
dev-sda2.swap - /dev/sda2
   Loaded: loaded (/run/systemd/generator.late/dev-sda2.swap)
   Active: failed (Result: exit-code) since Tue 2014-02-18 14:07:50 SGT; 54s ago
     What: /dev/sda2
  Process: 174 ExecActivate=/sbin/swapon /dev/sda2 (code=exited, status=255)

Feb 18 14:07:50 node-0 systemd[1]: Activating swap /dev/sda2...
Feb 18 14:07:50 node-0 swapon[174]: swapon: /dev/sda2: swapon failed: Device or resource busy
Feb 18 14:07:50 node-0 systemd[1]: dev-sda2.swap swap process exited, code=exited status=255
Feb 18 14:07:50 node-0 systemd[1]: Failed to activate swap /dev/sda2.
Feb 18 14:07:50 node-0 systemd[1]: Unit dev-sda2.swap entered failed state.
[root@node-0 ~]# swapon -s
Filename				Type		Size	Used	Priority
/dev/sda2                              	partition	2097148	0	-1
[root@node-0 ~]# cat /etc/fstab 
# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
# /dev/sda3
UUID=<censored>	/         	ext4      	rw,relatime,data=ordered	0 1

# /dev/sda1
UUID=<censored>      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro	0 2

# /dev/sda2
UUID=<censored>	none      	swap      	defaults  	0 0
[root@node-0 ~]# swapon /dev/sda2
swapon: /dev/sda2: swapon failed: Device or resource busy

Last edited by unregistered (2014-02-18 08:45:15)

Offline

#2 2014-02-18 06:51:00

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Swap fail to start during boot

Please use code tags.

Systemd can handle the swap partition automatically if you give it the right GUID.  Thus it is likely automatically creating a systemd-gpt-auto-generator to create a unit file for it in /run/systemd somewhere and running that.  Then it is probably also using the systemd-fstab-generator to create another unit file which then fails because the device is in use.

Either give sda2 the generic GUID (gdisk partition type 8300) or take it out of your fstab.

Offline

#3 2014-02-18 07:18:01

unregistered
Member
Registered: 2008-04-09
Posts: 134

Re: [SOLVED] Swap fail to start during boot

WonderWoofy wrote:

Please use code tags.

Systemd can handle the swap partition automatically if you give it the right GUID.  Thus it is likely automatically creating a systemd-gpt-auto-generator to create a unit file for it in /run/systemd somewhere and running that.  Then it is probably also using the systemd-fstab-generator to create another unit file which then fails because the device is in use.

Either give sda2 the generic GUID (gdisk partition type 8300) or take it out of your fstab.

Have edited to use code tags

I'm new to systemd but I did some reading and if I get what you are saying, systemd-gpt-auto-generator picks up my swap partition because it is of gdisk type 8200 Linux swap and automatically swapon it. After that, systemd-fstab-generator picks up the swap line in the fstab and tries to swapon again which fails because it has already been done which is why I have to either change the partition type or remove it from fstab, am I correct?

Last edited by unregistered (2014-02-18 07:18:34)

Offline

#4 2014-02-18 07:35:23

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Swap fail to start during boot

Indeed, you've got it right.  So pick whatever one seems more sane to you.  I personally like having the power to use the fstab's option if I want.  Though I don't actually use swap at all.

In theory I am fairly certain that it is actually supposed to be that the fstab will override the system-gpt-auto-generator made unit.  But in practice it seems that it just ends up in a race condiditon.  I'm not sure if this has been fixed or not upstream yet, but I guess we will find out soon since systemd 209 should be out any time now.

There is also a special GUID for the /home partition as well, and the systemd-gtp-auto-generator can handle that as well.  So if you ever create a /home partition, this issue may show again for that case.

Offline

#5 2014-02-18 08:44:59

unregistered
Member
Registered: 2008-04-09
Posts: 134

Re: [SOLVED] Swap fail to start during boot

Alright thanks for the tip

Offline

Board footer

Powered by FluxBB