You are not logged in.

#1 2019-01-25 15:17:40

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Can't boot with /boot entry in fstab.

So first a little background. I just freshly installed Arch on my laptop. I followed the Installation Guide and the dm-crypt guide for installing a fully encrypted system (including boot).
Here is the general idea of the partitions:

Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Samsung SSD 850 
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: 03BE1D8F-28B7-D348-B942-B00D8218F579

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1050623   1048576  512M EFI System
/dev/sda2  1050624   3147775   2097152    1G Linux filesystem
/dev/sda3  3147776 500118158 496970383  237G Linux LVM


Disk /dev/mapper/cryptlvm: 237 GiB, 254446738944 bytes, 496966287 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/ArchVG-swap: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/ArchVG-root: 221 GiB, 237263388672 bytes, 463405056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Here is my actual partition scheme :

NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                 8:0    0 238.5G  0 disk  
├─sda1              8:1    0   512M  0 part  /boot/efi
├─sda2              8:2    0     1G  0 part  
└─sda3              8:3    0   237G  0 part  
  └─cryptlvm      254:0    0   237G  0 crypt 
    ├─ArchVG-swap 254:1    0    16G  0 lvm   [SWAP]
    └─ArchVG-root 254:2    0   221G  0 lvm   /

Here is my fstab :

# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mapper/ArchVG-root
UUID=3e132c6c-56e5-4e57-a137-4688e0526390	/         	ext4      	rw,relatime	0 1

# /dev/mapper/cryptboot
UUID=b63e7af6-46f4-43e0-bf8e-c55f7314dfe3	/boot     	ext4      	rw,relatime	0 2

# /dev/sda1
UUID=F558-275B      	/boot/efi 	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/mapper/ArchVG-swap
UUID=3bd33a72-919d-4280-9b1c-4d071b267bfc	none      	swap      	defaults,pri=-2	0 0

After entering the password twice, once for grub unlocking the /boot and other for /, I get an error "Waiting for /dev/disk/by-uuid/.... dependencies missing the (partitions)" and I am dropped to emergency shell. But when I remove the /boot entry in fstab, I can successfully boot but without a kernel image and /boot mounted which is weird in itself.
And then some apps report missing kernel image

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux'
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux'

Offline

#2 2019-01-25 15:45:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,667

Re: Can't boot with /boot entry in fstab.

lsblk -f

?

Offline

#3 2019-01-25 15:59:07

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

seth wrote:
lsblk -f

?

lsblk -f                                                                                                                                                                            
NAME              FSTYPE      LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                       
├─sda1            vfat              F558-275B                               510.8M     0% /boot/efi
├─sda2            crypto_LUKS       10227de9-b2d3-4ccc-82e0-ceb5353b2d8b                  
└─sda3            crypto_LUKS       295d538a-4368-4691-b2db-d1b08aa97020                  
  └─cryptlvm      LVM2_member       uOMWGS-sx9n-9n9e-yHAK-xVIB-hDSG-Vk4fyQ                
    ├─ArchVG-swap swap              3bd33a72-919d-4280-9b1c-4d071b267bfc                  [SWAP]
    └─ArchVG-root ext4              3e132c6c-56e5-4e57-a137-4688e0526390    200.4G     2% /

Offline

#4 2019-01-25 16:33:16

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,715

Re: Can't boot with /boot entry in fstab.

As a sanity check, what are the output of ls -ld /boot    ?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2019-01-25 16:44:17

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

ewaller wrote:

As a sanity check, what are the output of ls -ld /boot    ?

ls -ld /boot                                                                                 
drwxr-xr-x 3 root root 4096 Jan 25 08:17 /boot

Offline

#6 2019-01-25 16:46:32

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,667

Re: Can't boot with /boot entry in fstab.

Can you mount them later when passing "noauto" to the options for /boot and /boot/efi?

Offline

#7 2019-01-25 16:48:53

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

seth wrote:

Can you mount them later when passing "noauto" to the options for /boot and /boot/efi?

I can mount successfully after booting.

sudo cryptsetup open /dev/sda2 cryptboot                                                  [4]
Enter passphrase for /dev/sda2: 
No key available with this passphrase.
Enter passphrase for /dev/sda2: 
~ >>> sudo mount /dev/mapper/cryptboot /boot 

How do I mount with noauto option ? I still can't understand that if /boot is  not accessible, how the heck does system boots without kernel image ?

Last edited by arifcatalyst (2019-01-25 16:50:06)

Offline

#8 2019-01-25 16:57:25

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,715

Re: Can't boot with /boot entry in fstab.

The kernel is stored on the boot volume (edit: and is loaded by the boot loader).   The kernel is not needed on the root file system at all.  But, when you update the kernel, the boot volume has to be mounted on the file system so that the kernel can be updated on that boot volume.  A common mistake is to update the kernel with the boot volume not mounted.  The kernel is placed in the directory /boot of the root file system, but the original kernel remains on the boot volume.  In this case, the kernel modules are updated and the old kernel modules removed.  The next time the system boots, the old kernel is still on the boot volume and is loaded.  The root file system is mounted, but the required kernel modules no longer exist in /lib.  Meanwhile, the unloved new kerel exists in the /boot directory -- the directory that should be the mount point for the boot volume.


Edit:  BTW, that /boot listing is sane.  Thanks.

Last edited by ewaller (2019-01-25 16:59:02)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#9 2019-01-25 17:03:33

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

ewaller wrote:

The kernel is stored on the boot volume (edit: and is loaded by the boot loader).   The kernel is not needed on the root file system at all.  But, when you update the kernel, the boot volume has to be mounted on the file system so that the kernel can be updated on that boot volume.  A common mistake is to update the kernel with the boot volume not mounted.  The kernel is placed in the directory /boot of the root file system, but the original kernel remains on the boot volume.  In this case, the kernel modules are updated and the old kernel modules removed.  The next time the system boots, the old kernel is still on the boot volume and is loaded.  The root file system is mounted, but the required kernel modules no longer exist in /lib.  Meanwhile, the unloved new kerel exists in the /boot directory -- the directory that should be the mount point for the boot volume.


Edit:  BTW, that /boot listing is sane.  Thanks.

But the boot volume(partition is what I understand by Volume) is encrypted here so it can't load the boot loader.

Edit: My understanding of mount is that a partition is simply made accessible on a sub-tree of root tree and all the files in a volume or partition is there. So, with that understanding, I can't figure out how does the boot loader accesses the kernel in the first place itself when it's encrypted ?

Last edited by arifcatalyst (2019-01-25 17:10:28)

Offline

#10 2019-01-25 17:42:01

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,667

Re: Can't boot with /boot entry in fstab.

The bootloader decrypts the boot partition and loads the kernel.
The mount fails later, when the kernel itself attempts to access the device.

Prepend "noauto," to "rw,relatime…": "noauto,rw,relatime…" for the /boot and /boot/efi entries.
They should not be accessed during the boot.
Then attempt to simply "mount /boot" and see what fails - and whether /dev/mapper/cryptboot exists after the boot.

I assume you went for https://aur.archlinux.org/packages/cryptboot/ ?
It doesn't seem to provide hooks for auto-opening the boot device

Notice that you do NOT need to mount the boot partition at all* and actually that's a security risk - *the only  time when you really need to mount the boot/efi partitions is when you update the bootloader, kernel and/or initramfs.

Offline

#11 2019-01-25 17:48:34

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

I am not using cryptboot now but planning to do so after I sort out this.

Then attempt to simply "mount /boot" and see what fails - and whether /dev/mapper/cryptboot exists after the boot.

Do I need to mount manually every time I need to update the boot loader or kernel ?

Offline

#12 2019-01-25 17:53:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,667

Re: Can't boot with /boot entry in fstab.

Unless you automatize it.
From what I can infer from post #7, nothing opens the device during the boot process, thus it can oc. not be mounted and most likely this will still fail after the boot process (before you opened the device)

Offline

#13 2019-01-25 17:58:21

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

seth wrote:

Unless you automatize it.
From what I can infer from post #7, nothing opens the device during the boot process, thus it can oc. not be mounted and most likely this will still fail after the boot process (before you opened the device)

Ok, I made the changes in fstab with noauto option in /efi and /boot and I can boot successfully after it bit still the boot volume is still not mounted in /.

Offline

#14 2019-01-25 18:43:37

ua4000
Member
Registered: 2015-10-14
Posts: 566

Re: Can't boot with /boot entry in fstab.

Your fstab contains a UUID=b63e7af6... for /boot, but this UUID is not listed in the lsblk output.

Offline

#15 2019-01-25 18:45:34

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

Maybe that's because , it's a LVM container and the volume inside have a different UUID.

Offline

#16 2019-01-25 18:48:17

ua4000
Member
Registered: 2015-10-14
Posts: 566

Re: Can't boot with /boot entry in fstab.

inside LVM, you mean sda3 ?
In your Post #7 you are mounting sda2 as boot.

Edit:
please open your encrypted boot, and run lsblk -f again

Last edited by ua4000 (2019-01-25 18:54:42)

Offline

#17 2019-01-25 18:54:56

loqs
Member
Registered: 2014-03-06
Posts: 19,104

Re: Can't boot with /boot entry in fstab.

Before you manually use cryptsetup what is the contents of /dev/mapper ?

Offline

#18 2019-01-25 18:56:18

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

ua4000 wrote:

inside LVM, you mean sda3 ?
In your Post #7 you are mounting sda2 as boot.

Edit:
please open your encrypted boot, and run lsblk -f again

lsblk -f                                                                                     
NAME          FSTYPE    LABEL       UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                       
├─sda1        vfat                  F558-275B                                             
├─sda2        crypto_LU             10227de9-b2d3-4ccc-82e0-ceb5353b2d8b                  
│ └─cryptboot ext4                  b63e7af6-46f4-43e0-bf8e-c55f7314dfe3    844.4M     8% /boot
└─sda3        crypto_LU             295d538a-4368-4691-b2db-d1b08aa97020                  
  └─cryptlvm  LVM2_memb             uOMWGS-sx9n-9n9e-yHAK-xVIB-hDSG-Vk4fyQ                
    ├─ArchVG-swap
    │         swap                  3bd33a72-919d-4280-9b1c-4d071b267bfc                  [SWAP]
    └─ArchVG-root

Offline

#19 2019-01-25 18:57:30

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

loqs wrote:

Before you manually use cryptsetup what is the contents of /dev/mapper ?

I can't follow you.

Offline

#20 2019-01-25 18:58:51

loqs
Member
Registered: 2014-03-06
Posts: 19,104

Re: Can't boot with /boot entry in fstab.

After you boot before using cryptsetup what is the output of `ls /dev/mapper` ?

Offline

#21 2019-01-25 19:06:11

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

loqs wrote:

After you boot before using cryptsetup what is the output of `ls /dev/mapper` ?

ls /dev/mapper                                                                               
ArchVG-root  ArchVG-swap  control  cryptlvm

Offline

#22 2019-01-25 19:08:15

loqs
Member
Registered: 2014-03-06
Posts: 19,104

Re: Can't boot with /boot entry in fstab.

You do not have an entry in /etc/crypttab for cryptboot so /dev/mapper/cryptboot is not created so /boot can not be mounted.

Last edited by loqs (2019-01-25 19:08:52)

Offline

#23 2019-01-25 19:17:22

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

loqs wrote:

You do not have an entry in /etc/crypttab for cryptboot so /dev/mapper/cryptboot is not created so /boot can not be mounted.

sudo cat /etc/crypttab                                                                       
# Configuration for encrypted block devices.
# See crypttab(5) for details.

# NOTE: Do not list your root (/) partition here, it must be set up
#       beforehand by the initramfs (/etc/mkinitcpio.conf).

# <name>       <device>                                     <password>              <options>
# home         UUID=b8ad5c18-f445-495d-9095-c9ec4f9d2f37    /etc/mypassword1
# data1        /dev/sda3                                    /etc/mypassword2
# data2        /dev/sda5                                    /etc/cryptfs.key
# swap         /dev/sdx4                                    /dev/urandom            swap,cipher=aes-cbc-essiv:sha256,size=256
# vol          /dev/sdb7                                    none

I thought it's read by fstab.

Offline

#24 2019-01-25 19:24:27

loqs
Member
Registered: 2014-03-06
Posts: 19,104

Re: Can't boot with /boot entry in fstab.

fstab is for filesystems.  crypttab is for encrypted volume.  The contents is not shared or read by each other.  Something needs to open the luks volume before the entry for /boot in fstab can be used.
/etc/crypttab is one mechanism the encryt/sd-encrypt hook is another,  currently you are doing it manually with cryptsetup.

Offline

#25 2019-01-25 19:30:49

arifcatalyst
Member
Registered: 2018-05-29
Posts: 57

Re: Can't boot with /boot entry in fstab.

I am confused, what changes do I make ? Do I make all the encrypted container like sda2,sda3 entry in /etc/cryptab ?

Offline

Board footer

Powered by FluxBB