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

Lennart Poettering lennart at poettering.net
Tue Jan 27 16:24:12 PST 2015


On Tue, 27.01.15 17:17, Chris Murphy (lists at colorremedies.com) wrote:

> > 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? 

It should be unproblematic, but it looks scary right now. The swapon
will only succeed once, and fail the second time, and that doesn't
look pretty, but the kernel should do the right thing and not get
confused by this.

This is really just an excercise of making the error message go
away. (And I think I fixed it now in git, see other mail)

> 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 device?

It doesn't matter where the configuration came from. If you have
multiple lines for the same device in fstab reffering to it via
different names, or whether the GPT auto discovery found it, it's all
the same: we cannot know in advance, before the device actually popped
up, whether the device paths will actually resolve to the same device
in the end.

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

I thsouldn't. But the GPT auto discovery uses it. Also people are
conservative, and as long as you only ever have a single disk using
/dev/sda in fstab is something you can get away with.

> 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.

Well, in the case of two lines in /etc/fstab that refer to the same
device, that's true. But I don't think we should generate an error if
people list stuff in /etc/fstab that we also discover automatically...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list