Swap Not Activated -- systemctl

Hi all! I am running openSUSE 13.2 x86_64 and experience problem with swap not being activated. Command

#sudo swapon

does not work; returns w/no errors, but no activate after checking with

#sudo systemctl status swap.service

I get

sudo systemctl status swap.service
swap.service
   Loaded: masked (/dev/null)
   Active: inactive (dead)
    

which of course means the service is masked! But using the following:

#sudo systemctl unmask swap.service

merely returns a blank line (prompt) also with no errors. Looking at permissions for the systemctl command I find in directory /usr/bin this:

 -rwxr-xr-x  1 root root      616952 Nov 27 09:46 systemctl 

OK I guess, but I’m in over my head here. What is the appropriate action to get swap to activate always at boot (with persistence for runlevel 3 / 5? If matters here is my /etc/fstab:

 UUID=ee408734-ef81-49bb-85f7-7a9eaaca490c /   ext4       acl,user_xattr        1 1
/dev/mapper/cr_home  /home                ext4              acl,user_xattr,nofail            0 2
UUID=199bd523-2693-4065-b600-f015ee13def5 swap                 swap       pri=4              0 0      

used (active) kernel: linux-b48g 3.16.7-7-desktop #1 SMP PREEMPT
OBTW: This is clean install (not much use since install 05 JAN 2015) Yesterday…(very good job devs …4.0 gb install in 17 mins!! WOW!!)
Thanks for looking. Have A Healthy, Prosperous Day!
—rob

I get:


# systemctl status swap.service
swap.service
   Loaded: masked (/dev/null)
   Active: inactive (dead)

But swap is active anyway:


% free
             total       used       free     shared    buffers     cached
Mem:       8059776    7592736     467040     193528     296820    4293256
-/+ buffers/cache:    3002660    5057116
Swap:     20971516     145300   20826216

I suggest you check the output of “free”. Maybe your swap will turn out to be active.

Thx for quick reply, but how is this so? free command gives:

 rob@linux-b48g:~/txt> sudo free
root's password:
             total       used       free     shared    buffers     cached
Mem:       3159172    2003036    1156136      44628     150428     934896
-/+ buffers/cache:     917712    2241460
Swap:      8400892          0    8400892
 

So, if swap really is active, what accounts for the ‘masked’ message in my OP? Or am I reading / interpreting output incorrectly?
Seems I’ve got to get an updated version of “Linux In A Nutshell” (I have 4th Ed.) Hopefully, new one has systemd / systemctl chapter!
Man, is this confusing . . . whew!

It looks as if you have 8.4G of active swap, though you have enough memory that your system has not needed to use it.

I’m not a systemd expert. Swap only needs to be activated. It does not need to be continuously monitored. So there is no need for an active daemon process. Presumably systemd does its thing with swap, then that service is no longer needed (until next boot).

Add it to /etc/fstab, as before. I do not know the reason for empty swap.service, it does not exist upstream and nothing is mentioned in changelog.

On 2015-01-07 13:16, nrickert wrote:
>
> robhwill;2687717 Wrote:
>> So, if swap really is active, what accounts for the ‘masked’ message in
>> my OP? Or am I reading / interpreting output incorrectly?
>
> It looks as if you have 8.4G of active swap, though you have enough
> memory that your system has not needed to use it.
>
> I’m not a systemd expert. Swap only needs to be activated. It does not
> need to be continuously monitored. So there is no need for an active
> daemon process. Presumably systemd does its thing with swap, then that
> service is no longer needed (until next boot).

That is so.


Telcontar:~ # swapon -s
Filename                                Type            Size    Used    Priority
/dev/sdc6                               partition       10482376        1383532 1
/dev/sde11                              partition       12287996        1385052 1
/dev/sdd7                               partition       11534632        1383240 1
Telcontar:~ # systemctl status swap.service
swap.service
Loaded: masked (/dev/null)
Active: inactive (dead)

Telcontar:~ #

The output of systemd is confusing, though. I simply use swapon/off to play with swap.
Just having the appropriate entry in fstab is enough, you don’t have to enable any service.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)