From nobody Fri Mar 29 01:10:57 2024 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 769CC7818B3 for <~alpine/users@lists.alpinelinux.org>; Sun, 17 May 2020 03:24:37 +0000 (UTC) Received: by mail-ot1-f52.google.com with SMTP id w22so5233283otp.5 for <~alpine/users@lists.alpinelinux.org>; Sat, 16 May 2020 20:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bantling-me.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=1TRoOPJj8Z/UysMh0bF6odtnj9loT5FRex5zmBOsfts=; b=mUhTxWlAIqehb+dm+U7/4M+U6DQKpUbjmCIO4SpCVgDn+sR+nwVsj4TeV8nHeV2Yfv Bu2wipWnb0boV/hd3MBg00SHeRvl8rPu1vh47RbhscigsnldA+aaxKF/8AKa6QxOArh0 4bneDsCg7yEbzSSeF/f8ykgzTQcU9kbgPoVEVTb1hRtovMasbhtEBFsUFvkck2Ou+8dW +T5hJG6EE/TRDSx2WrvDUODwdn6o9p95lwhKn1x2zEK61kDdY52/3h5DGP2PS96ODBAx 8ThnQR8poZiVf6dKeHKlx0bqh90ZP/qEjbPOYnFBni7RSqlurLF+ngbpjEiVVDhRzOM9 84VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=1TRoOPJj8Z/UysMh0bF6odtnj9loT5FRex5zmBOsfts=; b=seca+b6HAelU1fqe7r2IxpoeX0nOYEd4zH0zw8aAr/A0m3Jx3N/5HsKn/6W9RWsEfa 5LOCGei1FbUAsd2xRd2MNH/YYp4au3YK/LcSZ45gl8W/7TxzIXCLxp1WQf2qtPpxMFBT 9nkHospfHVXXRaXt8+++MiJS6EprWzu0GI5js33yEDLkx4zYgjt81RhGkG1TK4xP59MK Djp6/uBfOa0KSeRerxRgH0a98leAOkmvMQ39eNxepr7BEXucgGXvvAWa4oyjsbC03Svz ayz05lqvXCtHT5tO+XypqvotD2FkZYwHfRlBW2RAGGOoPqwWQfoJQnCE8tbomtz610D2 eGIQ== X-Gm-Message-State: AOAM532oXyPmBi/AgoHqcFbUEUPsKGLDCjIvQ2H49NyWBZZ2szgFczPY TSM+REhB8x/TgAYOHDdRD0Lnrdlj1HvXxyjC0SNhIOO5Ql16pA== X-Google-Smtp-Source: ABdhPJz2rdUTt8ilg76ZAwRVRN2dY0m6PHtOmDz250uVYJ2nGINq/R5YxCLKcujMo7o9nKo1U3lkuALk5jFh5oWIKVQ= X-Received: by 2002:a9d:7e94:: with SMTP id m20mr2529279otp.148.1589685875617; Sat, 16 May 2020 20:24:35 -0700 (PDT) MIME-Version: 1.0 From: Greg Hall Date: Sun, 17 May 2020 00:24:23 -0300 Message-ID: Subject: ZFS ROOT fails with mount: mounting zroot/ROOT/default on /sysroot failed: No such file or directory To: ~alpine/users@lists.alpinelinux.org Content-Type: multipart/alternative; boundary="000000000000ebc73f05a5cf95db" --000000000000ebc73f05a5cf95db Content-Type: text/plain; charset="UTF-8" I have two scripts for partitioning a hard drive and setting up Alpine Linux 3.11. One script uses GPT with an EFI system partition (doesn't actually install an EFI bootloader, just a BIOS boot loader), and an ext4 root partition. It works perfectly. The second script is a copy of the first, where the only changes are related to ZFS. It works, except for one minor irritating quirk: at boot time, I get the following message: mount: mounting zroot/ROOT/default on /sysroot failed: No such file or directory Mounting root failed. initramfs emergency recovery shell launched. Type 'exit' to continue boot sh: can't access tty; job control turned off I simply type in the following two commands, and it boots up just fine: / # mount -t zfs zroot/ROOT/default /sysroot / # exit I don't know why this manual mounting is necessary. I don't have this problem with ext4. It seems odd to me that I can simply go ahead and mount the exact thing it says doesn't exist - especially since the mount command requires that the zpool has already been imported. After booting up, the /boot/extlinux.conf has the following lines in it: LABEL lts MENU default MENU LABEL Linux lts LINUX vmlinuz-lts INITRD initramfs-lts APPEND ROOT=zpool/ROOT/default modules=sd-mod,usb-storage,zfs quiet The lines of my install script that perform ZFS operations are as follows: ######## # The installation system is a plain old ext4 system installed by using setup-alpine # This is necessary because the boot media can't have ZFS added to it # sda is the ext4 system installed with setup-alpine # sdb is the drive to install zfs to # Modify installation system on sda to ensure it has ZFS and other needed things apk add parted zfs zfs-`uname -r | rev | cut -d- -f 1 | rev` util-linux udev echo zfs > /etc/modules-load.d/zfs.conf modprobe zfs # Partition sdb - I find sgdisk is unreliable at creating device entries, so I use parted # Parted doesn't understand the zfs partition code, so I lie and use ext4 echo 'mklabel gpt mkpart BOOT fat32 2048s 100 set 1 esp on set 1 legacy_boot on mkpart ROOT ext4 100 -100 print ' | parted /dev/sdb # Determine ashift from physical sector size, should be 9 (sector size = 512) or 12 (sector size = 4096) phy_sec="`lsblk -nldo PHY-SEC /dev/sdb`" ashift="0" while [ "$phy_sec" -ne 1 ] do phy_sec=$((phy_sec / 2)) ashift=$((ashift + 1)) done # Create zfs filesystem pool="zroot" vdev="/dev/disk/by-partuuid/`lsblk -nlo PARTUUID /dev/sdb2`" zpool create -f -o ashift=$ashift -O normalization=formD -m none $pool $vdev zfs create -o mountpoint=none -o canmount=off $pool/ROOT zfs create -o mountpoint=legacy $pool/ROOT/default zpool set bootfs=$pool/ROOT/default $pool # Mount filesystems mount -t zfs $pool/ROOT/default /mnt mkdir /mnt/boot mount /dev/sdb1 /mnt/boot # Install base system apk --arch x86_64 \ -X "`grep '^http' /etc/apk/repositories`" \ -U \ --allow-untrusted \ --root /mnt \ --initdb \ add alpine-base tzdata alpine-mirrors linux-lts zfs zfs-lts syslinux parted util-linux udev chrony # Copy zfs info cp /etc/zfs/zpool.cache /mnt/etc/zfs # Setup bootloader (in chroot) dd bs=440 count=1 if=/usr/share/syslinux/gptmbr.bin of=/dev/sdb sed -i -r "s/^(default_kernel_opts=.*)/\1 rootfstype=zfs/" /etc/update-extlinux.conf sed -i "s,^root=.*,root=$pool/ROOT/default," /etc/update-extlinux.conf sed -i -r "s/^(modules=.*)ext4(.*)/\1zfs\2/" /etc/update-extlinux.conf update-extlinux extlinux --install /boot # Run mkinitfs (in chroot) sed -i 's/"$/ zfs"/' /etc/mkinitfs/mkinitfs.conf mkinitfs $(ls /lib/modules) # Ensure zfs module loads at boot (in chroot) echo zfs > /etc/modules-load.d/zfs.conf # Load zfs rc scripts (in chroot) rc-update add zfs-import sysinit rc-update add zfs-mount sysinit # Set up fstab (in chroot) echo -n '/dev/sda1 /boot vfat defaults 0 0 $pool/ROOT/default / zfs defaults 0 0 ' > /etc/fstab # After exiting chroot, unmount filesystems umount /mnt/boot zfs umount -a zpool export $pool ######## I don't know if can provide attachments to a mailing list, but would be happy to provide the complete install script. Thanks ! --000000000000ebc73f05a5cf95db Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I have two scripts for partitioning a hard drive and setti= ng up Alpine Linux 3.11.

One script uses GPT with an EFI syste= m partition (doesn't actually install an EFI bootloader, just a BIOS bo= ot loader), and an ext4 root partition. It works perfectly.

The second script is a copy of the first, where the only ch= anges are related to ZFS. It works, except for one minor irritating=C2=A0qu= irk: at boot time, I get the following message:

mo= unt: mounting zroot/ROOT/default on /sysroot failed: No such file or direct= ory
Mounting root failed.
initramfs emergency recovery shell launched= . Type 'exit' to continue boot
sh: can't access tty; job con= trol turned off

I simply type in the following= two commands, and it boots up just fine:
/ # mount -t zfs zroot/= ROOT/default /sysroot
/ # exit

I don't = know why this manual mounting is necessary. I don't have this problem w= ith ext4. It seems odd to me that I can simply go ahead and mount the exact= thing it says doesn't exist - especially since the mount command requi= res that the zpool has already been imported.

Afte= r booting up, the /boot/extlinux.conf has the following lines in it:
<= div>
LABEL lts
=C2=A0 MENU default
=C2=A0= MENU LABEL Linux lts
=C2=A0 LINUX vmlinuz-lts
=C2=A0 I= NITRD initramfs-lts
=C2=A0 APPEND ROOT=3Dzpool/ROOT/default modul= es=3Dsd-mod,usb-storage,zfs quiet

The lines of my = install script that perform ZFS operations are as follows:

########
# The installation system is a = plain old ext4 system installed by using setup-alpine
# This is n= ecessary because the boot media can't have ZFS added to it
# = sda is the ext4 system installed with setup-alpine
# sdb is the d= rive to install zfs to
# Modify installation system on sda = to ensure it has ZFS and other needed things
apk add parted zfs z= fs-`uname -r | rev | cut -d- -f 1 | rev` util-linux udev
echo= zfs > /etc/modules-load.d/zfs.conf
modprobe zfs

# Partition sdb - I find sgdisk is unreliable at creating device e= ntries, so I use parted
# Parted doesn't understand the zfs p= artition code, so I lie and use ext4
echo 'mklabel gpt
mkp= art BOOT fat32 2048s 100
set 1 esp on
set 1 legacy_boot on
mkpart = ROOT ext4 100 -100
print
' | parted /dev/sdb

# Determine ashift from physical sector size, should be 9 (sector = size =3D 512) or 12 (sector size =3D 4096)
phy_sec=3D"`lsblk -nldo = PHY-SEC /dev/sdb`"
ashift=3D"0"
while [ "$phy_sec= " -ne 1 ]
do
=C2=A0 =C2=A0 phy_sec=3D$((phy_sec / 2))
=C2=A0 = =C2=A0 ashift=3D$((ashift + 1))
done

# Crea= te zfs filesystem
pool=3D"zroot"
vdev=3D"/dev/d= isk/by-partuuid/`lsblk -nlo PARTUUID /dev/sdb2`"
zpool create -f -o= ashift=3D$ashift -O normalization=3DformD -m none $pool $vdev
zfs creat= e -o mountpoint=3Dnone -o canmount=3Doff $pool/ROOT
zfs create -o mountp= oint=3Dlegacy $pool/ROOT/default
zpool set bootfs=3D$pool/ROOT/default $= pool

# Mount filesystems
mount -t zf= s $pool/ROOT/default /mnt
mkdir /mnt/boot
mount /dev/sdb1 /mnt/boot

# Install base system
apk --arch x86_= 64 \
=C2=A0 =C2=A0-X "`grep '^http' /etc/apk/repositories`&= quot; \
=C2=A0 =C2=A0-U \
=C2=A0 =C2=A0--allow-untrusted \
=C2=A0 = =C2=A0--root /mnt \
=C2=A0 =C2=A0--initdb \
=C2=A0 =C2=A0add alpine-b= ase tzdata alpine-mirrors linux-lts zfs zfs-lts syslinux parted util-linux = udev chrony

# Copy zfs info
cp /etc/zfs/zpool.cache /mnt/etc/zfs<= br>

# Setup bootloader (in chroot)
dd bs= =3D440 count=3D1 if=3D/usr/share/syslinux/gptmbr.bin of=3D/dev/sdb
sed -= i -r "s/^(default_kernel_opts=3D.*)/\1 rootfstype=3Dzfs/" /etc/up= date-extlinux.conf
sed -i "s,^root=3D.*,root=3D$pool/ROOT/default,&= quot; /etc/update-extlinux.conf
sed -i -r "s/^(modules=3D.*)ext4(.*= )/\1zfs\2/" /etc/update-extlinux.conf
update-extlinux
extlinux -= -install /boot

# Run mkinitfs (in chroot)
sed -i 's/"$/ zfs"/' /etc/mkinitfs/mkinitfs.confmkinitfs $(ls /lib/modules)

# Ensure zfs modu= le loads at boot (in chroot)
echo zfs > /etc/modules-load.d/zf= s.conf

# Load zfs rc scripts (in chroot)
=
rc-update add zfs-import sysinit
rc-update add zfs-mount sys= init

# Set up fstab (in chroot)
echo= -n '/dev/sda1 =C2=A0 =C2=A0/boot =C2=A0 =C2=A0vfat =C2=A0 defaults =C2= =A0 0 0
$pool/ROOT/default =C2=A0 =C2=A0/ =C2=A0 =C2=A0zfs =C2=A0 defaul= ts =C2=A0 0 0
' > /etc/fstab

# After= exiting chroot, unmount filesystems
umount /mnt/boot
zfs umou= nt -a
zpool export $pool
########
=C2=A0
I don't know if can provide attachments to a mailing list, but would= be happy to provide the complete install script.

= Thanks !
--000000000000ebc73f05a5cf95db-- From nobody Fri Mar 29 01:10:57 2024 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id D101B781997 for <~alpine/users@lists.alpinelinux.org>; Sun, 17 May 2020 12:39:27 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id b6so6914522ljj.1 for <~alpine/users@lists.alpinelinux.org>; Sun, 17 May 2020 05:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LUImPLQQpc4C/RP9ZZNeEU6QbJDEO3k8ewxX+VrzI1o=; b=LX2KRPnVduQjUg4OD8kIzTQVmk2jwPTSUSEaQOwgkyYeQgG/he9qdpbFJ3e5/Ss//L 59vZQx19RSv+NHqa9HuP/6T9TrIe1FmrQZI0mISGPDaihgvcYk5PplohcEZ7zqay4vNa yNCIkT4Hw8SkrT1S0HeAG69TwJZS8T1wB3WAjwhm4EmR6yaF+qCSY5sKSD09bFo5RjQE Nh2vbBYI+WC0wPh6FxGnx/eOEOuKbJmYxgnKDvFc9I7v+J3QtJjl+99o8LQvxw6DwOWY TmNiMq6yBG8z+nhBP3fb1X+qt2yVGyMpqIWdpm5BmJnOhWWKroyWUw+Cuy3MSMuCUQFZ /YTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LUImPLQQpc4C/RP9ZZNeEU6QbJDEO3k8ewxX+VrzI1o=; b=obhfZDhPOC7ZmckZGGZ6666XAyJ1xUUt3434mk8WbwQWwG4Us2fHi26yomBw87rVH+ 47/d+vcENAEW7hrXHqGD8CFKw9qTbq9KhrpD0YFDbG94u1WO6RtL+dHlNrGVy44jjIP8 +lImT9/31II4+G6HRgxX9d+x8NmqwzVQNJREnWNfF4lPrg6XP9+HGiakehFpXzOkyIGV VpD2Z4bxOhsP8gJuecC8iwdxb4ckUI6jheE2PoanurWY5CSmNemA4dIjPcaj57Ub8NYr ++Skou5678LxTXrw0a5X6kfqZXLX/iZsfDXyglR3Uf40bx4kQJjurPEghE3F67uzl+m8 +jJg== X-Gm-Message-State: AOAM533IaSn7GvYqX2WntZXhWUQOiVCX0dB8Wj78pqLwvMS+xG7eCm3f 6nV8Vbdw/i2QLpxVYHqXyw1723+0 X-Google-Smtp-Source: ABdhPJy9uoWDqz6NLxhdGSm8VPce81v48Q9L23nmo3fjRytX8221ETDOn0GOjxd5C2fSZ71KOvNPsw== X-Received: by 2002:a2e:844f:: with SMTP id u15mr1564308ljh.67.1589719165845; Sun, 17 May 2020 05:39:25 -0700 (PDT) Received: from kpc.kaey.ru ([91.123.18.165]) by smtp.gmail.com with ESMTPSA id g10sm4876807lfc.95.2020.05.17.05.39.24 for <~alpine/users@lists.alpinelinux.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 05:39:25 -0700 (PDT) Date: Sun, 17 May 2020 15:39:24 +0300 From: Konstantin Kulikov To: ~alpine/users@lists.alpinelinux.org Subject: Re: ZFS ROOT fails with mount: mounting zroot/ROOT/default on /sysroot failed: No such file or directory Message-Id: <20200517153924.95ef3d463716b05d8c4009a8@gmail.com> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > LABEL lts > MENU default > MENU LABEL Linux lts > LINUX vmlinuz-lts > INITRD initramfs-lts > APPEND ROOT=zpool/ROOT/default modules=sd-mod,usb-storage,zfs quiet I think if you change to APPEND root=zpool/ROOT/default" (root lowercased) and add "zfs_force=1" it'll start working. Another thing you can try is to set # zfs set mountpoint=/ zpool/ROOT/default and in bootloader: APPEND root=ZFS=zpool/ROOT/default rootfstype and zfs_force are not neccessary in this case. It's difficult for me to say exactly what the problem is because interaction between initramfs-init and nlplug-findfs is complicated in zfs case and I have troubles reading C code. Relevant links: https://git.alpinelinux.org/mkinitfs/tree/initramfs-init.in#n506 https://git.alpinelinux.org/mkinitfs/tree/nlplug-findfs.c#n1015