{"id":341,"date":"2013-06-11T02:16:08","date_gmt":"2013-06-11T09:16:08","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=341"},"modified":"2013-06-19T09:30:23","modified_gmt":"2013-06-19T16:30:23","slug":"ubuntu-root-on-zfs-upgrading-kernels","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/ubuntu-root-on-zfs-upgrading-kernels\/","title":{"rendered":"Ubuntu root on ZFS upgrading kernels"},"content":{"rendered":"

Update 1:<\/strong><\/span><\/p>\n

On a subsequent kernel upgrade to 3.8.0.25 I realized that the zfs modules are getting compiled just fine when the kernel is upgraded. \u00a0On Ubuntu 13.04 anyhow. \u00a0So all you need to do is fix the grub.cfg file because of the bug mentioned below where \"<\/span>\/ROOT\/ubuntu-1@<\/strong><\/span>\" is inserted twice. \u00a0Quick fix you could use sed but be careful to verify your temporary file before copying in place:<\/span><\/p>\n

\r\n# sed 's\/\\\/ROOT\\\/ubuntu-1\\\/@\/\/g' \/boot\/grub\/grub.cfg > \/tmp\/grub.cfg\r\n# cp \/tmp\/grub.cfg \/boot\/grub\/grub.cfg\r\n<\/pre>\n

I left the rest of the initial post below in case I ever need to really boot with a live CD and redo kernel modules from scratch. \u00a0 Or maybe that would also work for upgrading the zfs modules from git I suppose.<\/p>\n

Original post below:<\/strong><\/span><\/p>\n

This is a follow on to my running Ubuntu on a ZFS root file system http:\/\/blog.ls-al.com\/booting-ubuntu-on-a-zfs-root-file-system\/<\/a> article. \u00a0I decided to document how to do a kernel upgrade in this configuration. \u00a0It serves two scenarios A) user decided kernel upgrade or B) accidentally upgraded the kernel and now I can't boot any longer. \u00a0I wish I could say I wrote this article in response to number 1 but no it was in response to number 2.<\/p>\n

In this case the kernel was upgraded from 3.8.0.19 to 3.8.0.23.<\/span><\/p>\n

Boot a live cd to start.<\/p>\n

Install zfs module:<\/strong><\/span><\/p>\n

\r\n$ sudo -i\r\n# \/etc\/init.d\/lightdm stop\r\n# apt-add-repository --yes ppa:zfs-native\/stable\r\n# apt-get update\r\n# apt-get install debootstrap ubuntu-zfs\r\n\r\n# modprobe zfs\r\n# dmesg | grep ZFS:\r\nZFS: Loaded module v0.6.1-rc14, ZFS pool version 5000, ZFS filesystem version 5\r\n<\/pre>\n

Import pool, mount and chroot:<\/strong><\/span><\/p>\n

\r\n# zpool import -d \/dev\/disk\/by-id -R \/mnt rpool\r\n# mount \/dev\/disk\/by-id\/scsi-SATA_VBOX_HARDDISK_VBb59e0ffb-68fb0252-part1 \/mnt\/boot\/grub\r\n\r\n# mount --bind \/dev \/mnt\/dev\r\n# mount --bind \/proc \/mnt\/proc\r\n# mount --bind \/sys \/mnt\/sys\r\n# chroot \/mnt \/bin\/bash --login\r\n<\/pre>\n

Distribution Upgrade:<\/strong><\/span><\/p>\n

\r\n# locale-gen en_US.UTF-8\r\n# apt-get update\r\n# apt-get dist-upgrade\r\n<\/pre>\n

** At this point remove any old kernels manually if you want.<\/p>\n

Fix grub:<\/strong><\/span><\/p>\n

\r\n# grub-probe \/\r\n zfs\r\n\r\n# ls \/boot\/grub\/i386-pc\/zfs*\r\n \/boot\/grub\/i386-pc\/zfs.mod \/boot\/grub\/i386-pc\/zfsinfo.mod\r\n\r\n# update-initramfs -c -k all\r\n\r\n# update-grub\r\n\r\n# grep boot=zfs \/boot\/grub\/grub.cfg\r\n<\/pre>\n

** Currently a bug in the Ubuntu 13.04 grub scripts. Look at boot lines there is a duplicated string \/ROOT\/ubuntu-1\/@<\/span><\/strong>\/ROOT\/ubuntu-1@\/\u00a0in there.<\/p>\n

According to\u00a0https:\/\/github.com\/zfsonlinux\/zfs\/issues\/1441 it can be fixed with grub-install below. \u00a0That did not work for me though I fixed it manually.<\/p>\n

\r\n# grub-install $(readlink -f \/dev\/disk\/by-id\/scsi-SATA_VBOX_HARDDISK_VBb59e0ffb-68fb0252)\r\n Installation finished. No error reported.\r\n<\/pre>\n

Unmount and reboot:<\/span><\/strong><\/p>\n

\r\n# umount \/mnt\/boot\/grub\r\n# umount \/mnt\/dev\r\n# umount \/mnt\/proc\r\n# umount \/mnt\/sys\r\n# zfs umount -a\r\n# zpool export rpool\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

Update 1: On a subsequent kernel upgrade to 3.8.0.25 I realized that the zfs modules are getting compiled just fine<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,31,30],"tags":[],"class_list":["post-341","post","type-post","status-publish","format-standard","hentry","category-linux","category-ubuntu","category-zfs"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=341"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/341\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}