Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My system has multiple partitions, with a swap partition and 4 other partitions. The 4 other partitions each have a distro of Linux on them, and some of them change from time to time. The older two distros have lost the location of the swap partition == they display the name of a partition but says it isn't there. I think they have the name right, but don't know enough to be certain.
W: initramfs-tools configuration sets RESUME=UUID=1b0b9f28-4745-40e7-9bad-5cc3ff41e862
W: but no matching swap device is available.
So. I have a swap partition. I need my distros to use the swap partition. What is the easiest way of telling them each where it is (and, if necessary, how to access it)?
The system is a Lenovo ThinkPad T430 with a 500 Gb hard drive and 8 Gb RAM (formerly 4 Gb), all Intel chips.
Now what? Other than the fact that I'm pretty sure the swap file is a completely different address than the one I posted LOL
yes, it is "hard coded" in a configuration file
the UUID changes if you use mkswap ( recreating the swap filesystem )
you will need to find the file initramfs-tools uses and correct the UUID
you mentioned other distros
you can share a swap partition , BUT you will not be able to use resume
if you want resume they each need their own swap partition
you could go the swapfile ( use a file like a blockdevice ) but that will complicate things
how tied to your existing setup are you?
you could start from scratch.
but instead of using traditional partitions a more flexible approach would be to use lvm2
as example
I have a VM that I'm playing with
Code:
parted /dev/sda print
<edit snip remove scroll>
Number Start End Size File system Name Flags
1 1049kB 6291kB 5243kB bios_grub
3 6291kB 1075MB 1068MB
2 1075MB 21.5GB 20.4GB lvm
ignore partition 3 it is not important
Code:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
|-sda1 8:1 0 5M 0 part
|-sda2 8:2 0 19G 0 part
| |-vg_slackware-lv_swap 252:0 0 1G 0 lvm [SWAP]
| |-vg_slackware-lv_root 252:1 0 10G 0 lvm /
| `-vg_slackware-lv_temp 252:2 0 1G 0 lvm
`-sda3 8:3 0 1019M 0 part
instead of vg_slackware,
Code:
vg_distos
├─lv_boot
├─lv_distro1_swap
├─lv_distro1_root
├─lv_distro2_swap
├─lv_distro2_root
├─lv_distro3_swap
├─lv_distro.... you get the idea
So, why does each partition need its own swap file? Isn't the swap partition wiped and ready for use when you boot down? (Remember, you keep saying there are no stupid questions LOL)
To elaborate on the other posts, filesystems including swap are assigned a unique number called a UUID (sda4 UUID=d51f2cbd-474c-4818-9fc4-d6844f1f4ed1 ) when they are created. One minor problem with today's hardware/operating systems is the same physical hard drive may not be automatically assigned the same device ID i.e. sda,sdb etc.
At boot time the operating system uses the /etc/fstab file to mount the filesystems and one method to identify them is by their UUID. When you installed each operating system you assigned the same swap partition but you had it formatted which as stated created a new UUID so the previous operating systems /etc/fstab file did not match any more.
As stated you can go back and change each /etc/fstab to match the current swap UUID but if you suspend/sleep any of your systems, then boot another operating system you might corrupt the suspended system since it could save its memory in swap and be overwritten by the other. For that reason it might be better if each operating system had their own swap file/partition.
Last edited by michaelk; 09-09-2019 at 01:34 PM.
Reason: clarification
So, why does each partition need its own swap file? Isn't the swap partition wiped and ready for use when you boot down? (Remember, you keep saying there are no stupid questions LOL)
you can use the same swap partition for each disto
However, you can't if you want to use the resume feature
When you suspend, the stuff in ram is saved to the swap partition
When you resume it is moved from the swap back to ram
so what happens if you boot another distro ?
Confusion.
If you are *not* going to hibernate, you should *not* use UUID in fstab for your swap
instead use PARTUUID or by-id , by-path
see output of
Code:
ls /dev/disk/*
the reason being each disto may re mkswap which changes the UUID
( That is what happened to bring you here )
typically I don't use swap
the only reason that slackware has some is due to it being a virtualMachine and I have not given it much ram
tl;dr
give each distro its own swap partition
use lvm2 for easier life in the long run
And just to prove Linux is about choice - I always use swap, and I always use device designations (/dev/sda1), and I share that swap partition.
You need to be careful when hibernating as mentioned, but the setup and maintainence is easier. The stampede to UUID a few years was more for the convenience of the packagers of distros than end users. Especially those of us that do this. And no, I'm not going to debate it.
The swap is specified in your /etc/fstab for each system (as per your swapfile system) - you can simply update each one in need. If you wish to use swap immediately on a system, simply issue "swapon /dev/sda1".
And just to prove Linux is about choice - I always use swap, and I always use device designations (/dev/sda1), and I share that swap partition.
You need to be careful when hibernating as mentioned, but the setup and maintainence is easier. The stampede to UUID a few years was more for the convenience of the packagers of distros than end users. Especially those of us that do this. And no, I'm not going to debate it.
The swap is specified in your /etc/fstab for each system (as per your swapfile system) - you can simply update each one in need. If you wish to use swap immediately on a system, simply issue "swapon /dev/sda1".
I always use swap, and always more than the amount of RAM. I never, however, use device designations unless the device is virtual. UUID, MD, LVM, or RAID designations I MIGHT use, but I prefer to use labels. I have had device designation change and found labels, uuid, MD, RAID, and LVM names far more reliable.
W: initramfs-tools configuration sets RESUME=UUID=1b0b9f28-4745-40e7-9bad-5cc3ff41e862
W: but no matching swap device is available.
and because you don't use resume, as root delete the file etc/initramfs-tools/conf.d/resume
Quote:
I got different results on my other laptop... I need to take some time reading your last entry.
The reason for the different results is that your swap partition is on the first partition /dev/sda1 and on the other system the fourth partition /dev/sda4. The UUID(Universally Unique IDentifier) will always be different. When installing a new system using the same swap will reformat the swap partition change the UUID.
One work around for this is to edit your fstab and change the swap line uuid=<some number> to /dev/sda? where the ? will be the number parition swap.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.