Unable to activate swap [SOLVED]

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Duocatti
Level 1
Level 1
Posts: 19
Joined: Wed Jan 08, 2020 6:49 pm

Unable to activate swap [SOLVED]

Post by Duocatti »

Hello friends. How to activate swap partition?

I typed swapon in terminal it gave me this code below:

Code: Select all

NAME      TYPE      SIZE USED PRIO
/dev/dm-0 partition 7.8G   0B   -2
I also tried Gparted when I wright click on swap partition and hit swapon it gives me the error windows show in the picture below:

https://i.imgur.com/WIfHslb.jpg
Last edited by Duocatti on Sun May 17, 2020 10:39 am, edited 3 times in total.
User avatar
zcot
Level 6
Level 6
Posts: 1096
Joined: Wed Oct 19, 2016 6:08 pm

Re: Unable to activate swap

Post by zcot »

swap is already activated automatically when you boot.

The output you show from swapon does show that there is this 7.8G partition active.
oldgranola
Level 4
Level 4
Posts: 479
Joined: Fri Sep 05, 2014 1:39 am

Re: Unable to activate swap

Post by oldgranola »

Need to add a little more information. What is the scenario? Are you newly installing LM ? If so, having an active swap will be on by default unless you choose not to. What steps are you taking?
Manually creating a swap partition is as follows:
Turn off the existing swap space if needed. Create a new swap partition of the desired size.Reread the partition table. Configure the partition as swap space.Add the new partition/etc/fstab.Turn on swap.
Here is an overview:
https://opensource.com/article/18/9/swa ... ux-systems
comadore, pcDOS, hpux, solaris, vms-vax ....blah blah blah..
Yet I'm still a fn nooob
Duocatti
Level 1
Level 1
Posts: 19
Joined: Wed Jan 08, 2020 6:49 pm

Re: Unable to activate swap

Post by Duocatti »

zcot wrote:
Thu May 14, 2020 4:42 pm
swap is already activated automatically when you boot.

The output you show from swapon does show that there is this 7.8G partition active.
Thanks. just curious, is there a way to see if the swap is being used? the code above always shows USED 0B is it normal? Thanks again for the help
Last edited by Duocatti on Thu May 14, 2020 5:17 pm, edited 1 time in total.
Duocatti
Level 1
Level 1
Posts: 19
Joined: Wed Jan 08, 2020 6:49 pm

Re: Unable to activate swap

Post by Duocatti »

oldgranola wrote:
Thu May 14, 2020 4:53 pm
Need to add a little more information. What is the scenario? Are you newly installing LM ? If so, having an active swap will be on by default unless you choose not to. What steps are you taking?
Manually creating a swap partition is as follows:
Turn off the existing swap space if needed. Create a new swap partition of the desired size.Reread the partition table. Configure the partition as swap space.Add the new partition/etc/fstab.Turn on swap.
Here is an overview:
https://opensource.com/article/18/9/swa ... ux-systems
Thanks, yes it's newly installed LM I didn't change anything,. my steps on new HDD. 1: created efi partition. 2: create swap partition. 3: created root partition.
DAMIEN1307
Level 10
Level 10
Posts: 3056
Joined: Tue Feb 21, 2017 8:13 pm
Location: Alamogordo, New Mexico, USA

Re: Unable to activate swap

Post by DAMIEN1307 »

Has anyone here considered two possible questions to ask ?...New download, YES, But is it a new 19.xx series or an older series LM ???...Is the OPs LM version the 19.xx series with a "swap file" built in and did he then add a "swap partition" on top of this resulting in a conflict ??? Or is the OP operating an earlier version of LM that makes its own "swap partition" upon installation without the newer versions "swap file" ???...just asking...DAMIEN

PS in other words Did you create a swap partition during the initial install of LM19.3 which already comes with a swap "file" (doesnt show a partition since it is an actual file instead), or did you add the partition because you didnt see a swap partition in a LM 19.3 ???
ORDO AB CHAO
"I refuse to be assimilated, I refuse to become one with the Borg Collective"
Duocatti
Level 1
Level 1
Posts: 19
Joined: Wed Jan 08, 2020 6:49 pm

Re: Unable to activate swap

Post by Duocatti »

DAMIEN1307 wrote:
Thu May 14, 2020 5:21 pm
Has anyone here considered two possible questions to ask ?...New download, YES, But is it a new 19.xx series or an older series LM ???...Is the OPs LM version the 19.xx series with a "swap file" built in and did he then add a "swap partition" on top of this resulting in a conflict ??? Or is the OP operating an earlier version of LM that makes its own "swap partition" upon installation without the newer versions "swap file" ???...just asking...DAMIEN

PS in other words Did you create a swap partition during the initial install of LM19.3 which already comes with a swap "file" (doesnt show a partition since it is an actual file instead), or did you add the partition because you didnt see a swap partition in a LM 19.3 ???
Thanks for help DAMIEN. Here's what I exactly did. 1; downloaded Linux Mint 19.3 Cinnamon. 2; burn it on usb. 3; run to installation. 4; manually partitioning the new hdd. 5; created efi patition. 6; create swap partition. 7; create root partition. 8; selected efi partition for grub and proceeded to install. after installation finished I downloaded Gparted for the purpose of to format the remaining 177GB on the hdd but before I checked to see if swap is running when I wright clicked on the swap partition I saw the option 'swapon' when I clicked it the error window appeared as showed above. so I opened the terminal and typed 'swapon' and the results showed above but I had no idea whether if it's running or not.... Sorry for my terrible English :D
DAMIEN1307
Level 10
Level 10
Posts: 3056
Joined: Tue Feb 21, 2017 8:13 pm
Location: Alamogordo, New Mexico, USA

Re: Unable to activate swap [SOLVED]

Post by DAMIEN1307 »

19.3 has its own built in swap file, not a swap partition, im not totally sure but someone more knowledgeable than i should be able to tell you if they will conflict with each other if thats the case.

I would remove the "solved" from your posting for now so that someone else who may know will not ignore the post and answer if there will be a conflict because of having a swap file as well as a swap partition...DAMIEN
ORDO AB CHAO
"I refuse to be assimilated, I refuse to become one with the Borg Collective"
User avatar
zcot
Level 6
Level 6
Posts: 1096
Joined: Wed Oct 19, 2016 6:08 pm

Re: Unable to activate swap

Post by zcot »

Duocatti wrote:
Thu May 14, 2020 6:02 pm
Here's what I exactly did. 1; downloaded Linux Mint 19.3 Cinnamon. 2; burn it on usb. 3; run to installation. 4; manually partitioning the new hdd. 5; created efi patition. 6; create swap partition. 7; create root partition. 8; selected efi partition for grub and proceeded to install.
You skipped mentioned what happened with encryption. Either "full disk", or "encrypt home". Something happened there because swap is showing as /dev/dm-0.

The swap setup will show any important swap info in the /etc/fstab file.

And with encryption it will show more info in the /etc/crypttab file.

You can see the various mounting info using: lsblk -f

You should show us the info.


Also to add clarity. If you do an encrypted setup then set a non-encrypted swap then that's not a good functional encryption scheme. You CAN use multiple swap containers without a problem if you set it up that way.

"0B swap used" might be normal, that only means that you haven't used enough ram to warrant swap coming into action. if you want to test if it is working then open a bunch of tabs in the browser, fire up multiple VM's, and open some other stuff too. ;)
Duocatti
Level 1
Level 1
Posts: 19
Joined: Wed Jan 08, 2020 6:49 pm

Re: Unable to activate swap

Post by Duocatti »

zcot wrote:
Thu May 14, 2020 10:41 pm
Duocatti wrote:
Thu May 14, 2020 6:02 pm
Here's what I exactly did. 1; downloaded Linux Mint 19.3 Cinnamon. 2; burn it on usb. 3; run to installation. 4; manually partitioning the new hdd. 5; created efi patition. 6; create swap partition. 7; create root partition. 8; selected efi partition for grub and proceeded to install.
You skipped mentioned what happened with encryption. Either "full disk", or "encrypt home". Something happened there because swap is showing as /dev/dm-0.

The swap setup will show any important swap info in the /etc/fstab file.

And with encryption it will show more info in the /etc/crypttab file.

You can see the various mounting info using: lsblk -f

You should show us the info.


Also to add clarity. If you do an encrypted setup then set a non-encrypted swap then that's not a good functional encryption scheme. You CAN use multiple swap containers without a problem if you set it up that way.

"0B swap used" might be normal, that only means that you haven't used enough ram to warrant swap coming into action. if you want to test if it is working then open a bunch of tabs in the browser, fire up multiple VM's, and open some other stuff too. ;)
Thanks for details. Yes at installation I checked encryp only home.
In the /etc folder there are both fstab and crypttab files.
lsblk -f shows;

Code: Select all

NAME     FSTYPE LABEL UUID                                 MOUNTPOINT
sda                                                        
├─sda1   vfat         4374-82B6                            /boot/efi
├─sda2   swap         21a29c00-6c6d-56b4-ae96-bcb159c17dc3 
│ └─cryptswap1
│        swap         f660fa2c-7f56-47fa-8aa5-58f2r9b0c4t6 [SWAP]
├─sda3   ext4         e52cb969-2070-27b5-bdff-62c9hf4e75f9 /
└─sda4   vfat         016B-75F6                            /media/kakê/016B-75F6
should I change anything for swap? everything is still running on its defaults. I mean is the my system running ok with the default settings? Thanks again for help :)
User avatar
zcot
Level 6
Level 6
Posts: 1096
Joined: Wed Oct 19, 2016 6:08 pm

Re: Unable to activate swap

Post by zcot »

Duocatti wrote:
Fri May 15, 2020 10:23 am
I mean is the my system running ok with the default settings?
We want to see the contents of fstab and crypttab also.
cat /etc/fstab
cat /etc/crypttab
or open them with the file manager option.

Also add the result of: sudo dmsetup ls
Duocatti
Level 1
Level 1
Posts: 19
Joined: Wed Jan 08, 2020 6:49 pm

Re: Unable to activate swap

Post by Duocatti »

zcot wrote:
Fri May 15, 2020 7:47 pm
Duocatti wrote:
Fri May 15, 2020 10:23 am
I mean is the my system running ok with the default settings?
We want to see the contents of fstab and crypttab also.
cat /etc/fstab
cat /etc/crypttab
or open them with the file manager option.

Also add the result of: sudo dmsetup ls
Sorry for late reply. my account was disabled for few days by admin for some unknown reason I wasn't able to login to my account to reply. anywas. I was able to fix this issue by removing the OS completely and wiping the disk and reinstalling the OS but this time I didn't create swap partition and didn't encrypt home.
Results of 'swapon' shows;

Code: Select all

NAME      TYPE        SIZE USED PRIO
/dev/dm-0 partition 923,5M   0B   -2
which it can confirm that there's already a swapfile built in the system as @DAMIEN stated above^.
Thanks all guys for the help cheers :D
Post Reply

Return to “Newbie Questions”