You are not logged in.

#1 2016-08-13 23:38:22

clinton
Member
Registered: 2016-08-13
Posts: 7

Failed to activate swap Swap Partition

During booting, I find an error message. I am able to trace this error with systemctl status dev-sda5.swap. This is the output:

● dev-sda5.swap - Swap Partition
   Loaded: loaded (/run/systemd/generator.late/dev-sda5.swap; generated; vendor 
   Active: failed (Result: exit-code) since Sat 2016-08-13 21:52:45 IST; 6h ago
     What: /dev/sda5
     Docs: man:systemd-gpt-auto-generator(8)
  Process: 271 ExecActivate=/sbin/swapon /dev/sda5 (code=exited, status=255)

Aug 13 21:52:45 clinton-pc systemd[1]: Activating swap Swap Partition...
Aug 13 21:52:45 clinton-pc swapon[271]: swapon: /dev/sda5: read swap header fail
Aug 13 21:52:45 clinton-pc systemd[1]: dev-sda5.swap: Swap process exited, code=
Aug 13 21:52:45 clinton-pc systemd[1]: Failed to activate swap Swap Partition.
Aug 13 21:52:45 clinton-pc systemd[1]: dev-sda5.swap: Unit entered failed state.
~

This is the output of parted /dev/sda print

[clinton@clinton-pc ~]$ sudo parted /dev/sda print
Model: ATA TOSHIBA MQ01ABD1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name    Flags
 1      2097kB  539MB   537MB   fat32           boot    boot, esp
 2      539MB   22.0GB  21.5GB  ext4            rootfs
 3      22.0GB  34.9GB  12.9GB  ext4            var
 4      34.9GB  39.2GB  4295MB  linux-swap(v1)  swap
 5      39.2GB  1000GB  961GB   ext4            home

However, an fdisk -l shows that my home partition is actually a swap partition. Which is weird because  I didn't do that:

[clinton@clinton-pc ~]$ sudo fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: DFB7DE69-0934-4EA0-9541-7FEBD3CD739B

Device        Start        End    Sectors  Size Type
/dev/sda1      4096    1052671    1048576  512M EFI System
/dev/sda2   1052672   42991615   41938944   20G Linux filesystem
/dev/sda3  42991616   68157439   25165824   12G Linux filesystem
/dev/sda4  68157440   76546047    8388608    4G Linux swap
/dev/sda5  76546048 1953523711 1876977664  895G Linux swap

The kernel tries to perfrom some swapping on my home directory. How do I fix this, without having to format my whole system again smile. Thank you

Clinton
For the Love of God and the good of all men

Offline

#2 2016-08-14 07:52:14

dazemc
Member
From: Seattle, Washington, USA
Registered: 2013-03-02
Posts: 64

Re: Failed to activate swap Swap Partition

Using fdisk try to change the partion type of your home partition to Linux filesystem
...what is the output of

$ cat /etc/fstab

Offline

#3 2016-08-14 11:06:59

clinton
Member
Registered: 2016-08-13
Posts: 7

Re: Failed to activate swap Swap Partition

Output of cat /etc/fstab

[clinton@clinton-pc ~]$ cat /etc/fstab 
# /dev/sda2
UUID=6e8e9616-92e4-4c46-8938-c8781049cdda	/         	ext4      	rw,relatime,data=ordered	0 1

# /dev/sda1
UUID=95A2-FED3      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro	0 2

# /dev/sda3
UUID=e7c69c75-166e-4212-a3d6-0602ba79c569	/var      	ext4      	rw,relatime,data=ordered	0 2

# /dev/sda5
UUID=3673a968-9361-402b-9e31-0b75bf41c90b	/home     	ext4      	rw,relatime,data=ordered	0 2

# /dev/sda4
UUID=6b801c07-b62e-4ae9-8870-8ff8e23eff22	none      	swap      	defaults  	0 0

Offline

#4 2016-08-14 11:44:01

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Failed to activate swap Swap Partition

What's the output of blkid.

Not an installation issue, moving to NC.

Offline

#5 2016-08-14 12:58:46

clinton
Member
Registered: 2016-08-13
Posts: 7

Re: Failed to activate swap Swap Partition

[clinton@clinton-pc ~]$ blkid 
/dev/sda1: UUID="95A2-FED3" TYPE="vfat" PARTLABEL="boot" PARTUUID="33734569-4ae9-4d04-b6dc-9b3ef1868436"
/dev/sda2: UUID="6e8e9616-92e4-4c46-8938-c8781049cdda" TYPE="ext4" PARTLABEL="rootfs" PARTUUID="16b46b43-f70e-42c6-b95d-cafb5ade7d72"
/dev/sda3: UUID="e7c69c75-166e-4212-a3d6-0602ba79c569" TYPE="ext4" PARTLABEL="var" PARTUUID="c12d31a3-c351-4b8b-95d4-b049f1107a14"
/dev/sda4: UUID="6b801c07-b62e-4ae9-8870-8ff8e23eff22" TYPE="swap" PARTLABEL="swap" PARTUUID="28636b0c-7ff5-4214-863b-dd91a6e9db44"
/dev/sda5: UUID="3673a968-9361-402b-9e31-0b75bf41c90b" TYPE="ext4" PARTLABEL="home" PARTUUID="3bc2e360-8dd9-4cdb-84f1-431ea3efdd40"

Offline

#6 2016-08-14 13:35:23

glavin
Member
Registered: 2015-07-08
Posts: 22

Re: Failed to activate swap Swap Partition

I think you missed a step, Did you do a mkswap on /dev/sda4


Speak your mind even if your voice shakes.

Offline

#7 2016-08-14 13:42:17

clinton
Member
Registered: 2016-08-13
Posts: 7

Re: Failed to activate swap Swap Partition

glavin wrote:

I think you missed a step, Did you do a mkswap on /dev/sda4

I remember I did. And if you check closely, you will notice that, the error is not coming from my swap partition. It is coming from my home drive.

Offline

#8 2016-08-14 13:43:31

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,694

Re: Failed to activate swap Swap Partition

"Type Linux swap" in the fdisk output is the problem, as dazemc already said. Set it to the correct partition type.

Offline

#9 2016-08-14 14:37:31

clinton
Member
Registered: 2016-08-13
Posts: 7

Re: Failed to activate swap Swap Partition

I did a search and realized fdisk will format the partition. This shiuld be my last resort as I have valuable data on it.

Offline

#10 2016-08-14 14:38:41

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,694

Re: Failed to activate swap Swap Partition

fdisk will not format anything.

Offline

#11 2016-08-14 15:00:19

glavin
Member
Registered: 2015-07-08
Posts: 22

Re: Failed to activate swap Swap Partition

clinton wrote:

I remember I did. And if you check closely, you will notice that, the error is not coming from my swap partition. It is coming from my home drive.

I guess I overlooked it, as correctly mentioned by others fdisk is the right way to change partition type. If you fear messing things up, then simple solution would be to just mask the dev-sda5.swap unit so that systemd will not try to mount that partition as swap.  i.e systemctl mask dev-sda5.swap
/home partition should work as it should be despite fdisk -l showing it as swap which anyway is just a tag.

Last edited by glavin (2016-08-14 15:13:18)


Speak your mind even if your voice shakes.

Offline

#12 2016-08-14 20:14:04

clinton
Member
Registered: 2016-08-13
Posts: 7

Re: Failed to activate swap Swap Partition

It worked!! It even  fixed another problem which was happening at shutdown. Couldn't Unmount /var. Very happy!!!

Offline

Board footer

Powered by FluxBB