PureOS installation with LVM volume groups

I have a Librem15rev3 which has a 512GB Samsung SSD as the only disk. The default installation of PureOS creates one large disk partition for the system and the /home-directories, plus a small /boot-partition and a swap-partition (if needed).

I would like to do the installation using (encrypted) LVM volume groups for the /root- and /home, and additional (standard-non-LVM) partitions for /boot and swap.

I have tried several ways using the PureOS-Live-distribution on a USB-Stick, but the only thing that I managed to get working is the standard installation with one large partition for /home and /.

Funny thing is, my Librem15rev2 has an installation using LVM volumes, even encrypted, and it seems this was rolled out as a standard installation at the time. At least I do not remember that I had to do something sophisticated back then (most likely I just used the installer which sat on the second disk drive in that machine - and probably still is there).

So this is the configuration I have on the older laptop:

df
dev/mapper/librem–vg-root 48996512 38770904 7922532 84% /
/dev/mapper/librem–vg-home 257898948 207137668 37637696 85% /home

pvdisplay:
— Physical volume —
PV Name /dev/mapper/sdb5_crypt
VG Name librem-vg
PV Size <465.52 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 119172
Free PE 0
Allocated PE 119172
PV UUID AdeAp9-oN10-ullW-oSsz-spiE-J361-YQ3Hw6

lvdisplay:
— Logical volume —
LV Path /dev/librem-vg/root
LV Name root
VG Name librem-vg
LV UUID bdFQSL-wFqX-zx0r-OpgA-zEEn-xzWO-aAoesQ
LV Write Access read/write
LV Creation host, time librem, 2016-08-07 18:44:16 +0200
LV Status available
# open 1
LV Size <47.60 GiB
Current LE 12185
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

— Logical volume —
LV Path /dev/librem-vg/swap_1
LV Name swap_1
VG Name librem-vg
LV UUID FXdBk5-JVWx-bVfR-0fg5-PqOb-Hq2u-qRQQG1
LV Write Access read/write
LV Creation host, time librem, 2016-08-07 18:44:16 +0200
LV Status available
\ # open 2
LV Size <15.92 GiB
Current LE 4075
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

— Logical volume —
LV Path /dev/librem-vg/home
LV Name home
VG Name librem-vg
LV UUID 5SHVrR-le1R-wBop-6lWD-Ixw4-FlvY-GbcKZp
LV Write Access read/write
LV Creation host, time librem, 2016-08-07 18:44:16 +0200
LV Status available
\ # open 1
LV Size 250.00 GiB
Current LE 64000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3

— Logical volume —
LV Path /dev/librem-vg/soft
LV Name soft
VG Name librem-vg
LV UUID 5JWmCP-4S3x-VG2d-T6F7-2KLW-l8nO-O5xjKc
LV Write Access read/write
LV Creation host, time librem, 2017-03-05 15:49:15 +0100
LV Status available
# open 2
LV Size 152.00 GiB
Current LE 38912
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1234:

But whatever I tried on the Librem15rev3, the installation process was always overwriting my LVM-partitions, or sometimes even crashing. There is a button for “Volume groups” in the manual partitioning menu, but I didn’t understand how it was supposed to work.

Any suggestions are highly appreciated.

I found that there is already a Task in the PureOS Tracker:

https://tracker.pureos.net/T778

mentioning this. I think I can confirm all the cases. Unfortunately, the task is assigned to “None”.

Going back in the forums, I realized that the old laptop was installed using PureOS 2.1:

Booting to “failsafe mode” from LiveUSB-System results in the message

Probing EDD (edd=off to disable)… ok

and then it takes a while till one gets to the PureOS screen, and the situation is like before.
Is there a possibility to install from a different installer? Or I can see if I find my LiveUSB-System for PureOS2.1 and try that…

I ran into the same issue, outlined here PureOS Installer handicapped?.

Based on the suggestions I got from @Jeremiah, it seems this is an issue they indeed know about, but do not have a solution for (yet?).

@Torrone suggested installing using the command line method. I admit, I have not yet gotten around to trying that. It might be worth a look!

Well, apparently what you want to achieve used to work out of the box 3 years ago with PureOS2.1 installer.
I’d be happy to try a commandline installer, but haven’t got to a commandline bot prompt…

Nothing important on the laptop yet, so I can still wipe everything and start over…

Which version of the Live installer are you using? We have built newer ones which may be more useful to you; https://pureos.net/download/

Note that we have moved away from LVM partitions and now use LUKS per default. This doesn’t mean that you cannot combine the two, just that our current default setup has changed.

1 Like

I use pureos-8.0-gnome-live_20190714-amd64.hybrid.iso, the one which is currently available on the https://pureos.net/download.

With this image, the Installer has an apparent problem with LVM.

1 Like

How would you describe the problem? Would you say that you “cannot preserve LVM partitions using installer”?

I think what I’d like to have is one unencrypted /boot partition and one encrypted physical LVM volume containing the rest of the disk with the volume groups /root, /home and /swap on which the system is installed.

If I prepare this before and then use the installer, it will only allow me to overwrite the existing LVM volumes. If I try to create the physical volume in the installer, I can not create the required volume groups.

This link pretty much describes the behavior:
https://tracker.pureos.net/T778
(e.g. case 4 would correspond to the second case mentioned above)

Unfortunately I can’t find the USB-Stick with the PureOS-2.1 distro which I used to install the system on my Librem15rev2, otherwsie I would try that one (not sure if it will work with a Librem15rev3, but maybe yes).

Could the problem be related to the fact that my disk is a 512GB NVMe Pro accessed through /dev/nvme0n1?

On my Librem15rev2, i have a Samsung 850 EVO M.2 SSD showing up as /dev/sdb. Don’t know if this makes a difference.

OK,

I tried again to install “LVM on LuKS” with a separate unencrypted /boot-partition, following instructions at

and

https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#LVM_on_LUKS

So I prepared the LVM physical volume, the logical volumes and the filesystems on the LuKS-encrypted partition which was “opened” with cryptsetup open /dev/nvme0n1p2

Then I started the Installer, and assigned partitions to mount points. The installation runs smoothly till almost the end, when the following “Error” message appears:

IMG_1244

and the installation process stops. Maybe I did something wrong with the /boot-partition?

I tried also without any encryption, but the result was the same.

I wonder which installer was on PureOS-2.1.iso, it maybe wasn’t as graphical as the current one, but at the time it did the job. Maybe just pack it as an alternative onto the current Live-Image?

1 Like

The installer I believe is the same, called “Calamares”.

The error like requires some research, but it looks like it’s related to EFI. PureOS is not designed to be installed on UEFI systems.

So maybe I didn’t set the partition type to GPT and set the “bios-grup” flag for the /boot-partition. Will retry.

OK<

i retried, taking care that the whole disk had a GPT partition table, and the /boot-partition was flagged as “bios-grub”. Then I did manual partitioning, and essentially assigned mount points, and everything pretty much looked like step 5i of https://tracker.pureos.net/w/installation_guide/live_system_installation/
(with /, /home and swap being LVM logical volumes).

Error message is similar, but ‘grub-install’ has different flags:
Command ‘grub-install --target=i386-pc --force /dev/nvme0n1’ returned non-zero exit status 1.
Installing for i386-pc platform grub-install: error: cannot find a device for /boot/grub (is /dev mounted?).

Errors for line 457 and 429 are like above, modules.bootloader/main.py however has a problem in "line 340, in install_grub bootloader[“installPath”]])

Why target =i386-pc?

I don’t understand why it is i386. PureOS doesn’t build packages for that platform, we’ve moved on to AMD64.

When I try to install onto the existing LVM logical volumes for / and /home, I have a separate (unencrypted, no-LVM) partition of 500 MB for boot on /dev/nvme0n1p1 (LVM is on /dev/nvme0n1p2).

However, the pull down-menu for “Install the boot loader on:” gives me only a choice of the Master Boot Record of the full disk (/dev/nvme0n1), not the 500 MB partition. Maybe that is the reason for the grub-install error (it still persists).

So maybe grub has a problem identifying partition names for /dev/nvme-devices?

https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/1507505

Is it possible that this bug is not fixed yet?

So I am still stuck with the grub-install-error. It seems it can not install the bootloader (this happens right at the end of the installation process). And the drop-down-menu only allows to the Master Boot Record of the full disk (/dev/nvme0n1), while the actual boot-partition would be /dev/nvme0n1p1 with mountpoint /boot

There is also the possibility to instal the boot-loader into /boot, but it may be that this tried to install to teh /boot-partition of the LiveUSB (but maybe I am wrong, in any case also this doesn’t work).

Third option which is given in the drop-down-menu is to not install a bootloader at all, but this to me doesn’t make sense.

If I chose the ‘default’ installation wiping the disk, I get 1 dos-partition scheme with 3 partitions /dev/nvme0n1p1 for /boot, /dev/nvme0n1p2 for / (including /home) and /dev/nvme0n1p3 for swap.

In this case everything works, but as soon as I turn /dev/nvme0n1p2 and /dev/nvme0n1p3 into a a physical volume (on dos or gpt disk label), the installation fails with one of the errors given above.

I use the newest Live-Distro, and I do

sudo apt update
sudo apt upgrade

before anything else.

I any case I have the suspicion that it has to do in one way or another with my Samsung SSD 970 PRO 512GB (my Librem15rev2 contains the EVO-version which shows up as /dev/sdb ).

Looks like the corresponding task at
https://tracker.pureos.net/T778
has been given high priority, but is still assigned to “none”.

Also I am not sure what can be done about it, is it the installer, grub, or maybe I am simply doing something wrong.

Would a “walk-through” with all the steps I do help?

What is this “commandline method”?

OK, I have to install a working system now because I need the laptop and will go for the standard installation. In case someone wants to investigate this case further, this is what I did (sorry for the lengthy entry, but I tried several things to get it working):

Boot from LiveUSB (pureos-8.0-gnome-live_20190714-amd64.hybrid.iso)
=> “Test or install PureOS” at Boot menu
=> Go through Welcome-Dialog, setup Wi_Fi

start “Software”-App (this apparently loads additional repositories), then on terminal:

sudo apt update

sudo apt upgrade (62 packages upgraded)

sudo apt install gnome-terminal (more convenient than Tilix)

sudo apt install xfsprogs reiserfsprogs reiser4progs jfsutils kpartx dmraid gpart udftools (don’t know if I need all those, but should do no harm)

sudo apt install grub2 grub grub-efi (I had the hope this would change something, but unfortunately not)

sudo su

fdisk /dev/nvme0n1
(delete existing partition /dev/nvme0n1p1 and existing partition /dev/nvme0n1p2, I start from scratch, “w” writes the new partition table and exits)

fdisk /dev/nvme0n1
g (creates new GPT disklabel)
w (writes new partition table and exits)

fdisk /dev/nvme0n1
n
1
+500M
(boot partition)

n
2
(first sector default)
(last sector default)
(LVM partition)

w
(write and exit)

fdisk /dev/nvme0n1:

Command (m for help): p
Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Samsung SSD 970 PRO 512GB
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: 68702F5F-92E8-B74F-A7FC-02B9677290B6
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1026047 1024000 500M Linux filesystem
/dev/nvme0n1p2 1026048 1000215182 999189135 476.5G Linux filesystem

Now I encrypt the 2. partition:

cryptsetup -c aes-xts-plain64 -h sha256 -y -s 512 luksFormat /dev/nvme0n1p2
WARNING!
========
This will overwrite data on /dev/nvme0n1p2 irrevocably.
Are you sure? (Type uppercase yes): YES
Enter passphrase for /dev/nvme0n1p2:
Verify passphrase:

And unlocking it:

cryptsetup open /dev/nvme0n1p2 nvme0n1p2_crypt
Enter passphrase for /dev/nvme0n1p2:

Create physical volume and volume-group:

vgcreate librem–vg /dev/mapper/nvme0n1p2_crypt
Physical volume “/dev/mapper/nvme0n1p2_crypt” successfully created.
Volume group “librem–vg” successfully created

Now logical volumes for root, home and swap:

lvcreate --name root --size 50G librem–vg
lvcreate --name home --size 250G librem–vg
lvcreate --name swap --size 32G librem–vg

Create files systems:

mkfs.ext4 /dev/librem–vg/root
mkfs.ext4 /dev/librem–vg/home
mkswap /dev/librem–vg/swap

(I use gparted to add the “bios-grub”-flag to the 500MB partition, but leave it unformatted).

Now start Calamares-Installer:

  • American English

  • Berlin (system languaeg American Englsih (United States)

  • en.US.UTF-8 as locale

  • default keyboard model

Manual partitioning:
Chose “librem–vg - 476.4GiB (/dev/librem–vg)” in drop-down menu:
Edit /dev/librem–vg/home and add mountpoint /home
Edit /dev/librem–vg/root and add mountpoint /
/dev/librem–vg/swap is recognized as “swap” filesystem

Chose "Samsung SSD 970 Pro 512GB - 476.9 GiB (/dev/nvme0n1) from drop-down menu:
Edit /dev/nvme0n1p1, but I can’t select a mount point (which is probably ok),
but it shows as grayed out ext4???

So I reformat it from within the installer, keep it unformatted and make sure that the “bios-grub”-flag
is set.

But in this way, I can’t select a mount point, so I format it with ext2,
set mount point /boot
(and now I can also chose for the “Install boot loader on” drop down-menu
between

  • Master Boot Record of Samsung SSD 970 Pro 512 GB (/dev/nvme0n1)
  • Boot partition (/boot)
  • Do not install a boot loader

I chose the /boot partition

I do “next”, and enter my credentials, and do “next” and it shows a summary:

I do “Install” and confirm.

Installation process starts.

And crashes with an error message about grub-install:

/dev/nvme0n1p1 is now mounted under /tmp/calamares-root-611w276r/boot:

pureos@pureos:~$ df

Filesystem 1K-blocks Used Available Use% Mounted on
udev 16404352 0 16404352 0% /dev
tmpfs 3285516 9684 3275832 1% /run
/dev/sda 1445360 1445360 0 100% /cdrom
/dev/loop0 1396224 1396224 0 100% /rofs
/cow 16427560 1535708 14891852 10% /
tmpfs 16427560 0 16427560 0% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 16427560 0 16427560 0% /sys/fs/cgroup
tmpfs 16427560 4239724 12187836 26% /tmp
tmpfs 3285512 7308 3278204 1% /run/user/999
/dev/nvme0n1p1 495844 63301 406943 14% /tmp/calamares-root-611w276r/boot
tmpfs 16427560 0 16427560 0% /tmp/calamares-root-611w276r/run

I reformat the partition /dev/nvme0n1p1 (after unmounting) with gparted

And restart the installer.
(I can assign a mountpoint /boot to /dev/nvme0n1p1, and chose again to install
the bootloader into /boot)

=> Same result!

I do again, but this time install bootloader on the Master Boot Record of Samsung Disk.

=> same result

I try again! This time I do not install a boot-loader, and I get a different error message:

“PureOS has not been installed on your computer.
The error message was: Failed to unpack image
“/cdrom/casper/filesystem.squashfs”.”

On the “Error”-window, it says also “rsync failed with error code 11”

So this is how far I got. Anyone has some ideas? Is this a problem of the installer, grub, or maybe even the BIOS?

looks like this still isn’t fixed in the calamares installer: https://github.com/calamares/calamares/issues/1564