LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-13-2018, 01:53 AM   #1
ersa21
LQ Newbie
 
Registered: Nov 2018
Posts: 10

Rep: Reputation: Disabled
Hibernation Problem: No swap header found


I just installed ubuntu and I didn't create a swap partition while installing it so I created a swap partition after installation using Gparted because I couldn't hibernate as error appeared:
Code:
couldn't find swap device try swapon -a
Now that I created a swap partition and using
Code:
sudo gedit /etc/fstab
output:
Code:
total        used        free      shared  buff/cache   available
Mem:           7887        1524        5145          83        1217        6030
Swap:         12461           0       12461
Code:
sudo nano /etc/fstab
Code:
UUID=1504fc2a-05b3-4af6-9ea3-c44068e7aec5 /               ext4    errors=remount-ro 0       1
/dev/sda4       none    swap    sw      0       0
/swapfile                                 none            swap    sw              0       0
My problem is: I couldn't hibernate my laptop and error is :
Code:
Swap header not found
I am not sure how to solve this problem.What should I do?
 
Old 11-13-2018, 03:15 AM   #2
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
You say you have created a "SWAP partition", but yet you specify a "SWAP file" in fstab, that's your problem. fstab mounts are usually done via UUID rather than the device node. The problem is that if the same drive gets a different node, then fstab would be incorrect.

Below is a snippet of my fstab for my SWAP partition;

Code:
UUID=f8d1913b-c293-48e7-a2b0-7f6407c9dd07 swap                    swap    defaults        0 0
You should have a read of this too. The same is true for other distributions too.
 
1 members found this post helpful.
Old 11-13-2018, 03:25 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
If you look closely, you'll see the OP has both in fstab. Quite valid, and at least some of it has been recognised.
@ersa21, can you run these for us.
Code:
swapon -s
cat /proc/cmdline
 
Old 11-13-2018, 04:13 AM   #4
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by ersa21 View Post
I just installed ubuntu and I didn't create a swap partition while installing it so I created a swap partition after installation

Now that I created a swap partition and using
Did you ran "mkswap" ON that partition?
That command is what creates the swap header in the designated partition (or swap file).
 
Old 11-13-2018, 04:54 AM   #5
ersa21
LQ Newbie
 
Registered: Nov 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
If you look closely, you'll see the OP has both in fstab. Quite valid, and at least some of it has been recognised.
@ersa21, can you run these for us.
Code:
swapon -s
cat /proc/cmdline
output:
Code:
BOOT_IMAGE=/boot/vmlinuz-4.15.0-38-generic root=UUID=1504fc2a-05b3-4af6-9ea3-c44068e7aec5 ro quiet splash
 
Old 11-13-2018, 04:56 AM   #6
ersa21
LQ Newbie
 
Registered: Nov 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ehartman View Post
Did you ran "mkswap" ON that partition?
That command is what creates the swap header in the designated partition (or swap file).
Yes I did that for swap partition. But can we check if swap header has been created or not?
 
Old 11-13-2018, 05:04 AM   #7
ersa21
LQ Newbie
 
Registered: Nov 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
You say you have created a "SWAP partition", but yet you specify a "SWAP file" in fstab, that's your problem. fstab mounts are usually done via UUID rather than the device node. The problem is that if the same drive gets a different node, then fstab would be incorrect.

Below is a snippet of my fstab for my SWAP partition;

Code:
UUID=f8d1913b-c293-48e7-a2b0-7f6407c9dd07 swap                    swap    defaults        0 0
You should have a read of this too. The same is true for other distributions too.
My swap partition is /dev/sda4. How should I correct it then? Should I just remove
Code:
/dev/sda4       none    swap    sw      0       0
or
put my UUID code of swap partition in
Code:
UUID=1504fc2a-05b3-4af6-9ea3-c44068e7aec5 /               ext4    errors=remount-ro 0       1
 
Old 11-13-2018, 05:21 AM   #8
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by ersa21 View Post
My swap partition is /dev/sda4. How should I correct it then? Should I just remove
Code:
/dev/sda4       none    swap    sw      0       0
or
put my UUID code of swap partition in
Code:
UUID=1504fc2a-05b3-4af6-9ea3-c44068e7aec5 /               ext4    errors=remount-ro 0       1
Simply just copy my example in post #2 and replace the UUID for my SWAP partition to yours. I would only have one entry in fstab for your SWAP partition though.

Code:
UUID=<your SWAP partition's UUID here>  swap                    swap    defaults        0 0
You can find out the UUID for your SWAP partition with the "lsblk -f" command.
 
Old 11-13-2018, 05:36 AM   #9
ersa21
LQ Newbie
 
Registered: Nov 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
Simply just copy my example in post #2 and replace the UUID for my SWAP partition to yours. I would only have one entry in fstab for your SWAP partition though.

Code:
UUID=<your SWAP partition's UUID here>  swap                    swap    defaults        0 0
You can find out the UUID for your SWAP partition with the "lsblk -f" command.
so i removed /swapfile from fstab and included UUID for my swap partition as you mentioned.

Code:
swapon -s
output:
Code:
Filename				Type		Size	Used	Priority
/dev/sda4                              	partition	10663932	0	-2
I hope this now it works.

Last edited by ersa21; 11-13-2018 at 06:11 AM.
 
Old 11-13-2018, 06:21 AM   #10
ersa21
LQ Newbie
 
Registered: Nov 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
I am able to hibernate now. But the difference I noticed this time is that it takes quite a long time to wake up from hibernation( almost like doing power on) while before it used to take less time. Also now I find system crash error which I tried fixing by
sudo rm /var/crash/*

Could you tell me what might have caused this?

Thanks a lot.
 
Old 11-13-2018, 07:58 AM   #11
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by ersa21 View Post
I am able to hibernate now. But the difference I noticed this time is that it takes quite a long time to wake up from hibernation( almost like doing power on) while before it used to take less time. Also now I find system crash error which I tried fixing by
sudo rm /var/crash/*

Could you tell me what might have caused this?
If you mean your original problem:

Quote:
Originally Posted by ersa21 View Post
I just installed ubuntu and I didn't create a swap partition while installing it so I created a swap partition after installation using Gparted because I couldn't hibernate as error appeared:
[error messages snipped]
...
If you mean this "system crash error" you mention above, hard to say without some more details to go on. I very much doubt removing the contents of the /var/crash/ folder is going to "fix" anything.

Have a look in your /var/log/messages file for any error messages, but you maybe should start a new thread if this is different problem.

Quote:
Thanks a lot.
If you really want to thank me, perhaps mark what post(s) of mine you have found helpful.
 
Old 11-13-2018, 04:22 PM   #12
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,986

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
You set up your swap partition but you never told the grub bootloader where to find it. I believe you have to do both. See the discussion here which references arch linux:

https://superuser.com/questions/3831...om-hibernation

Also, as alluded to in the above link, some distros will hardcode the hibernation location into the initrd. I know debian does; not sure about the *buntus. If that's the case for your distro, you will have to make a new initrd with this info included. Here's a discussion on how to do that in debian:

http://forums.debian.net/viewtopic.php?t=133253

The specifics vary from distro to distro so you should consult your distro's documentation. The point is that you probably have to do more than just create a swap partition after the initial installation in order for hibernation to work properly. All this stuff will be set up automatically during installation in most distros if an adequately sized swap partition is created at that time. If you create the swap partition afterwards, you will have to do some more work to get hibernation working properly in all likelihood.

Last edited by kilgoretrout; 11-13-2018 at 05:31 PM.
 
Old 11-14-2018, 05:38 AM   #13
ersa21
LQ Newbie
 
Registered: Nov 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kilgoretrout View Post
You set up your swap partition but you never told the grub bootloader where to find it. I believe you have to do both. See the discussion here which references arch linux:

https://superuser.com/questions/3831...om-hibernation

Also, as alluded to in the above link, some distros will hardcode the hibernation location into the initrd. I know debian does; not sure about the *buntus. If that's the case for your distro, you will have to make a new initrd with this info included. Here's a discussion on how to do that in debian:

http://forums.debian.net/viewtopic.php?t=133253

The specifics vary from distro to distro so you should consult your distro's documentation. The point is that you probably have to do more than just create a swap partition after the initial installation in order for hibernation to work properly. All this stuff will be set up automatically during installation in most distros if an adequately sized swap partition is created at that time. If you create the swap partition afterwards, you will have to do some more work to get hibernation working properly in all likelihood.
I replaced my swap file with swap partition in fstab after which I am able to hibernate but that led to another problem i.e. applications are closed when resuming from hibernation.
Here is my new post for that problem,
https://www.linuxquestions.org/quest...ed-4175642263/

Also another error i.e. System Problem detected in Ubuntu.

Could replacing swap file with partition be leading to these problems?
 
Old 11-14-2018, 06:00 AM   #14
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by ersa21 View Post
...
Also another error i.e. System Problem detected in Ubuntu.
You should talk about this in your other thread, and maybe rename your other thread as well. If you're sure it's a separate problem.

Quote:
Could replacing swap file with partition be leading to these problems?
I really doubt it.

But I think we need to be sure you can actually hibernate it to begin with. When you hibernate it and bring it back out of hibernation, does your machine after firmware starts looking for the operating system go straight to the graphical environment, which then asks you for a password of the user account you were logged in under when you hibernated it, or does it just start up normally and go to the login screen as usual?

Last edited by jsbjsb001; 11-14-2018 at 06:12 AM. Reason: re-worded and mis-posted
 
Old 11-14-2018, 07:35 AM   #15
ersa21
LQ Newbie
 
Registered: Nov 2018
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jsbjsb001 View Post
You should talk about this in your other thread, and maybe rename your other thread as well. If you're sure it's a separate problem.



I really doubt it.

But I think we need to be sure you can actually hibernate it to begin with. When you hibernate it and bring it back out of hibernation, does your machine after firmware starts looking for the operating system go straight to the graphical environment, which then asks you for a password of the user account you were logged in under when you hibernated it, or does it just start up normally and go to the login screen as usual?
When I resume from hibernation,it starts from beginning as if being powered off.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] No package 'x11' found No package 'xext' found No package 'xdamage' found No package 'xfixes' found No package 'x11-xcb' found Jigsaw Linux From Scratch 14 02-23-2021 08:35 PM
swap partition size for hibernation dimm0k Slackware 9 09-28-2010 05:01 AM
Proper swap size for hibernation dimm0k Linux - Laptop and Netbook 5 09-23-2010 11:14 AM
hibernation with two swap partitions in squeeze map250r Debian 4 07-29-2010 10:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration