Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

No swap => needed to reset computer

Message
Author
User avatar
postcd
Forum Novice
Forum  Novice
Posts: 51
Joined: Mon Oct 29, 2018 2:02 pm

No swap => needed to reset computer

#1 Post by postcd » Mon Nov 05, 2018 9:14 am

Hello,

i have downloaded MX Linux 64bit before a week around via torrent from https://mxlinux.org/download-links
After installation, apparently i ended up without any swap:

Code: Select all

$ free -mht
              total        used        free      shared  buff/cache   available
Mem:           3.9G        3.0G        384M        106M        514M        561M
Swap:            0B          0B          0B
Total:         3.9G        3.0G        384M

Code: Select all

$ swapon --show
[i]nothing[/i]
i think no swap is also cause of failed PC hibernation attempt with error: "Sleep verb not supported"
Image
(because hibernation maybe require swap to be equal or more than used RAM)

I had to reset my computer two times, because RAM was exhausted and it ended in 100% disk utilization for like 10 minutes and apps not being able to react on input.
Not sure how i missed creating SWAP during MX Linux setup, while it looks like it is very important.

What is the recommended method to create swap and activate it on MX Linux?

I found these two commands:
sudo fallocate -l 4096M /swapfile;sudo chmod 600 /swapfile;sudo mkswap /swapfile;sudo swapon /swapfile;free -mht
echo "/swapfile none swap sw 0 0" >> /etc/fstab
reboot
My RAM is 4GB and i often need more, so i thought additional disk based 4GB swap would be good (?) my motherboard do not support more than 4GB RAM so i have to be OK with slow HDD based SWAP.
Last edited by postcd on Mon Nov 05, 2018 9:34 am, edited 1 time in total.
OS: 4.15.4-1~mx17+1 (2018-02-23) x86_64 ; XFCE 4 ; MB: G31M ES2L rev. 2.0 ; GPU: AMD Radeon RX 560 ; full HW specs. as of Oct 30/2018

User avatar
stsoh
Forum Regular
Forum Regular
Posts: 415
Joined: Sun Aug 20, 2017 10:11 am

Re: No swap => needed to reset computer

#2 Post by stsoh » Mon Nov 05, 2018 9:26 am

MX-17.1_x64 Horizon, G41M-P33 Combo(MS-7592), Pentium E5400 (min/max: 1203/2700 MHz), 8Gb RAM (800 MT/s),
Intel 4 Series Integrated Graphics, Realtek PCIe Fast RTL8101/2/6E, PCI Gigabit RTL8169 Ethernets.

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 9639
Joined: Sun Dec 16, 2007 1:17 pm

Re: No swap => needed to reset computer

#3 Post by dolphin_oracle » Mon Nov 05, 2018 9:38 am

I use gparted to create the linux-swap partition. use a partition equal in size to your RAM since you plan to use hibernation.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad T530 - MX-17
lenovo s21e & 100s - antiX-17, MX17(live-usb)
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
postcd
Forum Novice
Forum  Novice
Posts: 51
Joined: Mon Oct 29, 2018 2:02 pm

Re: No swap => needed to reset computer

#4 Post by postcd » Sat Nov 10, 2018 10:01 am

Thank You both, so i enabled zram as advised by stsoh and i think it was a good step.
I also tried to use gparted to create new primary partition type linux-swap using gparted as dolphin_oracle did and then in MX Linux i did:

$ sudo fdisk -l (to see the swap partition device name. It shown:)

Code: Select all

/dev/sda4       252944384 261314559   8370176    4G 82 Linux swap / Solaris
So i did:
$ sudo mkswap /dev/sda4

Code: Select all

mkswap: /dev/sda4: warning: wiping old swap signature.
Setting up swapspace version 1, size = 4 GiB (4285526016 bytes)
no label, UUID=edf876ae-9d52-43a9-a950-194eff86d149
$ sudo swapon /dev/sda4

$ free -mht

Code: Select all

              total        used        free      shared  buff/cache   available
Mem:           3.9G        1.3G        1.6G         64M        931M        2.3G
Swap:          5.7G          0B        5.7G
Total:         9.6G        1.3G        7.4G
$ swapon

Code: Select all

NAME       TYPE        SIZE USED PRIO
/dev/zram1 partition 592.1M   0B  100
/dev/zram2 partition 592.1M   0B  100
/dev/zram3 partition 592.1M   0B  100
/dev/sda4  partition     4G   0B   -2
Now i am unsure how to add the swap partition to fstab. Should i use?: echo "/dev/sda4 none swap sw 0 0" >> /etc/fstab

Isn"t it risky to mention /dev/sda4 in fstab? What if i repartition drive later, sda4 will contain some important data and i forget to edit fstab?
I see some people use the fstab line using UUID:

Code: Select all

UUID=99e34f44-b366-4805-b290-614717f9058b     swap     swap     defaults     0 0
but in my case mkswap /dev/sda4 shown me different UUID than blkid /dev/sda4 , so unsure which one to use.

Btw unsure why i forgot to set swap during MX17 install? I think MX should more encourage swap usage, i had to reset my computer numerous times already because it went into primary drive hammering while probably out of memory (OOM) & out of zram swap. Thank you in advance for the feedback. :popcorn:

btw.: zram does not support any better compression than lz? like gzip? :p
Last edited by postcd on Sat Nov 10, 2018 10:13 am, edited 1 time in total.
OS: 4.15.4-1~mx17+1 (2018-02-23) x86_64 ; XFCE 4 ; MB: G31M ES2L rev. 2.0 ; GPU: AMD Radeon RX 560 ; full HW specs. as of Oct 30/2018

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 9639
Joined: Sun Dec 16, 2007 1:17 pm

Re: No swap => needed to reset computer

#5 Post by dolphin_oracle » Sat Nov 10, 2018 10:12 am

We have a tool that will make the swap entry

Code: Select all

make-fstab -s
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad T530 - MX-17
lenovo s21e & 100s - antiX-17, MX17(live-usb)
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
postcd
Forum Novice
Forum  Novice
Posts: 51
Joined: Mon Oct 29, 2018 2:02 pm

Re: No swap => needed to reset computer

#6 Post by postcd » Sat Nov 10, 2018 10:16 am

dolphin_oracle wrote:
Sat Nov 10, 2018 10:12 am

Code: Select all

make-fstab -s
That command returned "Put 1 hard drive entry into fstab", but not added anything additional into /etc/fstab. It contains only my system partition.

Though i proceed to make /etc/fstab looking like this:

Code: Select all

# <file system>                            <mount point>                               <type>     <options>                       <dump/pass>

#-> /dev/sda2  label=rootMX17
UUID=ce3d61fe-3364-41ad-b4a9-b81f634489e7  /                                           ext4       defaults                        1 1
UUID=edf876ae-9d52-43a9-a950-194eff86d149  swap					       swap	  defaults			  0 0
(using swap UUID provided by mkswap, not by /dev/sda4) and after reboot, it initialized swap apparently without problem.
Last edited by postcd on Sat Nov 10, 2018 11:28 am, edited 1 time in total.

User avatar
Adrian
Forum Veteran
Forum Veteran
Posts: 9025
Joined: Wed Jul 12, 2006 1:42 am

Re: No swap => needed to reset computer

#7 Post by Adrian » Sat Nov 10, 2018 10:30 am

but in my case mkswap /dev/sda4 shown me different UUID than blkid /dev/sda4 , so unsure which one to use.
You don't have to use UUID you can use /dev/sd4 in place of UUID like this:

Code: Select all

/dev/sda4 swap     swap     defaults     0 0
Or find out the UUID with "blkid" command.

User avatar
fehlix
Forum Guide
Forum Guide
Posts: 2065
Joined: Wed Apr 11, 2018 5:09 pm

Re: No swap => needed to reset computer

#8 Post by fehlix » Sat Nov 10, 2018 10:32 am

postcd wrote:
Sat Nov 10, 2018 10:16 am
That command returned "Put 1 hard drive entry into fstab", but not added anything additional into /etc/fstab. It contains only my system partition.
This command will create/add a swap-line within your /etc/fstab for an existing swap partition:

Code: Select all

echo "UUID=$(lsblk -f| grep -m1 swap | sed -E 's/\s+/=/g'| cut -d= -f4) swap swap defaults 0 0 " | sudo tee -a /etc/fstab
the output looks like:

Code: Select all

UUID=b18edc05-e4db-4fe3-8424-fb687d87858a swap swap defaults 0 0 
:puppy:
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 9639
Joined: Sun Dec 16, 2007 1:17 pm

Re: No swap => needed to reset computer

#9 Post by dolphin_oracle » Sat Nov 10, 2018 11:40 am

postcd wrote:
Sat Nov 10, 2018 10:16 am
dolphin_oracle wrote:
Sat Nov 10, 2018 10:12 am

Code: Select all

make-fstab -s
That command returned "Put 1 hard drive entry into fstab", but not added anything additional into /etc/fstab. It contains only my system partition.

Though i proceed to make /etc/fstab looking like this:

Code: Select all

# <file system>                            <mount point>                               <type>     <options>                       <dump/pass>

#-> /dev/sda2  label=rootMX17
UUID=ce3d61fe-3364-41ad-b4a9-b81f634489e7  /                                           ext4       defaults                        1 1
UUID=edf876ae-9d52-43a9-a950-194eff86d149  swap					       swap	  defaults			  0 0
(using swap UUID provided by mkswap, not by /dev/sda4) and after reboot, it initialized swap apparently without problem.
Sorry...run that command with sudo or as root.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad T530 - MX-17
lenovo s21e & 100s - antiX-17, MX17(live-usb)
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
postcd
Forum Novice
Forum  Novice
Posts: 51
Joined: Mon Oct 29, 2018 2:02 pm

Re: No swap => needed to reset computer

#10 Post by postcd » Thu Nov 15, 2018 10:05 am

Hello and thanks. Adding disk based SWAP and memory based compressed swap (zram) worked to give me more space:

$ free -mht

Code: Select all

              total        used        free      shared  buff/cache   available
Mem:           3.9G        515M        2.8G        8.6M        561M        3.1G
Swap:          7.8G          0B        7.8G
Total:          11G        515M         10G
$ swapon

Code: Select all

NAME       TYPE        SIZE USED PRIO
/dev/sda4  partition     4G   0B   -2
/dev/zram0 partition 986.9M   0B  100
/dev/zram1 partition 986.9M   0B  100
/dev/zram2 partition 986.9M   0B  100
/dev/zram3 partition 986.9M   0B  100
BUT, the problem is the system HDD utilization, and i have suspection that the SWAP may be the case.
RAM shows as fully used, ZRAM shows as almost fully used (not on above swapon output as it was made after restart), but i do not see /dev/sda4 partition usage... yet, my system HDD is very busy lagging the OS, i am watchin process manager (htop) sorting processes by HDDD R/W, and there are heavy HDD usage processes, but i have suspection it is related to SWAPping, because that processes works on external HDD, not system one which is fully utilized during lags.

Kernel vm.swappiness value i increased to 90 in aim to utilize more of the swap/to keep data more in it. Still unsure why i have not been recommended during MX Linux install to setup SWAP, i think this should be improved by the developers.

I will check liquorix kernel again soon or later as suggested by Stevo.
Last edited by postcd on Thu Nov 15, 2018 4:40 pm, edited 1 time in total.
OS: 4.15.4-1~mx17+1 (2018-02-23) x86_64 ; XFCE 4 ; MB: G31M ES2L rev. 2.0 ; GPU: AMD Radeon RX 560 ; full HW specs. as of Oct 30/2018

Post Reply

Return to “Software / Configuration”