Closed azeemism closed 8 years ago
Also seeing this with the new version.
I'm currently looking at this.
Try booting with zfsdebug=1
and let me know what you see.
Also, in the first shell you get, please run zpool status
to verify that the pool is actually imported correctly.
Btw, zfsonlinux/zfs#4474 is NOT related. That happens way, way later in the whole startup procedure. You're getting a problem in the /usr/share/initramfs-tools/scripts/zfs
, which is copied onto the initrd and then used for the booting (finding and importing the pool and the root fs etc).
The issue 4474 is about systemd but this problem occurs before systemd in the initramfs.
It appears that ZFS_BOOTFS is cleared after pool import in the script /usr/share/initramfs-tools/scripts/zfs (line 278)
Fix : comment the line and regenerate initramfs
# update-initramfs -u
Better yet, change the "${pool}"
to "${ZFS_RPOOL}"
.
@arcenik Does that work?
@FransUrbo : that does not work, find_rootfs function still return nothing.
@FransUrbo : the bootfs value for my zfs pool is "-" (which is the default value). Therefore the find_rootfs print nothing and return 1.
So initramfs script should change the ZFS_BOOTFS only if find_rootfs return 0 value
find_rootfs ${ZFS_RPOOL} && ZFS_BOOTFS="$(find_rootfs ${ZFS_RPOOL})"
@arcenik Ok, thanx. That makes sence.
How's this:
# Import the pool (if not already done so in the AUTO check above).
if [ -n "${ZFS_RPOOL}" -a -z "${POOL_IMPORTED}" ]
then
if import_pool "${ZFS_RPOOL}"; then
root_fs="$(find_rootfs "${ZFS_RPOOL}")"
[ -n "${root_fs}" ] && ZFS_BOOTFS="${root_fs}"
fi
fi
@FransUrbo this last variant fixes this issue for me!
@Fabian-Gruenbichler, perfect thanx! I'll include that in the next update. I'll hold of a little to make sure there isn't any more issues lingering and then I'll build new packages for both Wheezy and Jessie.
Expect them in five-six hours (with any luck).
@FransUrbo instead of checking the content printed by find_rootfs you should check it's return code.
root_fs="$(find_rootfs "${ZFS_RPOOL}")"
$? && ZFS_BOOTFS="${root_fs}"
@arcenik Even better, thanx!
@arcenik Actually, that don't seem to work:
[celia.pts/6]$ var="$(file /etc/passwd > /dev/null 2>&1)"
[celia.pts/6]$ [ "$?" ] && echo whatever
whatever
[celia.pts/6]$ var="$(file /etc/passwdX > /dev/null 2>&1)"
[celia.pts/6]$ [ "$?" ] && echo whatever
whatever
[celia.pts/6]$ var="$(file /etc/passwdX > /dev/null 2>&1)"
[celia.pts/6]$ "$?" && echo whatever
bash: 1: command not found
However, this works:
[celia.pts/6]$ if var="$(file /etc/passwdX > /dev/null 2>&1)"; then echo whatever; fi
[celia.pts/6]$ if var="$(file /etc/passwd > /dev/null 2>&1)"; then echo whatever; fi
whatever
So how's this:
# Import the pool (if not already done so in the AUTO check above).
if [ -n "${ZFS_RPOOL}" -a -z "${POOL_IMPORTED}" ]
then
if import_pool "${ZFS_RPOOL}"; then
if root_fs="$(find_rootfs "${ZFS_RPOOL}")"; then
ZFS_BOOTFS="${root_fs}"
fi
fi
fi
Or possibly even better:
# Import the pool (if not already done so in the AUTO check above).
if [ -n "${ZFS_RPOOL}" -a -z "${POOL_IMPORTED}" ]
then
import_pool "${ZFS_RPOOL}" && \
root_fs="$(find_rootfs "${ZFS_RPOOL}")" && \
ZFS_BOOTFS="${root_fs}"
fi
This problem also exists a few lines above:
OLD_IFS="${IFS}" ; IFS=";"
for pool in ${POOLS}
do
[ -z "${pool}" ] && continue
import_pool "${pool}"
ZFS_BOOTFS="$(find_rootfs "${pool}")"
done
IFS="${OLD_IFS}"
I'm suggesting:
OLD_IFS="${IFS}" ; IFS=";"
for pool in ${POOLS}
do
[ -z "${pool}" ] && continue
import_pool "${pool}" && \
root_fs="$(find_rootfs "${pool}")" && \
ZFS_BOOTFS="${root_fs}"
[ -n "${ZFS_BOOTFS} ] && break
done
IFS="${OLD_IFS}"
@ FransUrbo
Here is a working example for bash:
$ a=$(true); [ $? -ne 0 ] && echo aaaaaaaaaaaa
$ a=$(false); [ $? -ne 0 ] && echo aaaaaaaaaaaa
aaaaaaaaaaaa
It also works to with busybox sh but not in initramfs.
And the working script for initramfs:
Still shouldn't do it if the import isn't successful, which my last examples fix.
@FransUrbo : I'm trying your last proposal but ${POOLS} is empty on my test system
It usually is... It's only in a few rare conditions when people have a root pool and a data pool (etc) that that is used. And when you specify boot=zfs zfs:AUTO
and NOTHING else!
Do note that there's TWO different places where almost the same code is used, and I showed solutions to both of them. Be sure to apply the correct code to the correct place.
Closing this as fixed in 0.6.5.6-2 which is on it's way up to the repo now.
Did you really tested it ??
Did you really tested it ??
No. I don't have any machine with root on zfs available at the moment.
I'll issue new debs right away.
You could try this : https://github.com/arcenik/debian-zfs-root ;-)
You could try this : https://github.com/arcenik/debian-zfs-root ;-)
About a year or so ago, I created a native Debian GNU/Linux ISO image with native ZFS support.
I usually use that, but I don't have time to set anything up now. I might even have the original VMs around, but I don't have to find them either :).
Sorry about the mess-up.
0.6.5.6-3 just pushed to the repo.
The version 0.6.5.6-3 is working with my install script. Debian with zfs root is booting without problem.
This was not the case for 0.6.5.2-2 Debian Jessie release.
@FransUrbo, could this be related to the commit for https://github.com/zfsonlinux/zfs/issues/4474. Note under 0.6.5.2-2 I had no trouble also loading
/usr
,/var
,/var/log
etc. on separate ZFS datasets (https://github.com/zfsonlinux/zfs/issues/4474#issuecomment-205467437)On every startup/reboot I see the following:
Jessie appears to load normally after this point:
Note:
/boot
is on ext4 and both/boot
and/boot/efi
are on a different diskSTEPS to reproduce the issue:
see: http://zfsonlinux.org/debian.html
Install dependencies:
Then:
Prevent disk import as sdX, keep disk import as by-id:
Then remake initramfs:
Create rpool and other pools:
Move files to rpool:
Recreate zpool.cache that goes missing when altroot is used:
Setup /sysroot:
Comment out
/
in/etc/fstab
Under 0.6.5.2-2 there is not need to add
rpool/ROOT/debian-8 / zfs default 0 0
Whether the line above is added or not added to/etc/fstab
the same issue occurs even when usingzfs set mountpoint=legacy rpool/ROOT/debian-8
.Update initramfs:
Update grub and exit chroot: