Bug 731601

Summary: Swap files which are not full partitions are not mounted at boot time
Product: [openSUSE] openSUSE 12.1 Reporter: Tony Mechelynck <antoine.mechelynck>
Component: BasesystemAssignee: Frederic Crozat <fcrozat>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None CC: suse-beta
Version: Final   
Target Milestone: ---   
Hardware: x86-64   
OS: SUSE Other   
Whiteboard:
Found By: Community User Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: dmesg output after booting with systemd.log_level=debug systemd.log_target=kmsg

Description Tony Mechelynck 2011-11-20 18:13:33 UTC
My /etc/fstab includes the following two lines:

/dev/disk/by-id/ata-WDC_WD800JD-60LSA0_WD-WMAM9E273734-part2 swap swap defaults  0 0

/swapfile swap swap nofail 0 0

Under openSUSE 11.4, "swapon -s" showed that (with no explicit action by me) both were in use, with priorities -1 and -2 respectively. Under openSUSE 12.1, only /dev/sda2 is mentioned, and with priority 0.
Comment 1 Tony Mechelynck 2011-11-20 18:18:18 UTC
"swapon -av" displays the following:

swapon on /swapfile
swapon: /swapfile: insecure permissions 0644, 0600 suggested.
swapon: /swapfile: found swap signature: version 1, page-size 4, same byte order
swapon: /swapfile: pagesize=4096, swapsize=2147483648, devsize=2147483648

after which "swapon -s" shows not only /dev/sda2 (priority 0) but also /swapfile (priority -1).
Comment 2 Kun Kun Zhang 2012-03-08 14:02:35 UTC
Long time no response.So closed.Feel free to reopen it.Thanks.
Comment 3 Christian Boltz 2012-03-13 23:27:16 UTC
Nobody reassigning the bug to the package maintainer is no reason to close a bug as "noresponse". Reopening (and temporarily assigning to me).
Comment 4 Christian Boltz 2012-03-13 23:29:46 UTC
Tony, do you boot with systemd or sysvinit? Do you see this bug when booting with the other init system?
Comment 5 Tony Mechelynck 2012-03-20 16:26:31 UTC
(In reply to comment #4)
> Tony, do you boot with systemd or sysvinit? Do you see this bug when booting
> with the other init system?

I used to boot with init until the update to openSUSE 12.1 changed it to systemd without asking me. Since then I've had many problems of all kinds with the new boot procedure and my take about it is: it weren't broke, so why the hell did they gone fixt it? I don't know how to go back to booting with init, inittab, etc., and if I did, I would.
Comment 6 Tony Mechelynck 2012-03-20 16:28:45 UTC
P.S. Until openSUSE 11.4 (with init) I did not see this problem.
Comment 7 Christian Boltz 2012-03-20 20:42:43 UTC
(In reply to comment #5)
> I used to boot with init until the update to openSUSE 12.1 changed it to
> systemd without asking me. Since then I've had many problems of all kinds with
> the new boot procedure and my take about it is: it weren't broke, so why the
> hell did they gone fixt it? 

It looks like the "old" sysvinit won't be maintained in the future. Nevertheless many people agree with you - the switch was too early. I also had some "fun" with systemd in the beta phase. OTOH, I'm using systemd (from the 12.1 update repo) without problems on some servers and my laptop, so it is definitely getting better.

> I don't know how to go back to booting with init, inittab, etc., and if I did, I would.

For a temporary test, you can select sysvinit as init system in grub or use the additional boot parameter
    init=/sbin/sysvinit

If you want to switch back to sysvinit permanently, run
    zypper in sysvinit-init
It will suggest the removal of systemd-sysvinit.

Does booting with sysvinit mount your swap files?
Comment 8 Tony Mechelynck 2012-03-21 16:52:52 UTC
(In reply to comment #7)
[...]
> For a temporary test, you can select sysvinit as init system in grub or use the
> additional boot parameter
>     init=/sbin/sysvinit
> 
> If you want to switch back to sysvinit permanently, run
>     zypper in sysvinit-init
> It will suggest the removal of systemd-sysvinit.

Ah, thanks for the info.
> 
> Does booting with sysvinit mount your swap files?

I'll try at next boot (after making sure that I still have a swap file -- I cleared it away a few weeks ago to make room on the disk).
Comment 9 Tony Mechelynck 2012-03-22 07:10:33 UTC
After selecting "System V" boot (F5 rolldown in the grub menu), both /dev/sda2 and /swapfile are listed by swapon -s (with priority -1 and -2 respectively). Now let's reboot with systemd (default)…
Comment 10 Tony Mechelynck 2012-03-22 07:31:12 UTC
…and swapon -s lists only /dev/sda2 (with priority 0).
Comment 11 Christian Boltz 2012-03-22 12:18:13 UTC
OK, then this is clearly a systemd issue.
Comment 12 Frederic Crozat 2012-03-22 12:37:05 UTC
please boot with under systemd with the following parameters
systemd.log_level=debug systemd.log_target=kmsg

and attach dmesg output to this bug report.

Thanks.
Comment 13 Christian Boltz 2012-03-22 18:10:06 UTC
(reverting the severity to major - seems I accidently changed it with my last comment)
Comment 14 Tony Mechelynck 2012-03-23 01:13:25 UTC
(In reply to comment #12)
> please boot with under systemd with the following parameters
> systemd.log_level=debug systemd.log_target=kmsg
> 
> and attach dmesg output to this bug report.
> 
> Thanks.

Where do I specify those parameters? At the end of the kernel command-line in the grub menu (the same place as a nondefault runlevel)?
Comment 15 Frederic Crozat 2012-03-23 08:28:20 UTC
yes, sorry, I forgot to tell you those are kernel commandline parameters.
Comment 16 Tony Mechelynck 2012-03-23 12:22:22 UTC
Created attachment 482935 [details]
dmesg output after booting with systemd.log_level=debug systemd.log_target=kmsg
Comment 17 Frederic Crozat 2012-03-23 12:51:26 UTC
try replacing "nofail" with "defaults" in /etc/fstab. It should fix your issue.
Comment 18 Tony Mechelynck 2012-03-27 12:52:03 UTC
(In reply to comment #17)
> try replacing "nofail" with "defaults" in /etc/fstab. It should fix your issue.

Hm, I'll try; but the idea was to make the file "optional" without the need to edit the fstab every time I create or remove the file (which I don't really need except when running some extremely memory-expensive job such as compiling and _linking_ the latest SeaMonkey changeset).

If systemd tries to enable the swap (with "defaults" rather than "nofail") before remounting the / filesystem read-write, won't I get a fatal message from swapon when trying to enable /swapfile as a mandatory swap device? We'll see: if it doesn't work I now know how to reboot /sbin/sysvinit or even /bin/bash to undo the change in "emergency repairs" mode.

(IIUC under sysvinit swapon is run twice: once very early to enable swap "partitions" as soon as possible, and a second time after fstab devices are mounted to enable swap "files" once they can be reached. Note also that unlike systemd, sysvinit mounts swap with negative priorities.)

Well, stay tuned for further flash news on this channel ;-)
Comment 19 Tony Mechelynck 2012-03-27 16:38:00 UTC
With "defaults" instead of "nofail" /dev/sda2 and /swapfile appear both in the output of "swapon -s" but there is still a difference with what happens in sysvinit boot:

- With sysvinit, /dev/sda2 has priority -1, /swapfile has -2
- With systemd, they both have priority 0

Does this mean that sysvinit will use sda2 in preference to swapfile and that sysvinit will use them both about equally? Here is the output of "swapon -s" soon after booting with systemd:

Filename                                Type            Size    Used    Priority
/dev/sda2                               partition       3148736 0       0
/swapfile                               file            3145724 0       0
Comment 20 Frederic Crozat 2012-03-27 16:49:58 UTC
sysvinit just calls swapon -a, so it is possible the logic in swapon -a is different than the "simple" swapon /dev/sda2 | swapon /swapfile calls done by systemd
Comment 21 Frederic Crozat 2012-06-07 13:29:49 UTC
fixed in systemd >=  37-3.165.1 package in home:fcrozat:systemd ( http://download.opensuse.org/repositories/home:/fcrozat:/systemd/openSUSE_12.1/ ) for 12.1 and also in Factory. It will be part of next 12.1 maintenance update for systemd (although none is scheduled yet).

Closing as fixed
Comment 22 Bernhard Wiedemann 2012-06-08 15:00:10 UTC
This is an autogenerated message for OBS integration:
This bug (731601) was mentioned in
https://build.opensuse.org/request/show/124228 Factory / systemd
Comment 23 Frederic Crozat 2013-03-07 13:12:12 UTC
mr #157832 for openSUSE 12.1
Comment 24 Bernhard Wiedemann 2013-03-07 14:00:12 UTC
This is an autogenerated message for OBS integration:
This bug (731601) was mentioned in
https://build.opensuse.org/request/show/157832 Maintenance /
Comment 25 Swamp Workflow Management 2013-03-13 12:04:32 UTC
openSUSE-RU-2013:0443-1: An update that has four recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 731601,751253,770182,801423
CVE References: 
Sources used:
openSUSE 12.1 (src):    systemd-37-3.17.1, systemd-gtk-37-3.17.1