{"id":4436,"date":"2018-04-10T15:37:39","date_gmt":"2018-04-10T20:37:39","guid":{"rendered":"http:\/\/icesquare.com\/wordpress\/?p=4436"},"modified":"2021-10-10T17:51:30","modified_gmt":"2021-10-10T22:51:30","slug":"how-to-fix-the-mess-created-by-zfs-on-linux-after-update","status":"publish","type":"post","link":"https:\/\/icesquare.com\/wordpress\/how-to-fix-the-mess-created-by-zfs-on-linux-after-update\/","title":{"rendered":"&#8220;ZFS on Linux&#8221;: The ZFS modules are not loaded. Try running &#8216;\/sbin\/modprobe zfs&#8217; as root to load them."},"content":{"rendered":"<p>Last Updated: Oct 10, 2021<\/p>\n<p>This article is based on my experience with CentOS 7. If you are running other Linux distributions, please adjust the commands and package names accordingly (e.g., yum &#8211;&gt; apt-get).<\/p>\n<p>As of Oct 3, 2019, I cannot get ZFS on Linux running on CentOS 8.<\/p>\n<p><strong><a href=\"https:\/\/zfsonlinux.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">ZFS on Linux<\/a><\/strong> is a not robust solution to get ZFS up and running in Linux environments. Unlike FreeBSD, ZFS does not work with the Linux kernel natively. The developers of ZFS on Linux came up a rather crappy solution: By injecting the ZFS into the kernel via DKMS, Linux kernel will understand what is ZFS. It works very well, and it really works with a single assumption: The system will never get updated or rebooted after installing ZFS on Linux. So what will happen after you update the system (e.g., kernel, ZFS on Linux packages) and the system got rebooted? There is a good chance that your ZFS module will not be loaded:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Event<\/strong><\/td>\n<td><strong>What will happen after reboot?<\/strong><\/td>\n<td><strong>What do you need to do?<\/strong><\/td>\n<\/tr>\n<tr>\n<td>You update kernel first, then ZFS on Linux afterward<\/td>\n<td>\n<div>Before Dec 12, 2018: Your system will load the ZFS modules.<\/div>\n<div>Dec 12, 2018 &#8211; Dec 2019: Probably not<\/div>\n<div>After Jan 2020: 50\/50<\/div>\n<\/td>\n<td>Remove the old kernels from DKMS database. Rebuild the ZFS (and SPL if running 0.7.x) modules with the new kernel in the DKMS database.<\/td>\n<\/tr>\n<tr>\n<td>You update ZFS on Linux first, then kernel afterward<\/td>\n<td>If your system boots into the new kernel (which is default), your system WILL NOT load the ZFS modules.<\/td>\n<td>Remove and install the ZFS and DKMS packages. Remove the old kernels from DKMS database. Rebuild the SPL and ZFS modules with the new kernel in the DKMS database.<\/td>\n<\/tr>\n<tr>\n<td>You update ZFS on Linux only. Kernel has not been updated.<\/td>\n<td>Your system will load the ZFS modules.<\/td>\n<td>Remove the old kernels from DKMS database. Rebuild the SPL and ZFS modules with the new kernel in the DKMS database.<\/td>\n<\/tr>\n<tr>\n<td>You update kernel only. ZFS on Linux has not been updated.<\/td>\n<td>Your system will load the ZFS modules.<\/td>\n<td>Remove the old kernels from DKMS database. Rebuild the SPL and ZFS modules with the new kernel in the DKMS database.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<p>There are two steps to rescue your data back. We will start with removing your DKMS module first. If it does not work, we will reinstall the ZFS packages. Also, I am assuming that your system is booted to the new kernel. Please keep in mind that ZFS on Linux does not work with Linux kernel v4 (as of Oct 3, 2019, either via kernel-ml via CentOS 7 or native v4 on CentOS 8). It only works with v3.<\/p>\n<p>If you need to access your data, the easiest way is to boot to the old working kernel. Once you are ready to clean up the problem, boot to the new kernel and follow my instructions below.<\/p>\n<h2>Step 1: Clean up and Reinstall DKMS Modules<\/h2>\n<p>Most of the time, the ZFS on Linux messes up the DKMS modules after the update. I suggest to clean up and reinstall DKMS modules once again. As of December 12, 2018, the ZFS on Linux will remove all of the DKMS modules for no reason.<\/p>\n<p>First, check your DKMS status. You will need to clean up the DKMS if it is empty (nothing is installed), orphan (library is installed, but none of them is attached to any kernel) or multiple (multiple kernels installed). If it is clean (single kernel only), you may skip this step. If you are using ZFS on Linux ver 0.7.x, your DKMS will contain two modules (zfs and spl). If you are using ver. 0.8.x, your DKMS will contain one module only (zfs).<\/p>\n<pre>#dkms status\r\n<\/pre>\n<p>In general, all you want is only one version of DKMS modoule is installed, and it is attached to one kernel only. If you see multiple versions of DKMS modules, or multiple kernels, that&#8217;s bad.<\/p>\n<pre>#An example of dirty DKMS status (This is bad):\r\nspl, 0.7.12, 3.10.0-862.14.4.el7: installed (original_module exists) (WARNING! Diff between built and installed module!)\r\nspl, 0.7.12, 3.10.0-957.1.3.el7: installed (original_module exists)\r\nzfs, 0.7.12, 3.10.0-862.14.4.el7: installed (original_module exists) (WARNING! Diff between built and installed module!)\r\nzfs, 0.7.12, 3.10.0-957.1.3.el7: installed (original_module exists)\r\n\r\n#An example of empty DKMS status (This is bad):\r\n(empty)\r\n\r\n#An example of DKMS status without kernal (This is bad):\r\nzfs, 0.7.12: added\r\nspl, 0.7.12: added\r\n\r\n#An example of clean DKMS status (This is good):\r\nspl, 0.7.12, 3.10.0-957.1.3.el7.x86_64, x86_64: installed\r\nzfs, 0.7.12, 3.10.0-957.1.3.el7.x86_64, x86_64: installed \r\n\r\nor \r\n\r\nspl, 0.7.12, 3.10.0-957.1.3.el7.x86_64, x86_64: installed (original_module exists)\r\nzfs, 0.7.12, 3.10.0-957.1.3.el7.x86_64, x86_64: installed (original_module exists)\r\n\r\nor \r\n\r\nzfs, 0.8.3, 3.10.0-1127.el7.x86_64, x86_64: installed (original_module exists)\r\n<\/pre>\n<p>In my example above, my ZFS on Linux is 0.7.12, my old kernel is 3.10.0-862.14.4.el7, my new kernel is 3.10.0-957.1.3.el7. Your version may be different.<\/p>\n<p>If your situation is something like the following:<\/p>\n<pre>Error! Could not locate dkms.conf file.\r\nFile: \/var\/lib\/dkms\/zfs\/0.8.2\/source\/dkms.conf does not exist.\r\n<\/pre>\n<p>That means you have multiple versions of dkms-ZFS modules installed in your system. In my case, the 0.8.3 is running, and the old (0.8.2) is still available. Check the folder (\/var\/lib\/dkms\/zfs\/) to see if any old libraries need to be removed.<\/p>\n<pre>\r\n#Currently running: dkms ZFS 0.8.3, kernel 3.10.0-1062.18.1.el7.x86_64\r\n\r\ncd \/var\/lib\/dkms\/zfs\/\r\n\r\n#ls -al\r\ntotal 12K\r\n0.8.2 &lt;---- Delete this 0.8.3 kernel-3.10.0-1062.1.2.el7.x86_64-x86_64 -&gt; 0.8.2\/3.10.0-1062.1.2.el7.x86_64\/x86_64 &lt;---- Delete this kernel-3.10.0-1062.4.1.el7.x86_64-x86_64 -&gt; 0.8.2\/3.10.0-1062.4.1.el7.x86_64\/x86_64 &lt;---- Delete this kernel-3.10.0-1062.4.3.el7.x86_64-x86_64 -&gt; 0.8.2\/3.10.0-1062.4.3.el7.x86_64\/x86_64 &lt;---- Delete this kernel-3.10.0-1062.7.1.el7.x86_64-x86_64 -&gt; 0.8.2\/3.10.0-1062.7.1.el7.x86_64\/x86_64 &lt;---- Delete this kernel-3.10.0-1062.9.1.el7.x86_64-x86_64 -&gt; 0.8.3\/3.10.0-1062.9.1.el7.x86_64\/x86_64 &lt;---- Delete this\r\n<\/pre>\n<p>You may want to remove both ZFS and SPL DKMS modules first, then reinstall them:<\/p>\n<pre>\r\n#If your version is 0.7.x:\r\nsudo dkms remove zfs\/0.7.12 --all; \r\nsudo dkms remove spl\/0.7.12 --all; \r\n\r\n\r\n#If your version is 0.8.x:\r\nsudo dkms remove zfs\/0.8.3 --all; \r\n<\/pre>\n<p>Sometimes, you will need to remove the old kernel manually:<\/p>\n<pre>sudo dkms remove zfs\/0.7.12 -k 3.10.0-862.14.4.el7.x86_64; \r\nsudo dkms remove spl\/0.7.12 -k 3.10.0-862.14.4.el7.x86_64;\r\n<\/pre>\n<p>Time to reinstall them:<\/p>\n<pre>#Don't forget to use the version that matches your system. In my situation, it was 0.7.12 \/ 0.8.3\r\n\r\n#0.7.x:\r\nsudo dkms --force install spl\/0.7.12; \r\nsudo dkms --force install zfs\/0.7.12;\r\n\r\n#0.8.x:\r\nsudo dkms --force install zfs\/0.8.3;\r\n<\/pre>\n<p>Run the DKMS status again. You should see both ZPL and SPL are attached to the new kernel:<\/p>\n<pre>#If your version is 0.7.x:\r\nspl, 0.7.12, 3.10.0-957.1.3.el7.x86_64, x86_64: installed\r\nzfs, 0.7.12, 3.10.0-957.1.3.el7.x86_64, x86_64: installed\r\n\r\n#If your version is 0.8.x:\r\nzfs, 0.8.3, 3.10.0-1127.el7.x86_64, x86_64: installed\r\n<\/pre>\n<p>Try to load the ZFS module and import your ZFS data:<\/p>\n<pre>sudo \/sbin\/modprobe zfs\r\nsudo zpool import -a\r\n<\/pre>\n<p>If everything looks good, you can reboot your system and test to see if the ZFS is loaded automatically or not. Once everything is okay, remove the old kernel from the system.<\/p>\n<pre>sudo package-cleanup --oldkernels --count=1 -y\r\n<\/pre>\n<p>That&#8217;s it, you are good to go.<\/p>\n<hr \/>\n<h2>Step 2: Reinstall ZFS packages<\/h2>\n<p>If you have tried the first step and it didn&#8217;t work. You may want to reinstall the ZFS packages. Here is a typical error message:<\/p>\n<p>You try to import the ZFS data and the system complains:<\/p>\n<pre>#zpool import -a\r\nThe ZFS modules are not loaded.\r\nTry running '\/sbin\/modprobe zfs' as root to load them.\r\n<\/pre>\n<p>So you try to load the ZFS module and the system complains again:<\/p>\n<pre>#\/sbin\/modprobe zfs\r\nmodprobe: FATAL: Module zfs not found.\r\nor\r\nmodprobe: ERROR: could not insert 'zfs': Invalid argument\r\n<\/pre>\n<p>What you need to do is to erase all the ZFS and related packages:<\/p>\n<pre>yum erase zfs zfs-dkms libzfs2 spl spl-dkms libzpool2 -y\r\n<\/pre>\n<p>Please reboot the system. This step is very important.<\/p>\n<pre>reboot<\/pre>\n<p>After that, try to install ZFS again.<\/p>\n<pre>yum install zfs -y\r\n<\/pre>\n<p>If the system complaints about mismatched dependent packages, try to remove the affected packages first and run the installation again.<\/p>\n<p>After the installation, try to start the ZFS module:<\/p>\n<pre>\/sbin\/modprobe zfs\r\nzpool import -a\r\n<\/pre>\n<p>If the ZFS is up and running, please clean up your DKMS from step 1. If it complains again, please follow the steps below:<\/p>\n<ol>\n<li>Reboot<\/li>\n<li>Clear the cache of the yum repository and try to update the system again. (sudo yum clean all)<\/li>\n<li>Reboot to the latest kernel<\/li>\n<li>Erase the ZFS and related packages, try it again.<\/li>\n<\/ol>\n<p>Keep in mind that ZFS on Linux is based on DKMS, a very buggy and unreliable platform. Sometimes when you uninstall and install the packages, don&#8217;t expect that it will do the same thing as fresh install. Before you send your server to the landfill, try this:<\/p>\n<p>Check the dkms status:<\/p>\n<pre>#dkms status\r\n<\/pre>\n<pre>#version 0.7.x\r\nzfs, 0.7.2: added\r\nspl, 0.7.2: added\r\n\r\n#version 0.8.x\r\nzfs, 0.8.3: added\r\n<\/pre>\n<p>If you see this message, that means the ZFS packages have been installed, but the DKMS doesn&#8217;t know how to use it. You will need to tell DKMS about it:<\/p>\n<pre>#version 0.7.x\r\ndkms --force install zfs\/0.7.2\r\ndkms --force install spl\/0.7.2\r\n\r\n#version 0.8.x\r\ndkms --force install zfs\/0.8.3\r\n<\/pre>\n<pre>#Try to start ZFS again.\r\n\/sbin\/modprobe zfs\r\nzpool import -a\r\n<\/pre>\n<p>If you already tried it for more than 3 times without any luck, don&#8217;t waste your time. You may want to bring the ZFS disks to a different server. The new server should be able to recognize the ZFS disks. For the original server, you can connect to the ZFS disks on the new server via NFS using the original path. That will minimize the impact of changes.<\/p>\n<p>Keep in mind that the ZFS version is very important. The server with newer ZFS version can read the ZFS disks created in older ZFS versions. You can always check the ZFS versions by running the following:<\/p>\n<pre>#Get the version of the host:\r\nsudo zfs upgrade -v\r\nsudo zpool upgrade -v\r\n\r\n\r\n#Get the version of the ZFS disks:\r\nsudo zfs get version\r\nsudo zpool get version\r\n<\/pre>\n<p>This is pretty much what I need to do on my 60 servers every month. If you are in a similar situation like mine, I guarantee that you will become an expert of fixing this kind of mess after few months. Good luck!<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last Updated: Oct 10, 2021 This article is based on my experience with CentOS 7. If you are running other Linux distributions, please adjust the commands and package names accordingly <a class=\"more-link\" href=\"https:\/\/icesquare.com\/wordpress\/how-to-fix-the-mess-created-by-zfs-on-linux-after-update\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[94,146,144,6,69,109],"tags":[48,177],"class_list":["post-4436","post","type-post","status-publish","format-standard","hentry","category-computer-problems-computer-help-pc-support","category-everyday-computer-problem","category-sever-problem","category-technology","category-troubleshooting-technology","category-zfs","tag-linux","tag-zfs"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p1sqzr-19y","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":3914,"url":"https:\/\/icesquare.com\/wordpress\/zfs-linux-vs-freebsd\/","url_meta":{"origin":4436,"position":0},"title":"Running ZFS on Linux: Things you should know and be aware of","author":"Derrick","date":"February 29, 2016","format":false,"excerpt":"First Published: Feb 29, 2016 Last Revised: January 10, 2026 ZFS is a next-generation file system renowned for its reliability and advanced features. However, due to legal and licensing issues, it is not included by default in most Linux distributions. Fortunately, you can still install (ZFS on Linux) with just\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4286,"url":"https:\/\/icesquare.com\/wordpress\/how-to-install-zfs-on-rhel-centos-7\/","url_meta":{"origin":4436,"position":1},"title":"How to install ZFS on RHEL \/ CentOS 7","author":"Derrick","date":"January 4, 2017","format":false,"excerpt":"A friend of mine likes to try ZFS on CentOS 7, therefore I decide to make a guide for him. The following instructions have been well tested on CentOS 7. Before you decide to put ZFS in a production use, you should be aware of the following: ZFS is originally\u2026","rel":"","context":"In &quot;Everyday Computer Problem&quot;","block_context":{"text":"Everyday Computer Problem","link":"https:\/\/icesquare.com\/wordpress\/category\/everyday-computer-problem\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2011\/01\/zfs_logo.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4005,"url":"https:\/\/icesquare.com\/wordpress\/centos-6-no-zfs-after-upgrading-the-kernel\/","url_meta":{"origin":4436,"position":2},"title":"CentOS\/RHEL 6: No ZFS after upgrading the kernel","author":"Derrick","date":"March 2, 2016","format":false,"excerpt":"This article is mainly for CentOS 6, please visit here for CentOS 7. After I upgraded the CentOS \/ RHEL system to the latest kernel, the ZFS failed to start. The system was unable to load the ZFS module, i.e., I could not access my data. Here are some error\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2011\/01\/zfs_logo.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4679,"url":"https:\/\/icesquare.com\/wordpress\/zfs-on-linux-trouble-this-pool-uses-the-following-features-not-supported-by-this-system-all-unsupported-features-are-only-required-for-writing-to-the-pool\/","url_meta":{"origin":4436,"position":3},"title":"[ZFS On Linux Trouble] This pool uses the following feature(s) not supported by this system&#8230;All unsupported features are only required for writing to the pool, zpool create: invalid argument for this pool operation","author":"Derrick","date":"February 11, 2020","format":false,"excerpt":"When I rebooted my computer and loaded my ZFS pool today, I got this error message: #sudo zpool import -a This pool uses the following feature(s) not supported by this system: org.zfsonlinux:project_quota (space\/object accounting based on project ID.) com.delphix:spacemap_v2 (Space maps representing large segments are more efficient.) All unsupported features\u2026","rel":"","context":"In &quot;Technology&quot;","block_context":{"text":"Technology","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4202,"url":"https:\/\/icesquare.com\/wordpress\/centosrhel-7-no-zfs-after-updating-the-kernel\/","url_meta":{"origin":4436,"position":4},"title":"CentOS\/RHEL 7 &#8211; No ZFS After Updating the Kernel","author":"Derrick","date":"December 12, 2016","format":false,"excerpt":"Let's all agree with this fact: ZFS is foreign to Linux. It is not native. You can't expect that ZFS on Linux will run smoothly as FreeBSD or Solaris. Having using ZFS on Linux since 2013 (and ZFS on FreeBSD since 2009), I've noticed that ZFS does not like Linux\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4137,"url":"https:\/\/icesquare.com\/wordpress\/modprobe-error-could-not-insert-zfs-required-key-not-available\/","url_meta":{"origin":4436,"position":5},"title":"modprobe: ERROR: could not insert &#8216;zfs&#8217;: Required key not available","author":"Derrick","date":"June 10, 2016","format":false,"excerpt":"Today I was trying to install ZFS on a CentOS 7 box. Typically rebooting the computer, the ZFS mododule will be turned on. However, it didn't turn on in my case. Failed to load ZFS module stack. Load the module manually by running 'insmod \/zfs.ko' as root. So I tried\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/icesquare.com\/wordpress\/wp-content\/uploads\/2011\/01\/zfs_logo.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/comments?post=4436"}],"version-history":[{"count":74,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4436\/revisions"}],"predecessor-version":[{"id":4952,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4436\/revisions\/4952"}],"wp:attachment":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=4436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=4436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=4436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}