When updating your CentOS system with kmod-zfs, please update also your zfs.repo and verify that the zfs.ko is installed on your kernel
When updating your CentOS system with kmod-zfs, please update also your zfs.repo by typing the correct version.
And you should check that your kernel have the zfs.ko module installed.
Do not reboot until you are sure you have a working kernel. And make backups of your kernels and initramfs images.
Just a user not understanding what is happening when they fire off a few commands and reboot.
ZFS on Centos for years here. The kernel and ZFS are not always in lock step and you need to be mindful about which kernel you boot too. topslakr
In my case I was using 7.3 repository when I installed the system and I need to change it to 7.4 (there are multiple lines with the version string):
[root@localhost ~]# mcedit /etc/yum.repos.d/zfs.repo [root@localhost ~]# cat /etc/yum.repos.d/zfs.repo [zfs] name=ZFS on Linux for EL7 - dkms baseurl=http://download.zfsonlinux.org/epel/7.4/$basearch/ enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux [zfs-kmod] name=ZFS on Linux for EL7 - kmod baseurl=http://download.zfsonlinux.org/epel/7.4/kmod/$basearch/ enabled=1 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux [zfs-source] name=ZFS on Linux for EL7 - Source baseurl=http://download.zfsonlinux.org/epel/7.4/SRPMS/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux [zfs-testing] name=ZFS on Linux for EL7 - dkms - Testing baseurl=http://download.zfsonlinux.org/epel-testing/7.4/$basearch/ enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux [zfs-testing-kmod] name=ZFS on Linux for EL7 - kmod - Testing baseurl=http://download.zfsonlinux.org/epel-testing/7.4/kmod/$basearch/ enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux [zfs-testing-source] name=ZFS on Linux for EL7 - Testing Source baseurl=http://download.zfsonlinux.org/epel-testing/7.4/SRPMS/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux [root@localhost ~]#
And then 'yum update' just works fine.
To be sure you can check the presence of the zfs.ko kernel module and make sure that you have correct kernel installed:
[root@localhost ~]# find /lib/modules/ | grep zfs.ko /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/zfs/zfs/zfs.ko /lib/modules/3.10.0-693.5.2.el7.x86_64/weak-updates/zfs/zfs/zfs.ko [root@localhost ~]# ls /boot/vmlinuz-* /boot/vmlinuz-0-rescue-263ede4315d14b8ba4b3a93abc833aea /boot/vmlinuz-3.10.0-514.10.2.bak1.el7.x86_64 /boot/vmlinuz-3.10.0-514.10.2.el7.x86_64 /boot/vmlinuz-3.10.0-514.el7.x86_64 /boot/vmlinuz-3.10.0-693.5.2.el7.x86_64 [root@localhost ~]#
Check the presence of the zfs.ko within the initramfs:
[root@localhost ~]# lsinitrd /boot/initramfs-3.10.0-693.5.2.el7.x86_64.img | grep zfs.ko -rw-r--r-- 1 root root 3191696 Nov 10 12:53 usr/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/zfs/zfs/zfs.ko lrwxrwxrwx 1 root root 58 Nov 10 12:53 usr/lib/modules/3.10.0-693.5.2.el7.x86_64/weak-updates/zfs/zfs/zfs.ko -> ../../../../3.10.0-693.2.2.el7.x86_64/extra/zfs/zfs/zfs.ko [root@localhost ~]#
And it's good to make backups of the kernels and initramfs images because they might get updated (overwritten) when you run 'yum update' next time.
The updated initramfs of the kernel version 3.10.0-514.10.2.el7.x86_64 cause it not to boot. But it is still default option in the Grub menu. This is why I decided to remove it:
# yum remove kernel-3.10.0-514.10.2.el7.x86_64
You can set the default kernel with the command 'grub2-set-default'.
First, we rebuild the Grub configuration:
# export ZPOOL_VDEV_NAME_PATH=YES # grub2-mkconfig -o /boot/grub2/grub.cfg
Wet the list of the installed kernels (it is extracted from the Grub configuration, this way we first rebuilt it with 'grub2-mkconfig '):
[root@localhost ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg 0 : CentOS Linux (3.10.0-693.5.2.el7.x86_64) 7 (Core) 1 : CentOS Linux (3.10.0-693.5.2.bak1.el7.x86_64) 7 (Core) 2 : CentOS Linux (3.10.0-514.10.2.bak1.el7.x86_64) 7 (Core) 3 : CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core) 4 : CentOS Linux (0-rescue-263ede4315d14b8ba4b3a93abc833aea) 7 (Core) [root@localhost ~]#
Another way:
[root@localhost ~]# grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2 CentOS Linux (3.10.0-693.5.2.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-693.5.2.bak1.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-514.10.2.bak1.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core) CentOS Linux (0-rescue-263ede4315d14b8ba4b3a93abc833aea) 7 (Core) [root@localhost ~]#
The default entry is defined by the GRUB_DEFAULT line in the /etc/default/grub file.
[root@localhost ~]# grep DEFAULT /etc/default/grub GRUB_DEFAULT=saved [root@localhost ~]#
However, if the GRUB_DEFAULT line is set as 'saved', the parameter is stored in the /boot/grub2/grubenv file (it cannot be manually edited, the 'grub2-set-default' should be used instead). It may be viewed by:
[root@localhost ~]# grub2-editenv list saved_entry=CentOS Linux (3.10.0-514.10.2.el7.x86_64) 7 (Core) [root@localhost ~]#
The command 'grub2-set-default' accepts the number of the kernel (the first kernel is 0). You can use also the menu item title.
[root@localhost ~]# grub2-editenv list saved_entry=CentOS Linux (3.10.0-514.10.2.el7.x86_64) 7 (Core) [root@localhost ~]# grub2-set-default 0 [root@localhost ~]# grub2-editenv list saved_entry=0 [root@localhost ~]#
If you prefer to use the menu item title:
# grub2-set-default "CentOS Linux (3.10.0-693.5.2.el7.x86_64) 7 (Core)"
After making a backup of the working kernel I rebuilt Grub menu:
[root@localhost ~]# cd /boot/ [root@localhost boot]# cp vmlinuz-3.10.0-693.5.2.el7.x86_64 vmlinuz-3.10.0-693.5.2.bak1.el7.x86_64 [root@localhost boot]# cp initramfs-3.10.0-693.5.2.el7.x86_64.img initramfs-3.10.0-693.5.2.bak1.el7.x86_64.img [root@localhost boot]# export ZPOOL_VDEV_NAME_PATH=YES [root@localhost boot]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-693.5.2.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-693.5.2.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-693.5.2.bak1.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-693.5.2.bak1.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-514.10.2.bak1.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-514.10.2.bak1.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-263ede4315d14b8ba4b3a93abc833aea Found initrd image: /boot/initramfs-0-rescue-263ede4315d14b8ba4b3a93abc833aea.img done [root@localhost boot]#
It does not work without the 'export ZPOOL_VDEV_NAME_PATH=YES' command before running grub2-mkconfig.
Comments
Post a Comment