How to rename volume group of an encrypted boot drive and have it still boot?

John

Related to this question, it seems the only way I can access one encrypted boot drive from another encrypted boot drive (both using the default encryption options when installing Ubuntu) is if the two drives have different volume group (VG) names. By default, Ubuntu uses the volume group name "ubuntu-vg" and if you have two volume groups with the same name, lvm2 has a problem.

A bigger problem was when I read this and decided to rename my active boot drive's VG to something different. Then I rebooted and cryptsetup would no longer recognize my password. It gave me the error

unknown fstype, bad password or options?

Using a LiveUSB I renamed the VG on that boot drive back to ubuntu-vg and it booted again (relief).

Now, if the VG names must be unique but they also cannot change, then there is a problem. I did not see an option when I installed Ubuntu to set the VG name. I guess it is either hard-coded or in a config file somewhere. I checked the smaller (unencrypted) boot area on the drive and I see in

/grub/grub.cfg

There are some references to this "ubuntu-vg" which makes me think I can change it.

However, I am still fairly new to Ubuntu so before I go being a creative person with another non-bootable drive, I would love some input from the experts here.

Can I rename the VG using vgrename then change /grub/grug.cfg by doing a find-and-replace all of the old VG name to the new VG name and magically everything will work?

John

After reading George's link (and several others), I wanted to post this here as an answer.

If you need to rename the volume group of an encrypted boot drive, these are the steps you should take. At least they seem to work well on 16.04.

  1. Unplug all other drives and only have a LiveUSB (or similar) and your encrypted boot drive plugged in. Note, do not boot from another encrypted boot drive because both boot drives have the same volume group name (ubuntu-vg).
  2. Boot from the LiveUSB, not from the encrypted boot drive
  3. After the LiveUSB is running the active system, make sure lvm2 is installed (although the 16.04.2 LiveUSB does already lvm2 installed).

sudo apt install lvm2

  1. Mount the encrypted drive. Then, verify the name of the volume group (there should only be one because no other drives besides the LiveUSB should be connected). The default for 16.04 (and it seems 18.04) is "ubuntu-vg" (the following will assume that is the case).

sudo vgscan

  1. Rename the volume group to something unique

sudo vgrename ubuntu-vg my_new_volume_group_name

  1. You should receive confirmation that the volume group was renamed.
  2. At this point, your encrypted boot drive will not boot because grub can no longer find the volume group named ubuntu-vg. So, you need to update grub. On the encrypted boot drive, go to the grub folder and see the file grub.cfg. If you try to open it from a LiveUSB, it will be read only so open a terminal and type:

sudo gedit

  1. From within gedit, open the grub.cfg file (which will be on the unencrypted part, in the grub folder.
  2. Save a copy of this file as backup-grub.cfg just in case something goes wrong in the next few steps.
  3. Find and replace ubuntu--vg with your new volume group name (ctrl+H, Find:ubuntu--vg Replace with:my_new_volume_group_name). That find text is correct. You should find "ubuntu--vg" (notice there are two dashes between "ubuntu" and "vg" because when you use a dash here, grub needs a double-dash.
  4. Save the file back to grup.cfg
  5. Reboot, removing the LiveUSB

Now, when grub loads, it will see the volume group name it expects and you will be able to load your encrypted boot drive.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Accessing encrypted boot drive as extra drive

From Dev

Mounting Encrypted VeraCrypt Drive during Boot

From Dev

How to have a luks-protected LVM volume mounted at boot

From Dev

Do I still have to wipe a drive which was encrypted with BitLocker, then formatted?

From Dev

Ubuntu looks for a removed volume group during boot

From Dev

Accessing one encrypted boot drive from another in 18.04

From Dev

How do you rename the volume group that contains the root volume in LVM?

From Dev

How can I increase size of boot partition, if I have an encrypted home partition?

From Dev

Have only the boot partition on one drive

From Dev

How to mount a luks encrypted partition at boot

From Dev

How to boot an encrypted Debian, from an unencrypted Ubuntu?

From Dev

How to mount swap encrypted with LUKS on boot?

From Dev

How to boot from a flash drive?

From Dev

encrypted 13.10 will not reliably boot

From Dev

encrypted 13.10 will not reliably boot

From Dev

How to add memory or delete files to \boot volume?

From Dev

Can't boot into latest kernel after update - volume group not found / cannot process volume group

From Dev

Why my encrypted LVM volume (LUKS device) won't mount at boot time?

From Dev

Checking Boot Volume

From Dev

ReFS filesystem for boot volume

From Dev

How to Thunderbird emails on a Windows Drive (Dual Boot)

From Dev

How to Thunderbird emails on a Windows Drive (Dual Boot)

From Dev

How to boot to Ubuntu ISO image on drive?

From Dev

How to make windows boot off 1 drive

From Dev

How to boot from a USB drive in VirtualBox?

From Dev

How to reinstall GRUB to a different boot drive

From Dev

Does a Windows 8 boot partition have to be at the start of a drive?

From Dev

The 'Software Updater' does not have enough disk space on /boot drive

From Dev

Boot windows 10 with USB but have Ubuntu on hard drive

Related Related

  1. 1

    Accessing encrypted boot drive as extra drive

  2. 2

    Mounting Encrypted VeraCrypt Drive during Boot

  3. 3

    How to have a luks-protected LVM volume mounted at boot

  4. 4

    Do I still have to wipe a drive which was encrypted with BitLocker, then formatted?

  5. 5

    Ubuntu looks for a removed volume group during boot

  6. 6

    Accessing one encrypted boot drive from another in 18.04

  7. 7

    How do you rename the volume group that contains the root volume in LVM?

  8. 8

    How can I increase size of boot partition, if I have an encrypted home partition?

  9. 9

    Have only the boot partition on one drive

  10. 10

    How to mount a luks encrypted partition at boot

  11. 11

    How to boot an encrypted Debian, from an unencrypted Ubuntu?

  12. 12

    How to mount swap encrypted with LUKS on boot?

  13. 13

    How to boot from a flash drive?

  14. 14

    encrypted 13.10 will not reliably boot

  15. 15

    encrypted 13.10 will not reliably boot

  16. 16

    How to add memory or delete files to \boot volume?

  17. 17

    Can't boot into latest kernel after update - volume group not found / cannot process volume group

  18. 18

    Why my encrypted LVM volume (LUKS device) won't mount at boot time?

  19. 19

    Checking Boot Volume

  20. 20

    ReFS filesystem for boot volume

  21. 21

    How to Thunderbird emails on a Windows Drive (Dual Boot)

  22. 22

    How to Thunderbird emails on a Windows Drive (Dual Boot)

  23. 23

    How to boot to Ubuntu ISO image on drive?

  24. 24

    How to make windows boot off 1 drive

  25. 25

    How to boot from a USB drive in VirtualBox?

  26. 26

    How to reinstall GRUB to a different boot drive

  27. 27

    Does a Windows 8 boot partition have to be at the start of a drive?

  28. 28

    The 'Software Updater' does not have enough disk space on /boot drive

  29. 29

    Boot windows 10 with USB but have Ubuntu on hard drive

HotTag

Archive