How To Prepare For A Swap UUID Change (Read on)

One more thing.
We will need to change the swap uuid also in grub.cfg if the swap uuid has changed.
To do this, change the new uuid in /etc/default grub in the GRUB_CMDLINE_LINUX_DEFAULT line.
Then “update-grub”.

One point - Linux Mint installer does not change the swap uuid unless we select to format this.
Of course if we select any partition to format, the uuid will change.
Also, it also gives an option to install (or not) a bootloader and to its partition or to mbr, which is the default anyway for all linux installers. Thought we should set things straight.

1 Like

I’m playing with the installer now, no matter what option I choose, it states that swap WILL be formatted. Manual mode install, deselecting format swap partition, and the confirmation screen still states that it WILL format swap. Using the auto install method provides the same result. If there is an option to prevent a swap format, It’s not appearing for me. And I am not seeing any option to not install the bootloader. On a bios machine it lists the hard disks only with NO option to not install, only where to install. And on a UEFI machine it’ll list all partitions, with NO option to not install. This is the case on the machines I am running, maybe it’s different on other machines? Manjaro’s installer has a clear check mark that you can deselect to not install any bootloader, and it will not format swap unless you specifically check the format option.

Just to flag a possible mess with your two different issues: swap, bootloader.

If you install mint and the swap ID is changed and at the same time you choose to not install bootloader you might get to an un-bootable system.
I suggest to follow @cimarronline method for swap UUID change in grub and after you boot into Manjaro install the Manjaro Grub to your disk.

I have a Linux Mint installation. (in one of my systems)
And a swap.

No such problem for me.

And also an option you might try if it is supported from the installer is do not use swap, at least during installation. It might already auto use the existing swap during boot.
Either way you can add swap after first boot.

Best advice so far (in your case). I concur.
Now try to find (at LM install) where to check to install to own partition or none.
If cannot find it, after the installation and it boots to LM and Manjaro is no longer bootable (due to intel-ucode), see this.

1 Like

That is a very good suggestion. Install Mint with no swap. Then you can add swap after boot to use the partition Manjaro already uses. There will be an issue with grub, however. When you intall the Mint grub it does not load the intel microcode the same way that Arch based kernels do. So if you try to boot to Manjaro from the Mint grub, you will likely end up with a kernel panic. Solution is either not to install grub with Mint or to chroot into the Manjaro installation and update grub from there to over-write the Mint grub.

Thank you Master!!
This is a special badge for me! :innocent:

1 Like

I tried changing my swap UUID in the fstab and Manjaro booted fine, it just reported an error and couldn’t use the swap partition. That’s using OpenRC, but I’d guess systemd could handle that just as easily.

So I don’t think there should be any fears that a changed swap UUID could render Manjaro unbootable.

It sounds like the bigger issue is the bootloader (since Mint’s might not be able to boot Manjaro).

Yeah, the last time I did this the person on the old forum had me boot into cli mode with Manjaro, and run a whole series of commands. The only one I distinctly remember was finding the new swap UUID and adding that in “somewhere”. I don’t recall any grub commands, but there must have been because after I could boot both Manjaro and Mint and I had the Manjaro grub. I really wish we could access the old forums. The person that guided me before was spot on, and new exactly what to do. I was just tying to simplify things before adding a Mint partition on my system. I just tested on a spare computer running manjaro, no manjaro boot after mint install with zero option to not format swap. I doubt it, but maybe the option is there and I am not seeing it, but in my tests here, currently if you install Mint AFTER Manjaro, Manjaro will not boot. So is it a swap UUID issue or a Grub UUID issue? When I get a chance I’ll try doing the pre-install recommendations here as a test. I’m guessing on this install I’ll use @gohlip tutorial linked to achieve boot.

Yes, it sounds like Manjaro won’t boot because Mint’s bootloader doesn’t have the Manjaro grub entry right. The only way to avoid this, I think, is to not let Mint overwrite the Manjaro bootloader (by installing the Mint bootloader to the partition instead).

But since Mint’s bootloader is already installed now, yes, use gohlip’s instructions to boot into Manjaro and reinstall grub from Manjaro. It doesn’t look too difficult.

I was just wondering, would it be useful and/or helpful if your fstab and grub defined swap by /dev/sd* rather than UUID? The order of drives shouldn’t change right?

This all issue stack is not as serious as the length of the topic.
You need to do what @cimarronline said at the beginning


It is fairly easy, even for newbies.

Just to make it clearer for newbie, I’ll make a complete what to do here:

  1. Boot into LM, open terminal.
  2. Type in lsblk -l and look at the UUID of your swap partition then right click and copy it.
  3. Type in sudo mount /dev/sdxx /run/media/where sdxx is the root partition of Manjaro, you got the xx from the lsblk command above.
  4. Type in sudo nano /run/media/etc/fstab and change the UUID of your swap partition. You can use your preferred text editor. To paste using nano, press Ctrl+Shift+V.
  5. Press Ctrl+X, enter, enter to save the file you modified using nano.
  6. Done
    Now mark my post as the solution for this topic. :slight_smile:
2 Likes

@Annoyingduck, as a multibooter, I agree with branthebuilder’s suggestion.

Don’t choose swap during installation of a distro, and then add it later to the /etc/fstab file of the newly-installed distro, BUT instead of identifying the swap partition by UUID, use the /dev/sdXY format to identify it in the fstab file. (X = drive [e.g. sda? sdb?]; Y is the partition number of swap on that drive [e.g. sda1? sda2?] )

If in future you install another distro and it insists on choosing and formatting swap (cough slackware text-based installer cough
), as long as your swap partition number hasn’t changed - which can happen if you remove an earlier-numbered partition - the prior-installed distro’s fstab will still be accurate.

So the first thing I do when I install and boot into a new distro is to change the fstab to sdXY numbering.

Meanwhile, if you ever have a situation where a distro steals back the grub-booting duties by reinstalling its grub into your MBR [this is for legacy BIOS; sorry I can’t help you for EFI machines], you can boot into the distro that is your choice of grub, and then:

[code]sudo update-grub

sudo grub-install /dev/sdX [where X is the drive on which your booting MBR resides] [/code]

I have this problem because I started with Mint as the first distro on my machine. So it controlled boot with its grub. When I then added Manjaro to the machine, I used grub-install to supplant Mint’s grub in MBR. But whenever I upgrade kernel in Mint (or there is an update to grub in Mint), it updates grub and dumps itself back in MBR. So I have to boot into Manjaro to make it control grub again.

I disagree. setting " /dev/sd* " anywhere, particularly in fstab is not good.
It will be hazardous if there is more than 1 disk as the bios can change sda/sdb/sdc everytime we boot up and when it cannot find the partition, there will be kernel panic, won’t boot up or at the very least result in errors.
And even if there is only one disk, some times we need to plug in a usb or external, to install an OS for example, and the issue will resurface.

Installers that change uuid’s for unformatted partitions (including swap) is clearly wrong and shouldn’t happen.
I had mentioned before, when calamares was in developmental stage, it did that - changed swap uuid - (and changed partitioning numbering as well), but was rectified very fast when calamares developers were notified. That is a good installer (and good developers).

Oh… and to prevent an OS from becoming the default grub bootloader, at that OS terminal. - But remember, set default grub first at Manjaro OS.

sudo grub-install --force /dev/sdxy

where /dev/sdxy is that OS partition.
Note there will be lots of warnings (embedding, unreliable, discouraged …) but installation will complete without errors.

Just my opinion.

[edit] - And I think this (uuid) is important enough that I list some links explaning why
here

UUID must be privileged over kernel name descriptors and labels.

here

here

and here.

1 Like

'LLo,
Yep , uuid (which prevent Os to switch sdxx with multiple/external drive in example) are the more safe, but also the less “human readable” of the three, pfuuu…!
Is it why there not labelize option in calamares (which will be an “enjoy the simplicity” way of doing, imho) in your opinion ?

I think somewhere in this forum (philm I think, who else? :slight_smile: ) said there will be an upcoming calamares version that will allow us to label partitions and a cli version of calamares. But I don’t think fstab (and others) will use label but will use uuid as usual (and that should be correct and right).

And yes, we can label swap partition and use the label in fstab (and others) but still the best will be to use uuid. Using label will be very good for user interaction but when we need to ‘anchor’ these things down, uuid is still best.

Er…there’s partuuid , even better than uuid, and won’t change even if formatted, only for GPT partitions and …:sunglasses: ps; warning, don’t use in msdos.

To manually change the UUID of a swap partition:

su -
# swapoff -a
# mkswap -U 4aa131f4-e9ce-44b3-bb66-948ca44152f1 /dev/sda1
# swapon -U 4aa131f4-e9ce-44b3-bb66-948ca44152f1

sda1 is the location of the swap

4aa131f4-e9ce-44b3-bb66-948ca44152f1 is the UUID you want to swap

Thanks for the caution about using /dev/sdX naming scheme in fstab, @gohlip . The link to arch wiki was educational.

However, BIOS on my system has not done anything different for the past 1.5 years so at least for my own hardware, I think it’s ok.

The first link said this:

If your machine has more than one SATA, SCSI or IDE disk controller, the
order in which their corresponding device nodes are added is arbitrary.

I believe my machine only has one disk controller.

Anyway, I only use the sdX naming scheme in the fstab file for swap partition. The root and other partitions all use UUID, so I’m not going to have any issue with kernel panics or inability to boot or find the distro.

From what I can see, the only issue with a wrongly-named swap partition is that when the distro you boot uses systemd and the latter cannot find a swap partition matching the info in the fstab file, the bootup checks go on for 1 min 30sec. After that, it just boots into the distro, albeit without swap. I have ample RAM [edit: corrected the word] and that’s not an issue.

Forum kindly sponsored by Bytemark