You are not logged in.

#1 2013-10-13 05:11:58

jmetal88
Member
Registered: 2007-12-09
Posts: 66

Arch is trying to activate my swap partition twice

It's not really a serious problem at the moment, but it is annoying seeing an error on every boot.  Arch is trying to activate my swap partition twice, once by UUID and once as /dev/sda7.  I have explicitly specified in my fstab to have the swap partition activated by UUID, so I'm not sure what's causing it to also be mounted as /dev/sda7, but whichever of the two occurs second always fails.  My fstab only has one entry per partition, and all are by UUID.  Does anyone have any idea what else might be trying to activate the swap partition?

My fstab (mostly automatically generated, though I do think I remember removing one or two problem entries in the past):

# /dev/sda6
UUID=67d13305-c5d1-494c-a810-cf6eb3ac4924	/         	ext4      	rw,relatime,data=ordered	0 1

# /dev/sda2 LABEL=ESP
UUID=B212-E288      	/boot/efi 	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro	0 2

# /dev/sda7
UUID=4d2464ab-4499-40be-948e-2261efa79396	none      	swap      	defaults  	0 0

tmpfs   /tmp         tmpfs   nodev,nosuid,size=4G          0  0

Offline

#2 2013-10-13 11:28:52

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,647
Website

Re: Arch is trying to activate my swap partition twice

Don't define it in your fstab.  Systemd finds it automatically and mounts it in my experience.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2013-10-13 11:40:01

karol
Archivist
Registered: 2009-05-06
Posts: 25,432

Re: Arch is trying to activate my swap partition twice

Funny, it systemd recently had a bug which didn't enable swap at all https://mailman.archlinux.org/pipermail … 34145.html ;P

Offline

#4 2013-10-13 12:39:35

89c51
Member
Registered: 2012-06-05
Posts: 672

Re: Arch is trying to activate my swap partition twice

karol wrote:

Funny, it systemd recently had a bug which didn't enable swap at all https://mailman.archlinux.org/pipermail … 34145.html ;P

Wasn't there a patch for it in 207 and it was fixed with 208???

I believe i have a similar situation.

Seems to me that systemd mounts it by pattuuid and then tries to mount it by uuid (but i have no knowledge in that stuff so i probably talk bullshit)

systemctl

dev-disk-by\x2dlabel-Swap.swap                                                   loaded active   active    /dev/disk/by-label/Swap
dev-disk-by\x2dpartlabel-Swap.swap                                               loaded active   active    /dev/disk/by-partlabel/Swap
dev-disk-by\x2dpartuuid-6a4d9284\x2de456\x2d4150\x2d9fa6\x2d055acb042649.swap    loaded active   active    /dev/disk/by-partuuid/6a4d9284-e456-4150-9fa6-055acb042649
dev-disk-by\x2duuid-8fa200a9\x2d4cd4\x2d4967\x2d853c\x2d887ee6cae652.swap        loaded failed   failed    /dev/disk/by-uuid/8fa200a9-4cd4-4967-853c-887ee6cae652
dev-sda2.swap                                                                    loaded active   active    /dev/sda2

journal

Oct 13 10:28:37 mainland systemd[1]: Activating swap /dev/sda2...
Oct 13 10:28:37 mainland systemd[1]: Activating swap /dev/disk/by-uuid/8fa200a9-4cd4-4967-853c-887ee6cae652...
Oct 13 10:28:37 mainland swapon[307]: swapon: /dev/disk/by-uuid/8fa200a9-4cd4-4967-853c-887ee6cae652: swapon failed: Device or resource busy
Oct 13 10:28:37 mainland systemd[1]: Activated swap /dev/sda2.
Oct 13 10:28:37 mainland systemd[1]: dev-disk-by\x2duuid-8fa200a9\x2d4cd4\x2d4967\x2d853c\x2d887ee6cae652.swap swap process exited, code=exited status=255
Oct 13 10:28:37 mainland systemd[1]: Failed to activate swap /dev/disk/by-uuid/8fa200a9-4cd4-4967-853c-887ee6cae652.
Oct 13 10:28:37 mainland systemd[1]: Dependency failed for Swap.
Oct 13 10:28:37 mainland systemd[1]: Unit dev-disk-by\x2duuid-8fa200a9\x2d4cd4\x2d4967\x2d853c\x2d887ee6cae652.swap entered failed state.

fstab

# 
# /etc/fstab: static file system information
#
# <file system>					<dir>		<type>		<options>			<dump>	<pass>
tmpfs						/tmp		tmpfs		nodev,nosuid			0	0

UUID=33D6-79D6 					/boot/efi 	vfat 		defaults 			0	1
UUID=8fa200a9-4cd4-4967-853c-887ee6cae652 	none 		swap 		defaults			0	0
UUID=447f9004-da86-4f8b-b92a-2cdd4fc5b61b	/		ext4		defaults,noatime,discard	0	1

Offline

#5 2013-10-13 17:53:13

jmetal88
Member
Registered: 2007-12-09
Posts: 66

Re: Arch is trying to activate my swap partition twice

graysky wrote:

Don't define it in your fstab.  Systemd finds it automatically and mounts it in my experience.

That's a simple enough solution.  Had crossed my mind, in fact, but for some reason it bugs me having my system automatically activate the swap like that, so I'd rather just have it in my fstab.  I might have to do it just so I'll stop seeing the error on boot, though.

Offline

#6 2013-11-26 12:03:58

ackalker
Member
Registered: 2012-11-27
Posts: 199

Re: Arch is trying to activate my swap partition twice

I'm having the same problem here: error in journal about trying to activate an already active swap.
I believe I've read somewhere (too busy to look it up now, will edit this comment) that systemd is supposed to only consider a swap partition with a special magic UUID for auto-activation. I don't remember having set such an UUID for it myself.

EDIT: Here's the passage from systemd's NEWS file:

CHANGES WITH 207:
<snip>
        * A logic to automatically discover and enable home and swap
          partitions on GPT disks has been added. With this in place
          /etc/fstab becomes optional for many setups as systemd can
          discover certain partitions located on the root disk
          automatically. Home partitions are recognized under their
          GPT type ID 933ac7e12eb44f13b8440e14e2aef915. Swap
          partitions are recognized under their GPT type ID
          0657fd6da4ab43c484e50933c84b4f4f.

As it happens, I'm using GPT on the disk with the multiple activation problem, and the swap partition's GUID code as shown by cgdisk matches that mentioned in the NEWS file.

My question: should this error be considered a bug, given that the NEWS file clearly states that /etc/fstab is optional (but nowhere states that /home or swap partitions have to be removed from it in order to prevent errors) in this situation?

Last edited by ackalker (2013-11-26 17:04:49)

Offline

#7 2013-11-27 20:38:37

Gulver
Member
Registered: 2013-05-24
Posts: 208

Re: Arch is trying to activate my swap partition twice

This I was thinking about asking and after seeing this commented my swap line of fstab. Swap gets activated without hassle, no errors and warnings on boot.

Last edited by Gulver (2013-11-27 20:39:07)

Offline

#8 2013-11-28 03:37:44

mwc
Member
From: London, Canada
Registered: 2006-03-17
Posts: 17

Re: Arch is trying to activate my swap partition twice

graysky wrote:

... but for some reason it bugs me having my system automatically activate the swap like that

One can still create a unit file for any swaps you want to disable so it's not such a bad default.

Offline

#9 2013-11-28 20:27:38

Gulver
Member
Registered: 2013-05-24
Posts: 208

Re: Arch is trying to activate my swap partition twice

mwc wrote:
graysky wrote:

... but for some reason it bugs me having my system automatically activate the swap like that

One can still create a unit file for any swaps you want to disable so it's not such a bad default.

It is if you are multi booting, especially when it comes to linux users most have at least two OS installed for various reasons. Stupid feature is stupid.

Last edited by Gulver (2013-11-28 20:27:57)

Offline

#10 2013-11-28 21:33:20

progandy
Member
Registered: 2012-05-17
Posts: 2,151

Re: Arch is trying to activate my swap partition twice

Gulver wrote:

It is if you are multi booting, especially when it comes to linux users most have at least two OS installed for various reasons. Stupid feature is stupid.

Unless you hibernate to swap and then run another OS, it saves diskspace to share the swap partition. Since the swap is cleared with each reboot, you don't need to duplicate it if you don't use hibernation to switch between OSs.

Still, I dislike features which cannot be easily disabled. Systemd ships with unit generators, but doesn't include an option to disable them, you can only mask or modify created units after the fact. Either put some optional generators in optional packages or allow a configuration option to disable a generator without removing the file. Removing the file and using the NoExtract-rule for pacman is only a crude workaround.

rm /usr/lib/systemd/system-generators/systemd-gpt-auto-generator
vim /etc/pacman.conf ==> NoExtract=usr/lib/systemd/system-generators/systemd-gpt-auto-generator

Last edited by progandy (2013-11-28 21:40:25)

Offline

#11 2013-12-05 21:20:24

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,097
Website

Re: Arch is trying to activate my swap partition twice

progandy wrote:

Still, I dislike features which cannot be easily disabled.

Change the partition type of the swap device.

Offline

#12 2013-12-05 23:16:02

ackalker
Member
Registered: 2012-11-27
Posts: 199

Re: Arch is trying to activate my swap partition twice

falconindy wrote:

Change the partition type of the swap device.

Hmm, sounds a lot like "If you don't like getting speeding tickets in the mail, change the license plates on your car so some other poor shmuck gets them instead."
Obviously, "Adhere to the speed limits, or vote for a party that's gonna change them." would be more to the point.
IMHO, this 'feature' should be made configurable, not avoided by deception: as pointed out before, some people have multiple swap partitions on their drives, which they may want to suspend-to-disk to. No telling which of those systemd will try to activate if you let it. Probably the first, but it's a hard guess if you stand to lose some valuable data from a suspended OS while trying.

Last edited by ackalker (2013-12-05 23:41:32)

Offline

#13 2013-12-05 23:35:41

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

Re: Arch is trying to activate my swap partition twice

What I think faconindy is getting at is that systemd uses the partition GUID to determine the partitions that should be automagically mounted (or swapon'ed).  But these partition types/GUIDs have no bearing as to whether or not you can use it as a swap partition (or for any other purpose).  For example, a swap file has no GUID/partition type whatsoever, yet these are still usable as swap devices.  So if you change the partition to gptfdisk partition type 8300, like the other Linux partitions, then it will still be fully available as a swap device, but won't be picked up by systemd.

I vaguely remember reading somewhere that the intended setup was to be that the swap would be automatic unless there was an fstab entry (or native systemd.mount unit) for the partition, in which case it would be overridden.  So maybe this would be something to take up with the systemd folks?

Offline

#14 2013-12-05 23:47:57

ackalker
Member
Registered: 2012-11-27
Posts: 199

Re: Arch is trying to activate my swap partition twice

WonderWoofy wrote:

What I think faconindy is getting at is that systemd uses the partition GUID to determine the partitions that should be automagically mounted (or swapon'ed).  But these partition types/GUIDs have no bearing as to whether or not you can use it as a swap partition (or for any other purpose).  For example, a swap file has no GUID/partition type whatsoever, yet these are still usable as swap devices.  So if you change the partition to gptfdisk partition type 8300, like the other Linux partitions, then it will still be fully available as a swap device, but won't be picked up by systemd.

Of course I understood what falconindy was suggesting, I simply don't agree with partition types being set to something which doesn't match their contents. Let's say some day another 'auto' tool comes around (next version of GParted, maybe, or something Windows'y), sees a partition type, notices that the contents don't match that type, and helpfully begins to 'clean out/repair' whatever it thinks that's supposed to be there. Big problem.

WonderWoofy wrote:

I vaguely remember reading somewhere that the intended setup was to be that the swap would be automatic unless there was an fstab entry (or native systemd.mount unit) for the partition, in which case it would be overridden.  So maybe this would be something to take up with the systemd folks?

A few comments back, I asked whether the error from trying to activate swap a second time should be seen as a bug. If what you think you've read is correct, then it is. /etc/fstab should trump auto-magic anytime.

Last edited by ackalker (2013-12-05 23:56:23)

Offline

#15 2013-12-06 01:06:39

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

Re: Arch is trying to activate my swap partition twice

ackalker wrote:

A few comments back, I asked whether the error from trying to activate swap a second time should be seen as a bug. If what you think you've read is correct, then it is. /etc/fstab should trump auto-magic anytime.

Yeah sorry I have been following this thread kind of off and on, so I haven't actually read the whole thing.  If I reapeated anything that had already been well established, my apologies.

I read systemd-devel (or at least when it interests me), and I just kind of recall that as being part of the discussion.  Basically, the idea is that systemd is never intended to remove the functionality of the fstab.  So if users wish to continue using it, it should still work as before.  In particular I remember there being talk about setting mount options, and how one would still need to use the fstab (or native mount units) for that.  So if that is the case, it would seem as though setting your own mount options would take precedence over the generated defaults and thus the fstab in general would be prioritized over the generator.

I make no claims about how good or bad my memory is though.  This is probably something you should look into.

Offline

#16 2013-12-07 21:35:45

ams1
Member
Registered: 2013-12-02
Posts: 15

Re: Arch is trying to activate my swap partition twice

I seem to have a similar problem, maybe.

I want to use an encrypted swap (otherwise my encrypted home is pointless) so I have /etc/crypttab setup:

cryptswap         /dev/sda3        /dev/urandom            swap,cipher=aes-cbc-essiv:sha256,size=256

And then this in my /etc/fstab:

/dev/mapper/cryptswap	none		swap		sw			0 0

The /dev/mapper/cryptswap swapspace is mounted correctly, but it then also tries to mount /dev/sda3 as swap, which isn't helpful.

The service file is autogenerated in /run, so I can't find any way to disable it.

Is this the same problem?

Offline

#17 2013-12-08 03:25:00

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

Re: Arch is trying to activate my swap partition twice

ams1 wrote:

Is this the same problem?

It sounds like it.  Change the partition type code to something else.  I think a sane choice would be gdisk type 8300.

Offline

#18 2013-12-08 04:52:40

sufur
Banned
From: san francisco
Registered: 2013-12-07
Posts: 23
Website

Re: Arch is trying to activate my swap partition twice

swap partitions are more trouble than theyre worth, who needs 'em?
   I reluctantly made a swap file a whle back....don't ask me why.


end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         .o0o.     the question is never 'how'? or 'why'? .... in the end its always 'how much'?   .o0o.
  ---| remember and know that you'll always be best with what you enjoy and have fun doing, the very best |---

Offline

#19 2013-12-08 04:59:22

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

Re: Arch is trying to activate my swap partition twice

sufur wrote:

swap partitions are more trouble than theyre worth, who needs 'em?
   I reluctantly made a swap file a whle back....don't ask me why.

Though I don't use one, I'll point out that as a btrfs user, if I felt like I needed swap, a partition would be my only really viable option.  A swap file can be used if mounted with a loopback device, but it is slow an inefficient.

Offline

#20 2013-12-08 05:16:40

sufur
Banned
From: san francisco
Registered: 2013-12-07
Posts: 23
Website

Re: Arch is trying to activate my swap partition twice

Im not familiar with btrfs yet....you're a crack Sys admin woofy so I'll take your word on that......
   I just think swap partitions are an ancient way of thinking....


end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         .o0o.     the question is never 'how'? or 'why'? .... in the end its always 'how much'?   .o0o.
  ---| remember and know that you'll always be best with what you enjoy and have fun doing, the very best |---

Offline

#21 2013-12-10 14:44:04

ams1
Member
Registered: 2013-12-02
Posts: 15

Re: Arch is trying to activate my swap partition twice

Likewise, I'm using btrfs so swapfiles are not happening.

I'll try changing the partition type and see what happens. I suppose, technically, the partition does not contain a valid swap partition, so the partition type was wrong. (Ok, it does contain a valid swap partition, but it's encrypted, so it doesn't count.) "Linux filesystem" doesn't seem right either; I think I'll try "Linux reserved".

Offline

Board footer

Powered by FluxBB