You are not logged in.

#1 2021-05-29 15:41:47

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

[SOLVED] - cannot load swap partition on boot

Hello!

After a fresh install of Arch I noticed that the system was loading for a long time (minute or two).

journalctl showed the following error:

Timed out waiting for device /dev/disk/by-uuid/1878cf5f-6b9c-7340-9150-b677f351668b.

I looked at fstab:

cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=a2e1c385-54d0-4faa-8cc1-b97ed3c18685   /           ext4        w,relatime  0 1

# /dev/sda3
UUID="1878cf5f-6b9c-7340-9150-b677f351668b"     none        swap        defaults     0 0

and blkid

sudo blkid
/dev/sda1: UUID="CEAE-76C6" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="8a49343d-b0a5-cd4a-80d8-5efc55052411"
/dev/sda2: UUID="a2e1c385-54d0-4faa-8cc1-b97ed3c18685" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="6a6371e8-ed43-d540-afe9-3b9460c3d536"
/dev/sda3: PTUUID="03261a9b-b451-504a-946b-98a4d1e08b29" PTTYPE="gpt" PARTUUID="1878cf5f-6b9c-7340-9150-b677f351668b"

I thought that probably I got some error with swap:

free -h
               total        used        free      shared  buff/cache   available
               Mem:           3.4Gi       426Mi       2.6Gi       2.0Mi       332Mi       2.7Gi
               Swap:             0B          0B          0B

It seemed like my swap partition was not active (it is formatted as GPT).
So I did mkswap and swapon on sda3, and the partition appeared after that:

swapon --show
NAME      TYPE      SIZE USED PRIO
/dev/sda3 partition 7.4G   0B   -2

And blkid showed sda3 as having an UUID:

sudo blkid
/dev/sda1: UUID="CEAE-76C6" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="8a49343d-b0a5-cd4a-80d8-5efc55052411"
/dev/sda2: UUID="a2e1c385-54d0-4faa-8cc1-b97ed3c18685" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="6a6371e8-ed43-d540-afe9-3b9460c3d536"
/dev/sda3: UUID="b8cb58f2-3cbe-4013-a573-a8803c26d502" TYPE="swap" PTUUID="03261a9b-b451-504a-946b-98a4d1e08b29" PTTYPE="gpt" PARTUUID="1878cf5f-6b9c-7340-9150-b677f351668b"

I've put in fstab, but the problem persisted.

fstab manpages said that PARTUUID could be used. I replaced UUID of my swap in fstab with PARTUUID that I took from blkid output. After the next rebbot I got a new message, this time accompanied with a corresponding systemctl --failed error message:

Failed to activate swap /dev/disk/by-partuuid/1878cf5f-6b9c-7340-9150-b677f351668b.
* dev-disk-by\x2dpartuuid-1878cf5f\x2d6b9c\x2d7340\x2d9150\x2db677f351668b.swap loaded failed failed /dev/disk/by-partuuid/1878cf5f-6b9c-7340-9150-b677f35166>

As an additional bonus, the brightness of the screen went down on boot (can be changed, though). It works normally if UUID is back at fstab.

The last thing that I tried was to comment swap line out in fstab, and it got rid of relevant error messages (brightness thing persisted, though).


I can live that way or even activate swap manually each time I reboot, but that would be kinda nice if I could have my swap partition activated on load. Unfortunately, my knowledge ends at this very point. Could you give me a little help with understanding what I need to do next to fix it?


Thank you in advance!

PS. How could swap partition mess my brightness up??


SOLUTION

The answer that finally made me understand the problem is contained in the V1del's post.

Solution to the problem - dont't partition the partition, as Scimmia stated. Flush /dev/sda[?] with wipefs, then mkswap, swapon, genfstab, don't create a partition in partition with fdisk (in /dev/sda[?]).

Last edited by soangrypanda (2021-05-30 15:01:27)

Offline

#2 2021-05-29 15:51:03

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] - cannot load swap partition on boot

There's a typo in your fstab on the line for swap. You wrote "efaults" instead of "defaults" (the "d" is missing). Maybe that's the problem? Is there an error message about this in the system journal somewhere?

Offline

#3 2021-05-29 15:57:46

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

Re: [SOLVED] - cannot load swap partition on boot

Ropid wrote:

There's a typo in your fstab on the line for swap. You wrote "efaults" instead of "defaults" (the "d" is missing). Maybe that's the problem? Is there an error message about this in the system journal somewhere?

Hey, Ropid! Thank you for noticing the typo, but it seems like I made it during the post editing (gonna fix it now). No journal messages other than mentioned in the post appeared.

Last edited by soangrypanda (2021-05-29 16:00:23)

Offline

#4 2021-05-29 16:20:25

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,640
Website

Re: [SOLVED] - cannot load swap partition on boot

Try removing the quotation marks around the UUID in the fstab entry.


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#5 2021-05-29 16:41:58

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] - cannot load swap partition on boot

PARTUUID and UUID are different things, they're not interchangable.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#6 2021-05-29 16:51:13

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] - cannot load swap partition on boot

I think you are not doing anything wrong. Your fstab entry should work.

I'll try listing details from here to compare with yours:

Here is what I see for my swap partition in the "blkid" output (I added line-breaks for easier reading):

/dev/nvme0n1p4:
LABEL="arswap"
UUID="d3d0877e-c2b9-4625-88f9-af65d5eaf83a"
TYPE="swap"
PARTLABEL="arswap"
PARTUUID="6911df91-49a5-4607-9bd2-9bf875736d4b"

My fstab entry looks like this, I've set PARTLABEL myself in GParted with the "Name Partition" menu entry and use that for mounting:

PARTLABEL=arswap  none  swap  discard  0  0

Your blkid entry looks like this:

/dev/sda3:
UUID="b8cb58f2-3cbe-4013-a573-a8803c26d502"
TYPE="swap"
PTUUID="03261a9b-b451-504a-946b-98a4d1e08b29"
PTTYPE="gpt"
PARTUUID="1878cf5f-6b9c-7340-9150-b677f351668b"

Maybe those "PTTYPE=gpt" and "PTUUID=..." entries you have are somehow involved with the problem? What are those entries? I can't find explanations I understand online.

Last edited by Ropid (2021-05-29 16:51:46)

Offline

#7 2021-05-29 17:28:56

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,319

Re: [SOLVED] - cannot load swap partition on boot

What's the output of

lsblk -f
sudo file -s /dev/sda3

Online

#8 2021-05-29 19:45:54

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

Re: [SOLVED] - cannot load swap partition on boot

schard wrote:

Try removing the quotation marks around the UUID in the fstab entry.

Hey! Tried, gotten the original error.

Offline

#9 2021-05-29 19:49:11

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

Re: [SOLVED] - cannot load swap partition on boot

Slithery wrote:

PARTUUID and UUID are different things, they're not interchangable.

Hey! the manpages are saying:

 It's also possible to use PARTUUID= and PARTLABEL=. These partitions identifiers are supported for example for GUID Partition Table (GPT).

Should they be used alongside with UUID?

Offline

#10 2021-05-29 19:53:59

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,319

Re: [SOLVED] - cannot load swap partition on boot

Yes, but you can't issue them as UUID and it looks like you did that.
There might be other issues beyond that, though.

Online

#11 2021-05-29 20:49:10

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

Re: [SOLVED] - cannot load swap partition on boot

Ropid wrote:

I think you are not doing anything wrong. Your fstab entry should work.

...

Maybe those "PTTYPE=gpt" and "PTUUID=..." entries you have are somehow involved with the problem? What are those entries? I can't find explanations I understand online.

Thanks for an idea! I added label to the swap partition with swaplabel (worked after I mkswap It). But after trying to add it with partx -a I got the following output:

partx: /dev/sda: error adding partition 3

In addition, label was gone after reboot.

It seems like the swap partition was not installed properly, right?

As for your questions - to be honest - I have no idea where these lines came from.

Offline

#12 2021-05-29 21:01:00

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

Re: [SOLVED] - cannot load swap partition on boot

seth wrote:

What's the output of

lsblk -f
sudo file -s /dev/sda3
lsblk -f
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda
|-sda1 vfat   FAT32       CEAE-76C6
|-sda2 ext4   1.0         a2e1c385-54d0-4faa-8cc1-b97ed3c18685     97G     6% /
`-sda3
sudo file -s /dev/sda3
/dev/sda3: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 15525136 sectors, extended partition table (last)

It seems like I haven't deleted the table from the last install, have I?

Offline

#13 2021-05-30 00:11:57

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] - cannot load swap partition on boot

It looks like there's a partition table inside /dev/sda3? You can run tools like fdisk with a filename as argument and they will then work inside that file as if it is a disk. Maybe you've done that with "/dev/sda3" as argument and now your /dev/sda3 partition has a partition table inside it and the system gets confused somehow about this.

That said, running mkswap should overwrite what's inside /dev/sda3? I don't understand what's going on.

You could try to wipe the contents of /dev/sda3 manually first before running mkswap. If you are using an SSD, you can wipe a partition instantly like this:

blkdiscard /dev/sda3

EDIT:

I tried looking in "man mkswap" and found this here:

mkswap,  like  many  others  mkfs-like utils, erases the first partition block to make any previous filesystem invisible.

However, mkswap refuses to erase the first block on a device with a disk label (SUN,  BSD, ...).

This could be the reason why your partition doesn't turn into a normal swap partition after you run mkswap? Maybe the mkswap tool is seeing the partition table inside sda3 and then refuses to delete it?

Last edited by Ropid (2021-05-30 00:16:58)

Offline

#14 2021-05-30 12:54:46

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

Re: [SOLVED] - cannot load swap partition on boot

Ropid wrote:

It looks like there's a partition table inside /dev/sda3? Y

Hey!

So, after your suggestion I wiped the table on /dev/sda3 with wipefs --all --force, then created a new GPT table on the disk with fdisk (and created a new linux swap partition).
After that, I rebooted, and then did standard mkswap, swapon, genfstab stuff. Then rebooted. The problem persisted.

The weird thing that I noticed after the above changes was that fdisk -l output was a bit different from the output of p command inside fdisk /dev/sda3:

sudo fdisk -l
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk model: KINGSTON RBUSNS8
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: AF59AAC9-368E-E942-9315-42E3CC75F19B

Device         Start       End   Sectors   Size Type
/dev/sda1       4096    618495    614400   300M EFI System
/dev/sda2     618496 234542652 233924157 111.5G Linux filesystem
/dev/sda3  234542653 250067789  15525137   7.4G Linux filesystem         # <-- here, there is /dev/sda3 with Linux filesystem.
sudo fdisk /dev/sda3

Welcome to fdisk (util-linux 2.36.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda3: 7.4 GiB, 7948870144 bytes, 15525137 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9A400B61-992A-1843-B312-AA7BD71342F5

Device      Start      End  Sectors  Size Type
/dev/sda3p1  2048 15525103 15523056  7.4G Linux swap                     # <-- here, a new device appeared with the given type.

Just in case, I found no sda3p1 in /dev/:

ls /dev/ | grep sda3p1                                                   # <-- gave me an empty output                                     

It seems like I am failing to notify the system about changes in disks? fdisk wrote the changes successfully, with notification that changes would came after reboot (what I did, as wrote above).

EDIT

So, the last thing I did was looking into the file type, which stayed the same:

sudo file -s /dev/sda3
/dev/sda3: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 15525136 sectors, extended partition table (last)

Last edited by soangrypanda (2021-05-30 13:06:38)

Offline

#15 2021-05-30 12:58:04

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

Re: [SOLVED] - cannot load swap partition on boot

soangrypanda wrote:

So, after your suggestion I wiped the table on /dev/sda3 with wipefs --all --force, then created a new GPT table on the disk with fdisk (and created a new linux swap partition).

So you fixed it, then made exactly the same mistake again. STOP PARTITIONING THE PARTITION!

Offline

#16 2021-05-30 13:14:47

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

Re: [SOLVED] - cannot load swap partition on boot

Scimmia wrote:
soangrypanda wrote:

So, after your suggestion I wiped the table on /dev/sda3 with wipefs --all --force, then created a new GPT table on the disk with fdisk (and created a new linux swap partition).

So you fixed it, then made exactly the same mistake again. STOP PARTITIONING THE PARTITION!

Hey!

Stop yelling at me smile (sounds almost like a meme, though).

But, I thought I need to make a swap partition when there is no one, and mount it only after that? Maybe I got all confused with this part of an installation guide - Installation_guide#Partition_the_disks

Offline

#17 2021-05-30 13:24:06

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,157

Re: [SOLVED] - cannot load swap partition on boot

You need to add a partition to /dev/sda and not to /dev/sda3 (note the lack of a 3, this is important) your disk is /dev/sda the numbers after that are the partitions. if /dev/sda3 is intended to be the swap partition then you don't have to do anything with fdisk and just run

mkswap /dev/sda3

(... directly after wipefs'ing /dev/sda3)

Last edited by V1del (2021-05-30 13:27:52)

Offline

#18 2021-05-30 14:55:23

soangrypanda
Member
Registered: 2021-05-29
Posts: 9

Re: [SOLVED] - cannot load swap partition on boot

V1del wrote:

You need to add a partition to /dev/sda and not to /dev/sda3 (note the lack of a 3, this is important) your disk is /dev/sda the numbers after that are the partitions. if /dev/sda3 is intended to be the swap partition then you don't have to do anything with fdisk and just run

mkswap /dev/sda3

(... directly after wipefs'ing /dev/sda3)

Kind Sir, accept my deepest gratitude!

swapon --show
NAME      TYPE      SIZE USED PRIO
/dev/sda3 partition 7.4G   0B   -2

It seems that I was fundamentally confused by the difference between a device and a partition. That is indeed a good chance to fill this gap in knowledge.


During these few days I indeed learned a lot of new things about the system due to the help of all of you, gents. Thank you all for dedicating a portion of your time to read this post and comment your suggestions.
I am thrilled to call this problem SOLVED smile.

Offline

Board footer

Powered by FluxBB