Activate swap

Hey @vasileios, I bet you know the answer to this one.
the swap on my machine fails to activate, my fstab for teh swap partition looks like this;

/# swap was on /dev/sda3 during installation
UUID=82bc85b3-7c4a-4bfe-9df7-efe88565b020 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0

I actually tried to edit it so it now looks like this;

/# swap was on /dev/sda3 during installation
UUID=82bc85b3-7c4a-4bfe-9df7-efe88565b020 none swap sw 0 0
/dev/sda3 none swap sw 0 0

but when I enter sudo swapon -a, it it failed with an invalid argument.
What am I not doing correctly?

I think I may have figured it out, is there an easy way to check the status?

1 Like

what distro is this on?
did you make any partition changes, adjustments etc that would change the UUID of swap?
to list the UUID try:
ls -l /dev/disk/by-uuid
or
blkid /dev/sda*

does swapon -s list the dev?

I prefer using sudo swapon /dev/sda3

hope this helps.

1 Like

I am running Debian 11, I had some issues with my boot sector in the past and likely impacted my swap partition as it has failed to activate til today.
Just did a swapon -s and it now reports the size and amount used.

Thank you

2 Likes

You’ll need to run grub-update to make sure your fstab gets updated as well.

my fixes were all done by manual editing of fstab, is there something else grub-update does as well? does grub-update need any arguments or parameters when run?

Hey @MacksM3!
The command @MrDeplorableUSA mentioned is spot on!

If there is ever an issue with your fstab, you can always reboot into Init Level 3 (terminal only), but bringing the Grub menu on and hitting the “E” key on the first selection. Once there, go to the end of the Linux line (one that says “quiet splash” in it) and add the number “3” at the end & press F10 to boot.

The reason for that is to only get the physical devices mounted and not all the loop-backs that come along with a full boot.

Once you log in, install some useful Arch Linux scripts, by executing:

sudo apt install arch-install-scripts

This will give you the invaluable command genfstab - which generates a new fstab file.

Then you can backup the original fstab file:

sudo cp /etc/fstab /etc/fstab.backup

Then make sure that your swap partition is mounted. If - for example - you have your swap on /dev/sda2, then you can mount it via:

sudo swapon /dev/sda2

If it’s another named partition, you can find out the structure by typing:

lsblk

And then use the Arch utility (which works on Debian too):

sudo genfstab -U / > /etc/fstab

This will give you a fresh new fstab file. :slight_smile:

I am just getting around to this now and think I am missing something
image
copy to backup worked, the rest, not so much

How about you go in as super user?

sudo su -
genfstab -U / > /etc/fstab

The reason that your Swap appears busy is because it’s active.

1 Like

OK, switching to root works, I now have a fresh new fstab.
Thanks guys!

2 Likes

@vasileios, it appears I have an issue with this fstab as when I restarted my machine, it fails to start. I posted a pic of the failure in the TG channel

I did another genfstab and am up and running again.
Learning lots here.

1 Like

Were you able to make a subsequent reboot and your changes stay this time? I could not find your pic in TG. Prior to switching to root and running the genfstab command did you make sure your swap was mounted and activated?

Hey @MacksM3!
I find it interesting that there’s an app that tries to alter your fstab file. Gotta be thankful for those handy Arch scripts though. They have saved me several times too.

1 Like

yes, did a couple reboots. swap is still mounted and active.
I did check to insure it was mounted and active before the first genfstab also.
So glad you guys are here to keep me up and running, thank you.

2 Likes

Hi.
Here’s something which may interest you. :wink:

2 Likes

Nice tip! I think I’ll give that a shot on my lil 1GB Eee PC 1001P lol or upgrade the ram to a whopping supported 2GB for about $8 HAHA

1 Like

Actually…That’s exactly the same pc I tried it on, a 900 though (running Ubuntu on it). I did it for research really…to see what the eepc was capable of. It’s a cracking little bullet proof machine. I got it given of a guy for rescuing some important data of a corrupt hard drive on his desktop.
I ended up installing Bionic Pup on it ( a super lite distro) It nows sits on my 40 year old Nad 3020 Amp using 40 year old Goodmans 2 speakers.
Now the eepc is a nice small simple music player. As you know the actual hard drives in them are ram based.
It boots lightning fast. There’s a simple rule now for friends and family during socialising events…Bring your own music on a stick :money_mouth_face:

1 Like

Mine had an actual 2.5" ide 5400rpm. I put a 256GB. SSD in it. Still runs great, gui are slow but functional.

I think it’s about to become a lightweight well with Arch