The officially official Devuan Forum!

You are not logged in.

#1 Re: Installation » How to install Devuan in BTRFS partition with subvolumes @ and @home ? » 2020-01-20 18:34:18

unfortunately thus far with the refractainstaller it seems like something GRUB-related is not working as it is not opening the encrypted partition and finding the initramfs even though it accesses the encrypted /boot (details https://dev1galaxy.org/viewtopic.php?pid=19493#p19493).

just to update this thread: i was able to get Devuan installed to my existing encrypted partition with Btrfs subvolumes, details in my thread https://dev1galaxy.org/viewtopic.php?pid=19578#p19578.  thanks again for the help here.

peace, w

#2 Re: Installation » [solved] install to existing encrypted Btrfs subvolumes » 2020-01-20 18:14:00

for visitors from the future:

i was able to solve this with the help of fsmithred (thanks!) and a good amount of trial & error.  the details are in the above posts but to summarize there are 2 ways that we tried to install Devuan ASCII 2.1 to existing Btrfs subvolumes.  for both cases in another shell/vt the encrypted partition must be opened first with cryptsetup and the Btrfs subvolume(s) then mounted before starting the installation.

  • with the netinst/Debian installer: set the Btrfs default subvolume to be the desired one on which to install /, perform the installation to the Btrfs partition, then copy /home, etc. to their desired subvolumes after installation

  • with the live/refractainstaller from the command line: edit the refractainstaller script to add the correct --options subvol= to the mount commands for the / and /home partitions, which are given as the /dev/mapper/XXXX

in both cases after the installation is completed some additional steps need to be performed in a chroot, preferably before rebooting:

  • apt update && apt upgrade

  • edit /etc/fstab and /etc/crypttab appropriately for the subvolumes

  • set CRYPTSETUP=y in /etc/cryptsetup-initramfs/conf-hook

  • if using encryption and the installer did not take care of it, set GRUB_ENABLE_CRYPTODISK=y and  GRUB_CMDLINE_LINUX_DEFAULT= in /etc/default/grub

  • update-grub

  • updateinitramfs

there may be some small steps that i missed but the details are in the above threads.  i ended using the refractainstaller as the steps were all laid out in the script that is well documented and easy to follow, making it simple to perform the above mentioned edits.  good luck!

#3 Re: Installation » How to install Devuan in BTRFS partition with subvolumes @ and @home ? » 2020-01-15 05:21:57

Head_on_a_Stick wrote:

Yes, I use this method to create a full backup then reverse the process when the subvolumes are created and mounted as desired.

thanks, handy method, nice and simple.

Head_on_a_Stick wrote:
waynedpj wrote:

and i assume then update fstab, cryptab, and GRUB?

I don't use encryption[1] so just the fstab and bootloader need correcting. I use a custom grub.cfg but grub-mkconfig can deal with subvolumes and appears to create a working configuration file.

unfortunately thus far with the refractainstaller it seems like something GRUB-related is not working as it is not opening the encrypted partition and finding the initramfs even though it accesses the encrypted /boot (details https://dev1galaxy.org/viewtopic.php?pid=19493#p19493).

Head_on_a_Stick wrote:

[1] I don't keep anything important on computers and in my country (the UK) I can go to jail if the Police want to see what's on it and I can't remember the password.

i imagine that unfortunately this can happen in pretty much any country no matter what the law says wink

thanks again, w

#4 Re: Installation » [solved] install to existing encrypted Btrfs subvolumes » 2020-01-15 02:40:07

fsmithred wrote:

HA! I got it to boot. It was dropping me to initramfs prompt and complaining about a missing UUID.  That was after about a hundred lines of looking for the floppy and looking for a raid array (neither of which exist).

way to go!  unfortunately after doing the same edits as you described above with the live refractainstaller i find myself in a similar position: i enter the encryption password to GRUB (my /boot is in the encrypted Btrfs partition) and can start booting.  however after the line "loading the initial ramdisk" i get tons of the following messages mdadm: No arrays found in config file or automatically then Gave up waiting for root file system device before finally dropping me to an initramfs prompt like you, complaining about the UUID not existing.

strangely enough the first time that i booted the fresh install and this occurred, in the initramfs shell i was able to use cryptsetup to open the LUKS partition, then exit and the shell and continue booting.  however on every consecutive reboot since then the cryptsetup command is no longer available in the initramfs shell thus i cannot get any further?!  the one time that i was able to use cryptsetup and continue booting, while i could not log in via slim i did run an apt upgrade in a terminal, perhaps that removed cryptsetup somehow?  or maybe this points to the problem: the crypt stuff is not getting loaded during boot and thus the initramfs cannot be found in the unopened encrypted partition.  however i see the crypt insmod in the GRUB config.

fsmithred wrote:

So, at the boot menu, I edited the entry to remove that uuid and changed it to
root=/dev/mapper/sda3_crypt
And it still dropped me to the initramfs prompt. So I manually opened the volume with cryptsetup, was asked for the password, then I ran exec /sbin/init and it booted.

i tried your fix by changing the root= kernel command line argument to use the /dev/mapper/storage value but ended up with the same thing i.e. stuck in the initramfs shell with no cryptsetup.

at this point i feel like i have hit a dead end.  i may try the netinst method to see if at least that gives me a booting system, though the refractainstaller is refreshingly simple and straightforward.

thanks as always, let me know if you make any progress.

peace, w

#5 Re: Installation » [solved] install to existing encrypted Btrfs subvolumes » 2020-01-14 19:48:32

fsmithred wrote:

Yup. netinst = installer iso (one of them, anyway) = regular installer = debian-installer (the actual package name)

thanks for clearing that up!

fsmithred wrote:

refractainstaller run in a root terminal (the live installer) won't show you the btrfs volumes. I manually opened the encrypted volume, and when the installer asked for the root partition and the home partition, I entered the /dev/mapper path for the opened luks volume.

OK so basically you set $install_dev and $home_dev to the same /dev/mapper/storage device that you opened with cryptsetup?

fsmithred wrote:

You'll get a warning that the partition doesn't end with a digit (unless you named it that way) but you can still proceed. I had to edit the mount commands for / and /home inside refractainstaller to add the subvolid option,

do you mean the mount commands for $install_part and $home_part?  was this the only change that you had to make in the script?  would these changes make the GRUB installation not work?

fsmithred wrote:

and I also had to manually edit fstab on /target. (subvolume path should work here instead of subvolid.)

can you explain what and when exactly you did this fstab edit?  after installation but before rebooting?

fsmithred wrote:

Yes, if you can get the installer (on the netinst iso) to install to the root subvolume, you should be able to copy /home/* to the second subvolume. I've done the equivalent with encrypted or non-encrypted ext partitions many times.

i prefer the command line and having the source right there so the refractainstaller seems like the way to go for me.  however given that you are having problems getting a booting setup perhaps it is better if i use the debian-installer and just do the default subvolume trick, as hopefully netinst will get the GRUB config correct.  any advice?

regardless thanks again.

peace, w

#6 Re: Installation » [solved] install to existing encrypted Btrfs subvolumes » 2020-01-13 17:14:51

fsmithred wrote:

When you get to the partitioning phase in the installer, if your subvolumes are listed, you should be able to highlight one, press enter, and get to a screen that shows options for that parititon - use as (filesystem type), format, mountpoint, etc. If you highlight a line and press enter, you can edit that line. For the format line, pressing enter will toggle yes/no.

When you're at the screen that lists your partitions, there may be an upper-case F or K on each line. F means the partition will be formatted, K means keep the current filesystem (don't format).

i assume that you mean netinst by "installer" and "regular installer"?  i tried what you said with netinst expert mode:

  • in the "Partition disks" step at first i only saw the sda3 LUKS1 encrypted partition (the Btrfs partition is inside the encrypted container)

  • i was able to open the encrypted /sda3 in a separate shell using cryptsetup (after doing something (maybe selecting "Configure encrypted volumes"?) that made the cryptsetup command available in the shell, as it initially was not?)

  • at that point after exiting and re-entering the "Partition disks" step i now see the Btrfs partition under a new heading "Encrypted volume".  and while i can select it for installation without formatting, unfortunately i still cannot see/select the subvolumes as installation targets.  in addition i could not add the mount options for selecting the subvolume

this is an improvement as maybe i can just set the root subvolume as the default subvolume for this Btrfs partition which would install the system at least to a single subvolume. then copy over home afterwards?  however, it still would be nice to have the installer set up correctly the fstab, cryptab, and GRUB paths.

  just in case i also tried with the desktop-live installer i.e. refractainstaller but could not find a way to even see unlocked Btrfs partition (again in a separate shell via cryptsetup) as above.  maybe because you most likely meant the netinst in the first place smile

fsmithred wrote:

I got it to install with the live installer if I do a lot of manual fiddling with it. But I can't get it to boot, even with a separate /boot partition.

thanks for testing this out.  i have set up full disk encryption (i.e. with encrypted /boot) with a single encrypted partition containing Btrfs and subvolumes with other distros using GRUB (LUKS1 only).  one thing that always got me was that GRUB does not understand Btrfs subvolumes so you need to use the full paths to each subvolume in the config.  maybe that is tripping you up?

  OK, let me know if you have any other ideas and thanks again!

peace, w

#7 Re: Installation » How to install Devuan in BTRFS partition with subvolumes @ and @home ? » 2020-01-13 15:39:16

Head_on_a_Stick wrote:
waynedpj wrote:

unfortunately in this HDD i do not have any extra partitions to which i can do a temp install.  though can we install to an external USB partition?

Install to the HDD and use the USB to hold the backup, that's what I do.

thanks again, maybe i will end up having to do this if neither installer can be made to work with Btrfs subvolumes.  so you just rsync everything from / and /home to the respective subvolumes?  and i assume then update fstab, cryptab, and GRUB?

thanks, w

#8 Re: Installation » [solved] install to existing encrypted Btrfs subvolumes » 2020-01-13 03:50:03

adding some more info here after discussion on IRC regarding the existing Btrfs subvolumes to which i am trying to install Devuan:

  • the btrfs mount commands:

    mount -o subvol=/shares/home /dev/mapper/storage /mnt/home/
    mount -o subvol=/systems/Devuan/root /dev/mapper/storage /mnt/Devuan/root/
  • output of mount with Btrfs subvolumes mounted:

    root@devuan:~# mount
    sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
    proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
    udev on /dev type devtmpfs (rw,nosuid,relatime,size=1978076k,nr_inodes=494519,mode=755)
    devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
    tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=399652k,mode=755)
    /dev/shm on /lib/live/mount/medium type tmpfs (rw,relatime,size=1084164k)
    /dev/loop0 on /lib/live/mount/rootfs/filesystem.squashfs type squashfs (ro,noatime)
    tmpfs on /lib/live/mount/overlay type tmpfs (rw,relatime)
    overlay on / type overlay (rw,noatime,lowerdir=//filesystem.squashfs/,upperdir=/live/overlay//rw,workdir=/live/overlay//work)
    tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
    pstore on /sys/fs/pstore type pstore (rw,relatime)
    tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=799300k)
    tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)
    rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
    tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,mode=755)
    cgroup on /sys/fs/cgroup/elogind type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/elogind/elogind-cgroups-agent,name=elogind)
    tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=399648k,mode=700,uid=1000,gid=1000)
    /dev/mapper/storage on /mnt/home type btrfs (rw,relatime,space_cache,subvolid=257,subvol=/shares/home)
    /dev/mapper/storage on /mnt/Devuan/root type btrfs (rw,relatime,space_cache,subvolid=259,subvol=/systems/Devuan/root)

#9 Re: Installation » How to install Devuan in BTRFS partition with subvolumes @ and @home ? » 2020-01-12 04:23:17

Head_on_a_Stick wrote:

I just install a standard system, back it up then create the subvolume layout as desired and rsync the backup to the new layout.

The fstab and bootloader need correcting afterwards but it works:

empty@E485:~ $ grep '/ ' /proc/self/mounts                                               
/dev/nvme0n1p3 / btrfs rw,relatime,ssd,space_cache,subvolid=257,subvol=/debian 0 0
empty@E485:~ $

thank you, i was considering this too.  however unfortunately in this HDD i do not have any extra partitions to which i can do a temp install.  though can we install to an external USB partition?

also i am still hoping for something a little less convoluted wink

thanks again, w

#10 Re: Installation » How to install Devuan in BTRFS partition with subvolumes @ and @home ? » 2020-01-11 16:11:07

ahoy specing,

  thanks for the detailed tutorial on getting Btrfs+subvolumes installed.  i am trying to use an existing Btrfs partition and subvolumes (described in more detail here https://dev1galaxy.org/viewtopic.php?pid=19401#p19401) but am having problems with the step

Choose expert install, proceed up to and including partitioning. Finish partitioning normally, choosing luks,lvm,btrfs or whatever.

when i get to the partitioning step in the netinst expert mode installer, i cannot find a way to select a root partition that allows that step to complete without (seemingly) the installer overwriting my Btrfs partition.  my disk only has 2 partitions:

/dev/sda1    GRUB BIOS boot partition (for booting GPT disk with BIOS)
/dev/sda2    LUKS1 dm encrypted Btrfs partition (remainder of disk)

  thus has something changed in the latest installer for ASCII stable 2.1 that changes your instructions?  or am i missing some simple step implied in your tutorial (this is my first experience with the Debian/Devuan installer)?

thanks again for your help, w

#11 Installation » [solved] install to existing encrypted Btrfs subvolumes » 2020-01-11 16:01:32

waynedpj
Replies: 13

ahoy all,

  first, thanks for the freedom options, init and otherwise.  i have been looking to get away from systemd and friends, find something more simple and minimal, so excited to finally give Devuan a go.

  i am trying to install Devuan to a HDD drive with an existing partition scheme based on Btrfs and subvolumes:

/dev/sda1    GRUB BIOS boot partition (for booting GPT disk with BIOS)
/dev/sda2    LUKS1 dm encrypted Btrfs partition (remainder of disk)

within the sda2 Btrfs partition there are 2 subvolumes that i would like to use for the Devuan root / and /home mounts:

/      ->    /systems/Devuan/root/
/home/ ->    /shares/home

thus in the installer i do not need to partition anything as i prepare it all ahead of time with parted, all subvolumes empty.

  and while it seems that the Debian/Devuan installers do not directly support installing to Btrfs subvolumes https://aykevl.nl/2015/11/debian-btrfs-subvolume, https://wiki.debian.org/Btrfs#Status, i  have found a post in this forum that basically tricks the installer into using the subvolumes after playing with the /target mount created after partitioning but before installation begins: https://dev1galaxy.org/viewtopic.php?pid=14462#p14462.

  however using the method described in the above post with expert mode netinst i cannot get past the partitioning step since the installer wants a root partition: after the installer starts in a separate shell i unlock the LUKS1 encrypted partition and mount the Btrfs subvolumes for / and /home.  but in the installer partitioning step i cannot find a way to say "hey, use this partition for /" without it seemingly ready to reformat sda2, overwriting the LUKS1 header, Btrfs, etc.  thus the /target mount is not created.

  there most likely is a step i am missing but after a good deal of research i cannot figure it out, thus any help appreciated.  or perhaps someone else has  another updated method for this type of installation with Devuan and Btrfs subvolumes?

thanks, w

Board footer

Forum Software