[systemd-devel] Swap gets activated twice (through fstab and gpt generators)

Chris Murphy lists at colorremedies.com
Tue Jan 27 16:17:36 PST 2015

On Tue, Jan 27, 2015 at 5:05 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Tue, 27.01.15 23:29, J├│hann B. Gu├░mundsson (johannbg at gmail.com) wrote:
>> On 01/27/2015 10:48 PM, Lennart Poettering wrote:
>> >Another idea might be to simply accept that activating the swap by two
>> >names at the same time can happen concurrently, and teach mkswap in
>> >some way to handle this gracefully.
>> >
>> >For example, mkswap could learn a new switch --idempotent or so, which
>> >we could always pass from systemd. If set and if activating the swap
>> >fails with EBUSY because the swap is already activated it would eat
>> >that up and return success.
>> Is not the problem here that we are using two generators to parse this?
> No, not at all.
> The problem is simply that we cannot know in advance that /dev/sda7
> and /dev/disk/by-uuid/c0e7978b-f82b-4b7f-b72b-6717f6909abc will
> eventually refer to the same device.

Are these just scary looking warnings? Or is swapon actually listing
the same device twice, as if it's activated twice? That'd seem to be a
bug. What if the fstab listed the same swap twice, either duplicate
lines or one line with /dev/sdXY and one line with UUID for the same

I thought /dev/sdXY is considered sufficiently unreliable that it
shouldn't be used for static configuration files anymore.?

Patient: "Doctor, when I bend my arm like this it hurts!"
Doctor: "I suggest not bending your arm that way."

It's probably not what people want to hear because it doesn't really
solve the problem, but the problem is created by an unreliable
practice in the first place.

Chris Murphy

More information about the systemd-devel mailing list