Installing on M.2 drive- root partition not mounted at boot

2 posts / 0 new
Last post
#1 Sat, 2016-01-30 17:43
kzauser420
  • kzauser420's picture
  • Offline
  • Last seen: 4 months 6 days ago
  • Joined: 2016-01-30

Hi,

I'm trying to install Alpine on a desktop - following specs:
a) M.2 SSD drive (Samsung 950 Pro 512GB) - NVME
b) Gigabyte GA-Z170M-D3H Intel Z170 motherboard.

More info:
(*) Version: alpine-xen-3.3.1-x86_64.iso (want to use the desktop for creating VM on Xen)
(*) The iso is copied to a USB key (using dd) and am able to boot the desktop with this USB drive.
(*) Upon booting the NVME drive is detected as /dev/nvme0n1.
(*) The disk is set-up as with GPT.
(*) I run 'setup-alpine' after boot up and choose 'none for disk.

(*) Then, following the instructions from: [url]http://wiki.alpinelinux.org/wiki/Setting_up_LVM_on_GPT-labeled_disks [/url], to creat the necessary partitions:

    nvme0n1p1 (256 MB with ext4 for boot)
    nvme0n1p2 - PV
    [indent]vg0 VG
    alpine_root (8G w/ ext4 LV)
    alpine_swap (4G w/ mkswap LV) [/indent]
then complete the rest of instructions on the aforementioned URL.

Problem


On rebooting; I get the following error:
[ui]mount: mounting /dev/vg0/alpine_root on /sysroot failed: No such file or directory
Mouting root failed
initramfs emergency recovery shell launched. [/ui].

I try to run the following in the recovery shell:
lvm vgchange -ay
lvm lvdisplay
mount -t ext4 /dev/vg0/alpine_root /sysroot
mount: mounting /dev/vg0/alpine_root on /sysroot failed: No such device

If it is of any value; the kernel boot parameters are (from dmesg):
kernel command line: root=/dev/vg0/alpine_root modules=sd-mod,usb-storage,ext4 nomodeset quiet .

Appreciate any guidance on how to resolve this and boot the desktop

Many thanks.
Kz.

Tue, 2016-02-02 21:08
kzauser420
  • kzauser420's picture
  • Offline
  • Last seen: 4 months 6 days ago
  • Joined: 2016-01-30

Here is the solution to my own problem - with many thanks to N Copa for the guidance:
short version....
The problem was that the kernel couldn't understand the NVME partition as it did not have the right module. Thus, the solution was to add nvme.ko to the initramfs.

long version....
As Alpine was already installed on the NVME device - here are the steps I followed to fix the not-booting problem:

  • Boot from alpine USB stick.
  • Start dhcp networking for eth0 - the machine is connected to a device capable of giving IP addresses etc - i.e. can access Internet from the machine
  • added the UK repository (as I'm based in GB - vi /etc/apk/repostiories add line http://liskamm.alpinelinux.uk/v3.3/main
  • apk update & upgrade
  • apk add lvm2
  • run vgchange -ay
  • mount -t ext4 /dev/vg0/alpine_root /mnt
  • mount -t ext4 /dev/nvme0n1p2 /mnt/boot
  • vi /mnt/etc/fstab -- add entry: /dev/vg0/alpine_swap swap sw 0 0 ... this is to get the swap working (had not done this during the install process)
  • apk add --root=/mnt --initdb mkinitfs this adds mkinitfs tool to the installed OS and NOT the currently in RAM running alpine
  • cd /mnt/etc/mkinitfs/features.d/
  • vi nvme.modules this will be a new file --- add line kernel/driver/block/nvme* -- OK ...this is the key part - it tells that the new initramfs
  • vi /mnt/etc/mkinitfs/mkinitfs.conf - need to add nvme to the feature list .... wasn't sure of what other features to keep etc.. so ended up with these features : 'ata base ext4 keymap kms mmc raid ide scsi usb virtio ext4 lvm nvme'
  • Now to run mkinitfs - but on the installed OS
  • mount -o bind /proc /mnt/proc
  • mount -o bind /dev /mnt/dev
  • mount -o bind /dev/pts /mnt/dev/pts
  • mount -o bind /sys /mnt/sys
  • chroot /mnt /bin/bash
  • mkinitfs -f /etc/fstab
  • exit
  • umount /media/newroot/boot
  • umount /media/newroot/dev/pts
  • umount /media/newroot/dev
  • umount /media/newroot/proc
  • umount /media/newroot/sys
  • umount /media/newroot/

PS:
(A) as lvm2 & mkinitfs are available in the USB (i.e. the local repository) - connection to Internet is not mandatory ... as I was in debug mode; I didn't want to take chances with any stale packages.
(B) To check if the new initramfs has the nvme module - do the following:
before unmounting the nvme partitions
mkdir /tmp/blowup note this is the tmp for in RAM OS
cp /mnt/boot/initramfs-grsec /tmp/blowup/initramfs-grsec.gz
cd /tmp/blowup
gunzip initramfs-grsec.gz
cpio -ivF initramfs.grsec this expands the initram file system in the current dir
cd ./lib/modules/4.1.15-2-grsec/kernel/drivers/block within the tmp/blowup dir ... the kernel version matching that of the running kernel in Alpine v3.3
ls -l
voila the dir has nvme.ko

Log in or register to post comments