I Have Suspend Issues Without Swap Partition

Hello All,
My computer is a standard desktop PC with an Intel Haswell processor. I recently installed Leap 15 onto an SSD without a swap partition. Leap 15 is the only OS on this SSD. I want my computer to be able to suspend (go to sleep) when I am not using it. How can I enable a suspend/sleep function without a swap partition?

I read this thread https://forums.opensuse.org/showthread.php/522031-is-there-any-worry-to-have-no-swap-partition but I am still unclear how this is enabled.

Thanks in advance.

Rocky

Which desktop environment are you using?

Can you suspend (to RAM) successfully using the following systemd command?

systemctl suspend

Thank you for the response. I am running the KDE Plasma 5.12.5 desktop and yes that command worked perfectly. Now is there any way to set up the auto-suspend feature without the swap partition? I don’t really want a swap partition because I have 16 gb of RAM and an SSD and I think that the swap partition is killing my SSD

Thanks for your help

Rocky

That is good to know. The KDE desktop should be equally capable here. You can configure the suspend action via the power widget (Battery and Brightness), right-click and select ‘Configure Power Saving…’.

Now is there any way to set up the auto-suspend feature without the swap partition?

Suspend to RAM doesn’t use swap, so not relevant here.

Just to clarify further… for a desktop PC navigating to System Settings > Power Management will get you to the configuration utility to allow you suspend after a set period of inactivity.

Good Morning,
Thank you for your attention to my problem. I know how to use System Settings> Power Management because that is how I configured my openSUSE when I had the swap partition. My problem now is that without the swap partition this does not work. Even when I manually hit the suspend button my PC does not suspend. You mentioned a swap file upthread. How do I enable the swap file? I would like to get my computer to be able to go to sleep again.

Just for the record I just did a clean install of openSUSE and during the installation I chose not to create a swap partition, it is not like this instance of openSUSE previously had a swap partition which I deleted.

All help is certainly appreciated because I am a novice and clearly out of my depths on this.

Rocky

Don’t think you can use a swap file to hibernate since the partition it is on would not be mounted when the file was needed to restore. You need to have a swap partition. Sorry :’(

That makes sense. Up thread it was mentioned something about suspend to RAM. How can I enable that type of function?

If this is a lost cause I do have a spinning hard drive in my computer and I can do a clean install and set my swap partition over to the old hard drive.

Rocky

Swap partition can be on any available drive. You can add it at any time if there is space available.

Sleep in not the same as hibernate power usage is greatly reduced but there is still some. So the machine is not completely shutdown.

How?? depends on Desktop. You generally want to set suspend not hibernate in the power settings

Thank you very much. My openSUSE installation is on an SSD that is partitioned for home, root and boot. I like the speed of the SSD but I just do not want all of the read/writes on to my SSD that a swap partition does. Inside of my PC is also a data drive which is the old fashioned spinning hard drive. Right now it is unpartitioned and it has several hundred gigabytes of free space. I could easily create a 16 gb partition on that drive but I would need assistance to map that new partition as a swap space.

I have to do some family stuff today so I will attempt to set up this type of openSUSE layout as soon as I can.

Thanks for your advice.

Rocky

Hi
With 16GB of RAM I would expect zero swap in use? You can configure swappiness so it will only use swap as a last resort in /etc/sysctl.conf …


# Disable swap
vm.swappiness = 1
vm.vfs_cache_pressure = 50

If it’s a modern SSD, then I would expect it will outlive the hardware running it…

I have 8 and 4GB machines here and use zero swap space, I rarely suspend or hibernate though and set swap to 4GB these days…

If you want to create a swap partition, post the output from the lsblk command to see your current partitions.

You can set the swap via the Yast partition management function. Just add it and reboot.

Thanks for all of the help guys. I do not want swap unless it is absolutely necassary. I was unable to follow the directions above by malcom lewis because I did not quite understand which directory to edit. I am still working on this.

Thanks again.

Rocky

Hi
You need to edit (as root user) the file in the /etc/directory called sysctl.conf and add those two lines to wind swappiness down so it will use ram rather than looking for a swap partition/file.

I think that I was finally successful in figuring this whole swap thing out. Right now I beleive that I correctly added the proper lines to my file in the /etc/directory.

Password: 
linux-748b:~ # lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111.8G  0 disk 
├─sda1   8:1    0     8M  0 part 
├─sda2   8:2    0    40G  0 part /
├─sda3   8:3    0  56.2G  0 part /home
└─sda4   8:4    0  15.6G  0 part 
sdb      8:16   0 256.2G  0 disk 
├─sdb1   8:17   0   499M  0 part 
├─sdb2   8:18   0   100M  0 part 
├─sdb3   8:19   0    16M  0 part 
└─sdb4   8:20   0 255.6G  0 part 
sdc      8:32   0 931.5G  0 disk 
└─sdc1   8:33   0 931.5G  0 part 
sdd      8:48   0 232.9G  0 disk 
└─sdd1   8:49   0 232.9G  0 part 
sde      8:64   0   3.7T  0 disk 
└─sde1   8:65   0   3.7T  0 part 
sr0     11:0    1  1024M  0 rom  
sr1     11:1    1  1024M  0 rom  
linux-748b:~ # 






Of course I am still configuring my openSUSE system, so I might be asking more questions.

Thanks again for all of the help.

Rocky

On a completely different instance of openSUSE Leap 15 I (think) I changed the swappiness through YaST.

I opened YaST, went to system, went to /etc/sysconfig Editor and entered swap in the search field. The I added the text from a post upthread

# Disable swap
vm.swappiness = 1
vm.vfs_cache_pressure = 50

I saved it and I think that it should have modified the swappiness.

Do you guys think that this worked. It sure appeared to work.

Any input is appreciated.

Rocky

Hi
Where in sysconfig editor? That’s not the same as /etc/sysctl.conf file…

Can you show the terminal output from;


cat /etc/sysctl.conf

I hope this works;

Password: 
linux-t7iq:~ # cat /etc/sysctl.conf
####
#
# /etc/sysctl.conf is meant for local sysctl settings
#
# sysctl reads settings from the following locations:
#   /boot/sysctl.conf-<kernelversion>
#   /lib/sysctl.d/*.conf
#   /usr/lib/sysctl.d/*.conf
#   /usr/local/lib/sysctl.d/*.conf
#   /etc/sysctl.d/*.conf
#   /run/sysctl.d/*.conf
#   /etc/sysctl.conf
#
# To disable or override a distribution provided file just place a
# file with the same name in /etc/sysctl.d/
#
# See sysctl.conf(5), sysctl.d(5) and sysctl(8) for more information
#
####
linux-t7iq:~ # 







Thanks for looking at this.

Rocky

Hi
Suggest you go back into YaST /etc/sysconfig editor and remove whatever you put in… :wink:

You need to manually edit the file and add those two lines…

Thank you very much malcolmlewis, I really appreciate your attention to my little issue. Like I have said before, I am a Linux novice but my distro of choice is openSUSE.

I went back to YaST to try to undo what I did, but I did not find anyway to accomplish that. The system that I am using now is different than the system that provoked me to start this thread, so here is what the output of that command that you requested earlier looks like.

Password: 
linux-t7iq:~ # lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
├─sda1   8:1    0     1K  0 part 
├─sda2   8:2    0  79.8G  0 part 
├─sda3   8:3    0  83.6G  0 part 
└─sda5   8:5    0  69.5G  0 part /
sdb      8:16   0 232.9G  0 disk 
├─sdb1   8:17   0   499M  0 part 
├─sdb2   8:18   0   100M  0 part 
├─sdb3   8:19   0    16M  0 part 
└─sdb4   8:20   0 232.3G  0 part 
sdc      8:32   0 931.5G  0 disk 
└─sdc1   8:33   0 931.5G  0 part /run/media/rocky/Workspace
sdd      8:48   0 465.8G  0 disk 
├─sdd1   8:49   0 350.1G  0 part 
└─sdd2   8:50   0 115.6G  0 part 
sde      8:64   0   3.7T  0 disk 
└─sde1   8:65   0   3.7T  0 part 
sr0     11:0    1  1024M  0 rom  
sr1     11:1    1  1024M  0 rom  
linux-t7iq:~ # 






Because this is a different system I was trying to just reduce the amount of swap, not disable it altogether. I hope that I did not mess up my system with my little blunder with YaST. What should my next step be?

Thanks,
Rocky