Issues mounting in order to chroot into encrypted partition

inxi -Fxzc0 output

In trying to solve a different issue where I cannot boot, I need to chroot into my existing Manjaro partition from a live USB. My Manjaro install has full-disk encryption which was done with the guided installer. I am following the tutorial here in attempting to chroot into my encrypted partition currently.

I ran the following two commands to view my partitions from the live USB first:

# lsblk -p
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
/dev/loop0    7:0    0  44.8M  1 loop /run/miso/sfs/livefs
/dev/loop1    7:1    0 225.3M  1 loop /run/miso/sfs/mhwdfs
/dev/loop2    7:2    0   770M  1 loop /run/miso/sfs/desktopfs
/dev/loop3    7:3    0 372.7M  1 loop /run/miso/sfs/rootfs
/dev/sda      8:0    0 238.5G  0 disk 
├─/dev/sda1   8:1    0   100M  0 part 
├─/dev/sda2   8:2    0   256M  0 part 
└─/dev/sda3   8:3    0 238.1G  0 part 
/dev/sdb      8:16   1   7.5G  0 disk 
├─/dev/sdb1   8:17   1   1.4G  0 part /run/miso/bootmnt
└─/dev/sdb2   8:18   1     4M  0 part 


[manjaro manjaro]# df
Filesystem      Size  Used Avail Use% Mounted on
dev             7.8G     0  7.8G   0% /dev
run             7.8G   92M  7.8G   2% /run
/dev/sdb1       1.5G  1.5G     0 100% /run/miso/bootmnt
cowspace        256M     0  256M   0% /run/miso/cowspace
overlay_root     12G   13M   12G   1% /run/miso/overlay_root
/dev/loop0       45M   45M     0 100% /run/miso/sfs/livefs
/dev/loop1      226M  226M     0 100% /run/miso/sfs/mhwdfs
/dev/loop2      771M  771M     0 100% /run/miso/sfs/desktopfs
/dev/loop3      373M  373M     0 100% /run/miso/sfs/rootfs
overlay          12G   13M   12G   1% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
tmpfs           7.8G  8.0K  7.8G   1% /tmp
tmpfs           7.8G  1.5M  7.8G   1% /etc/pacman.d/gnupg
tmpfs           1.6G   16K  1.6G   1% /run/user/1000

I also received the following from gparted (truncated):

Partition     Name              File System
/dev/sda1     UEFI_SYSTEM       fat32
/dev/sda2     MANJARO_BOOT      ext2
/dev/sda3     MANJARO_LVM       [Encrypted]

In following the tutorial, I ran # cryptsetup open --type luks /dev/sda3 root, which prompted me for a passphrase which I then entered correctly.
I then followed the next step and entered # mount /dev/mapper/root /mnt however this returned the following message which is preventing me from continuing the chroot process:

mount: unknown filesystem type 'LVM2_member'

How can I successfully mount in order to complete the chroot process?

EDIT:

These are the commands that allowed me to successfully chroot:

$ cryptsetup luksOpen /dev/sda3 cryptdisk
$ vgchange -a y
$ mount /dev/mapper/ManjaroVG-ManjaroRoot /mnt
$ mount /dev/sda1 /mnt/boot
$ manjaro-chroot /mnt

Did you setup LUKS on LVM intentionally?

Manually mounting LVM modules is different from mounting normal partitions (ie block devices).

https://wiki.archlinux.org/index.php/LVM#Create_file_systems_and_mount_logical_volumes

Don't use LVM so can't add much more... internet search is probably your friend here.

The guide you are quoting is not for LVM+LUKS but for LUKS only. You first need to know how your partition and volume setup is, otherwise cryptsetup open and the following mount command will not work as needed.
From your old inxi -F

Partition: ID-1: / size: 227G used: 62G (29%) fs: ext4 dev: /dev/dm-1
           ID-2: /boot size: 248M used: 248M (100%) fs: ext2 dev: /dev/sda2
           ID-3: swap-1 size: 8.37GB used: 0.00GB (0%) fs: swap dev: /dev/dm-2

I see a "strange" name /dev/dm-1 for your root device.
I would like you to post /etc/fstab of your encrypted system if possible, because this will give hints how to mount the whole constuction.

I mounted it with cryptsetup luksOpen /dev/sda3 VolGroup00 then vgchange -a y and did as instructed:

[manjaro ~]# cat /run/media/manjaro/ManjaroRoot/etc/fstab 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>                           <mount point>  <type>  <options>  <dump>  <pass>
UUID=704a6ab4-7459-4903-b991-f2c69af97b0e /boot          ext2    defaults,noatime 0       2
UUID=349A-EFB4                            /boot/efi      vfat    defaults,noatime 0       2
UUID=8e2fc722-32a4-4af5-b259-9fcb9f8a81ec /              ext4    defaults,noatime,discard 0       1
UUID=d5300551-4800-4920-a4cf-c40c83866f7d swap           swap    defaults,noatime 0       2
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0       0

Yes, I would have set up LUKS on LVM intentionally and done so via the Manjaro graphical installer. I am using this tutorial and this arch forum post to chroot in LVM on LUKS now and have done the following steps:

[manjaro mapper]# cryptsetup luksOpen /dev/sda3 cryptdisk
[manjaro mapper]# vgchange -a y
[manjaro mapper]# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                         7:0    0  44.8M  1 loop  /run/miso/sfs/livefs
loop1                         7:1    0 225.3M  1 loop  /run/miso/sfs/mhwdfs
loop2                         7:2    0   770M  1 loop  /run/miso/sfs/desktopfs
loop3                         7:3    0 372.7M  1 loop  /run/miso/sfs/rootfs
sda                           8:0    0 238.5G  0 disk  
├─sda1                        8:1    0   100M  0 part  /mnt/boot
├─sda2                        8:2    0   256M  0 part  /mnt/boot
└─sda3                        8:3    0 238.1G  0 part  
  └─cryptdisk               254:0    0 238.1G  0 crypt 
    ├─ManjaroVG-ManjaroRoot 254:1    0 230.3G  0 lvm   /mnt
    └─ManjaroVG-ManjaroSwap 254:2    0   7.8G  0 lvm   
sdb                           8:16   1   7.5G  0 disk  
├─sdb1                        8:17   1   1.4G  0 part  /run/miso/bootmnt
└─sdb2                        8:18   1     4M  0 part  
[manjaro mapper]# ls /dev/mapper/
control  cryptdisk  ManjaroVG-ManjaroRoot  ManjaroVG-ManjaroSwap
[manjaro mapper]# mount /dev/mapper/ManjaroVG-ManjaroRoot /mnt
[manjaro mapper]# mount /dev/sda2 /mnt/boot

I used /dev/sda3 since gparted showed it as MANJARO_LVM (238.13 GiB) and I used /dev/sda2 since gparted showed it as MANJARO_BOOT (256 MiB). Since cryptdisk does not show a Manjaro home partition, only root and swap, then does this suggest that home should not be mounted (maybe I have not encrypted it separately and the person in the tutorial did)? I noticed that gparted showed /dev/sda1 as UEFI_SYSTEM (100 MiB), so I'm guessing that I should not mount this as home due to its small size.

If anyone could confirm that I have mounted correctly, then I will go ahead and run # manjaro-chroot /mnt since I have never done this before and want to ensure I am doing it properly (and not break anything). Thanks for putting up with my newbie questions!

You need to mount where your root is. chroot carrs only for folders not for partitions, volumes etc.

Are you referring to these lines? (also what do you mean by "carrs")

[manjaro mapper]# ls /dev/mapper/
control  cryptdisk  ManjaroVG-ManjaroRoot  ManjaroVG-ManjaroSwap
[manjaro mapper]# mount /dev/mapper/ManjaroVG-ManjaroRoot /mnt

If so, how would I correctly do this? My apologies as I have never done chroot before and don't have much knowledge of navigating my filesystem.

1 Like

The last line seems correct. Next mount the boot partition on /mnt/boot an run manjaro-chroot /mnt.

I did that, as in my previous post with this line:

[manjaro mapper]# mount /dev/sda2 /mnt/boot

then did a manjaro-chroot /mnt and it seemed to mount correctly. However, when I ran the following lines, as instructed by this thread, I got the following error:

sudo pacman-mirrors -f 5 -y
sudo pacman -Syu
sudo mhwd-kernel -i linux44

.
.
.
Packages (5) linux44-4.4.75-1 linux44-bbswitch-0.8-52 linux44-nvidia-1:375.66-5 linux44-rt3562sta-2.4.1.1_r4-20 linux44-virtualbox-host-modules-5.1.22-6

Total Installed Size:  85.62 MiB

:: Proceed with installation? [Y/n] y
(5/5) checking keys in keyring                                                                                     [####################################################################] 100%
(5/5) checking package integrity                                                                                   [####################################################################] 100%
(5/5) loading package files                                                                                        [####################################################################] 100%
(5/5) checking for file conflicts                                                                                  [####################################################################] 100%
(5/5) checking available disk space                                                                                [####################################################################] 100%
error: Partition /boot too full: 17150 blocks needed, 0 blocks free
error: not enough free disk space
error: failed to commit transaction (not enough free disk space)
Errors occurred, no packages were upgraded.

Could this have anything to do with me not chrooting correctly?

Do you have enough disk space in your /boot partition? 256MB might be too little if having too many kernels or a Windows boot sector.

I currently have two kernels installed (linux-rt-manjaro and linux49) and no windows boot sector. The kernel I am using is linux49. I tried opening manjaro-settings-manager from terminal but it would not let me uninstall the linux-rt-manjaro kernel due to an error. I haven't been able to find out how to uninstall that kernel to free up space via terminal so far, is this there a way to do this? (or otherwise expand my /boot partition)

Another guess would be that the boot partition needs to be mounted on /boot/efi. Bingo!! You forgot to mount /dev/sda1 on /mnt/boot/efi after mounting /dev/sda2 on /mnt/boot.

2 Likes

It didn't work when I mounted like so:

[manjaro mapper]# mount /dev/mapper/ManjaroVG-ManjaroRoot /mnt
[manjaro mapper]# mount /dev/sda2 /mnt/boot

However, mounting it like this allowed me to uninstall the unwanted kernel:

[manjaro mapper]# mount /dev/mapper/ManjaroVG-ManjaroRoot /mnt
[manjaro mapper]# mount /dev/sda1 /mnt/boot

It allows me to chroot now, but only one boot partition is mounted. Not sure if I need to mount both boot partitions...

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by