LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Arch (https://www.linuxquestions.org/questions/arch-29/)
-   -   Restore Swap Petition? (https://www.linuxquestions.org/questions/arch-29/restore-swap-petition-4175728628/)

johnywhy 09-03-2023 07:09 PM

Restore Swap Petition?
 
I'm running arch, installed with archinstall[1].

I read that arch uses zram[2] for swapping, not disk. Also read somewhere that zram doesn't use disk for swap, so i don't need a swap partition. (I don't get why archinstall creates a swap partition if it's not needed)

Believing it wasn't needed, i deleted the swap partition (using cfdisk from the Live ISO).

Now arch won't boot. I'm getting a message about waiting 10 seconds for a partition, and then i get dropped into emergency shell.

Code:

Loading keymap.... Done.
Waiting 10 seconds for device /dev/disk/by-partuuid/ecec0......[long number]
Error: Device /dev/disk/by-partuuid/ecec0......[long number] not found.


I attempted to recreate a swap partition in the same location on disk, using cfdisk, of "Linux Swap" type. Then i did mkswap on the reformatted swap partition.

Code:

# mkswap /dev/sdb2
But still not booting.

Do i need to change a partition ID in a grub config file?

I also attempted to mount the boot partition from the live ISO, and chroot into it, but that fails.

Code:

# mount /dev/sdb1 /mnt
# arch-chroot /mnt
chroot: failed to run command /bin/bash No such file or directory.
# chroot /mnt
chroot: failed to run command /usr/bin/zsh No such file or directory.

[1]: https://wiki.archlinux.org/title/archinstall
[2]: https://wiki.archlinux.org/title/Zram

frankbell 09-03-2023 08:21 PM

Quote:

I'm getting a message about waiting 10 seconds for a partition, but it never works.
Does the message identify what partition it's waiting for?

Have you checked /etc/fstab to make sure it reflects the actual partition structure?

michaelk 09-03-2023 08:26 PM

Since you didn't delete or comment out the line that pertains to swap in the /etc/fstab the system is not booting. Since reformatting creates a new UUID the swap partition is still not active. From the emergency shell try either commenting out or changing the UUID to match.

johnywhy 09-03-2023 11:40 PM

Quote:

Originally Posted by frankbell (Post 6451681)
Does the message identify what partition it's waiting for?

Have you checked /etc/fstab to make sure it reflects the actual partition structure?

Thx for replies.

I mounted the system partition, and checked /etc/fstab. It doesn't contain incorrect mounting info for the swap directory, because it doesn't contain any mount info for the swap partition (or for any other partition).

Plz see my original question for more details.

michaelk 09-04-2023 10:17 AM

Did you actually mount or change to the correct directory? You need to mount the root partition and then edit the mounted directory's /etc/fstab file. There isn't a need to use chroot. Is the root partition encrypted?

johnywhy 09-04-2023 10:38 AM

Quote:

Originally Posted by michaelk (Post 6451756)
Did you actually mount or change to the correct directory? You need to mount the root partition and then edit the mounted directory's /etc/fstab file.

I believe so.

Code:

# mount /dev/sdb1 /mnt
# cd /mnt/etc
# nano fstab

Quote:

Is the root partition encrypted?
No.

michaelk 09-04-2023 11:14 AM

And the file is empty?
While I have installed Arch in a VM in the past I have not played with it in awhile.

johnywhy 09-04-2023 11:52 AM

Quote:

Originally Posted by michaelk (Post 6451767)
And the file is empty?

It contains generic comments, like this:
Quote:

# Static information about the filesystems.
# See fstab(5) for details.
I was advised, instead of changing something in a config file, like fstab or grub, to match the new UUID of the new partition, to instead change the UUID of the new swap partition to match the old number. I'm going to try that now.

michaelk 09-04-2023 12:54 PM

I would guess or assume that Arch uses systemd to mount the filesystems instead of /etc/fstab. Yes, you can change the current swap UUID to match the old.

johnywhy 09-04-2023 01:19 PM

Quote:

Originally Posted by michaelk (Post 6451782)
I would guess or assume that Arch uses systemd to mount the filesystems instead of /etc/fstab. Yes, you can change the current swap UUID to match the old.

I used gdisk to change the GUID on the swap part. Now on boot i'm getting

Quote:

starting systemd
...hook...
...keymap...
performing fsk on [restored ID]
mounting [restored ID] on real root
VFS: Can't find ext4 filesystem
mount: /new_root: wrong fs type, bad option, or [etc]
failed to mount

michaelk 09-04-2023 02:16 PM

Did you change the correct filesystem?

johnywhy 09-04-2023 02:20 PM

Quote:

Originally Posted by michaelk (Post 6451800)
Did you change the correct filesystem?

Filesystem?
If you mean, correct partition, then yes, i believe so.
I think the boot wouldn't have gotten as far as it did if i had altered the system partition.

michaelk 09-04-2023 04:46 PM

Depends on how you configured your install but for me with an efi default setup, archinstall created 2 partitions. /dev/sda1 for /boot and /dev/sda2 for the / partition. The boot partition was defined in /etc/fstab but / is a kernel command line parameter as well as zswap. Do you have a /boot/loader/entries directory? Check the conf files to see if the UUIDs match your /(root) filesystem.

teckk 09-04-2023 06:03 PM

https://wiki.archlinux.org/title/Swap
https://wiki.archlinux.org/title/File_systems
https://wiki.archlinux.org/title/Fstab
https://wiki.archlinux.org/title/Per..._device_naming


All times are GMT -5. The time now is 07:27 AM.