delete from hateblo.jp where 1=1;

タイトルに意味はありません。

zfsonlinuxのバージョンアップ

対象

目的

wheezyにて zfsonlinuxのrepositoryが公開されたため、そちらを利用すれば、さようならビルドできる。

方法

関連するサービスおよびマウントを解除する

zfs stopでマウント等が解除される

sudo /etc/init.d/samba stop
sudo /etc/init.d/libvirt-bin stop
sudo /etc/init.d/zfs stop
zfsをアンインストールする

removeではなく、purgeで過去のものを削除する。
そうしないとDKMSで古いパスを使用されてエラーとなってしまう。

スペルミスで違うものを消すと大変なことになるので、zfs関連パッケージであることを確認してからyをしてください。

sudo aptitude purge zfs-modules zfs-modules-devel zfs zfs-devel spl spl-devel spl-modules spl-modules-devel 
repositoryをインストールする

zfsonlinuxの手順に従い、インストールを行う

cd ~
wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_2%7Ewheezy_all.deb
sudo dpkg -i zfsonlinux_2~wheezy_all.deb
sudo apt-get update
パッケージをインストールする
sudo apt-get install debian-zfs

DKMSが正常に終了していることを確認したうえで、再起動をして、いけてることを確認する。

sudo zpool status

トラブルシューティング

すでに「やっちまった」場合

発生現象

エラー終了にはならないが、ログに「zfs-dkms」で「configure: error:」となっていることがある。
これは異常であるため、古いパッケージを削除してあげる必要がある。

user@debian:/home$ sudo apt-get install debian-zfs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  cpp-4.6 dkms gcc-4.6 gcc-4.6-base libnvpair1 libuutil1 libzfs1 libzpool1 linux-headers-3.2.0-4-amd64
  linux-headers-3.2.0-4-common linux-headers-amd64 linux-kbuild-3.2 spl spl-dkms zfs-dkms zfsutils
Suggested packages:
  gcc-4.6-locales zfs-auto-snapshot gcc-4.6-multilib libmudflap0-4.6-dev gcc-4.6-doc libgcc1-dbg libgomp1-dbg
  libquadmath0-dbg libmudflap0-dbg binutils-gold zfs-initramfs
Recommended packages:
  linux-headers
The following NEW packages will be installed:
  cpp-4.6 debian-zfs dkms gcc-4.6 gcc-4.6-base libnvpair1 libuutil1 libzfs1 libzpool1 linux-headers-3.2.0-4-amd64
  linux-headers-3.2.0-4-common linux-headers-amd64 linux-kbuild-3.2 spl spl-dkms zfs-dkms zfsutils
0 upgraded, 17 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/20.4 MB of archives.
After this operation, 72.1 MB of additional disk space will be used.
Do you want to continue [Y/n]? 
Selecting previously unselected package dkms.
(Reading database ... 183672 files and directories currently installed.)

(中略)

Setting up spl-dkms (0.6.1-1~wheezy) ...
Loading new spl-0.6.1 DKMS files...
First Installation: checking all kernels...
Building only for 3.2.0-4-amd64
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.
Selecting previously unselected package zfs-dkms.
(Reading database ... 184000 files and directories currently installed.)
Unpacking zfs-dkms (from .../zfs-dkms_0.6.1-1~wheezy_amd64.deb) ...

(中略)

Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64
Setting up zfs-dkms (0.6.1-1~wheezy) ...
Loading new zfs-0.6.1 DKMS files...
First Installation: checking all kernels...
Building only for 3.2.0-4-amd64
Building initial module for 3.2.0-4-amd64
configure: error: 
        *** Please make sure the kmod spl devel <kernel> package for your
        *** distribution is installed then try again.  If that fails you
        *** can specify the location of the spl objects with the
        *** '--with-spl-obj=PATH' option.
Error! Bad return status for module build on kernel: 3.2.0-4-amd64 (x86_64)
Consult /var/lib/dkms/zfs/0.6.1/build/make.log for more information.

(中略)

Setting up zfsutils (0.6.1-1~wheezy) ...
insserv: script zfs: service zfs already provided!
insserv: script zfs: service zfs already provided!

(中略)

Setting up debian-zfs (7~wheezy) ...
対応方法

いったんキレイキレイする。(以下のログには複数コマンドを記載していますのでご注意ください)

user@debian:/home/user$ sudo aptitude purge zfs-modules-devel zfs
The following packages will be REMOVED:  
  zfs{p} zfs-modules-devel{p} 
0 packages upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Do you want to continue? [Y/n/?] y
(Reading database ... 193760 files and directories currently installed.)
Removing zfs ...
Purging configuration files for zfs ...
Removing zfs-modules-devel ...
Purging configuration files for zfs-modules-devel ...
                                         
user@debian:/home/user$ sudo aptitude purge spl-modules          
The following packages will be REMOVED:  
  spl-modules{p} 
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
Do you want to continue? [Y/n/?] 
(Reading database ... 193751 files and directories currently installed.)
Removing spl-modules ...
Purging configuration files for spl-modules ...
ERROR: fstatat(3, build.save): No such file or directory
WARNING: /lib/modules/2.6.32-5-amd64/addon/zfs/zpios/zpios.ko needs unknown symbol spl_cleanup

(中略)

WARNING: /lib/modules/2.6.32-5-amd64/addon/zfs/zfs/zfs.ko needs unknown symbol vn_fsync
WARNING: could not open /lib/modules/2.6.32-5-amd64/modules.builtin: No such file or directory



user@debian:/home/user$ sudo aptitude purge zfs-dkms
The following packages will be REMOVED:  
  zfs-dkms{p} 
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 10.5 MB will be freed.
The following packages have unmet dependencies:
 debian-zfs : Depends: zfs-dkms but it is not going to be installed.
The following actions will resolve these dependencies:

     Remove the following packages:              
1)     debian-zfs                                

     Leave the following dependencies unresolved:
2)     zfsonlinux recommends debian-zfs          
3)     zfsutils recommends zfs-dkms              


Accept this solution? [Y/n/q/?] 
The following packages will be REMOVED:
  debian-zfs{a} zfs-dkms{p} 
0 packages upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 10.5 MB will be freed.
Do you want to continue? [Y/n/?] 
(Reading database ... 193751 files and directories currently installed.)
Removing debian-zfs ...
(Reading database ... 193748 files and directories currently installed.)
Removing zfs-dkms ...

-------- Uninstall Beginning --------
Module:  zfs
Version: 0.6.1
Kernel:  3.2.0-4-amd64 (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

zavl.ko:
zcommon.ko:
znvpair.ko:
zpios.ko:
zunicode.ko
zfs.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.2.0-4-amd64/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

Backing up initrd.img-3.2.0-4-amd64 to /boot/initrd.img-3.2.0-4-amd64.old-dkms
Making new initrd.img-3.2.0-4-amd64
(If next boot fails, revert to initrd.img-3.2.0-4-amd64.old-dkms image)
update-initramfs....

DKMS: uninstall completed.

------------------------------
Deleting module version: 0.6.1
completely from the DKMS tree.
------------------------------
Done.
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64


きれいになったら、再度インストールする

user@debian:/home/user$ sudo aptitude install zfs-dkms
The following NEW packages will be installed:
  zfs-dkms 
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2082 kB of archives. After unpacking 10.5 MB will be used.
Selecting previously unselected package zfs-dkms.
(Reading database ... 193075 files and directories currently installed.)
Unpacking zfs-dkms (from .../zfs-dkms_0.6.1-1~wheezy_amd64.deb) ...
Setting up zfs-dkms (0.6.1-1~wheezy) ...
Loading new zfs-0.6.1 DKMS files...
First Installation: checking all kernels...
Building only for 3.2.0-4-amd64
Building initial module for 3.2.0-4-amd64
Done.

zavl:
zcommon.ko:
znvpair.ko:
zpios.ko:
zunicode.ko:
zfs.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

depmod....

Backing up initrd.img-3.2.0-4-amd64 to /boot/initrd.img-3.2.0-4-amd64.old-dkms
Making new initrd.img-3.2.0-4-amd64
(If next boot fails, revert to initrd.img-3.2.0-4-amd64.old-dkms image)
update-initramfs....

DKMS: install completed.
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64

※同じようなログは省略しています

変更履歴

2013/11/24

aptitude updateでgpgキーが一致しない旨のエラーが出るので、何でだろうと思っていたら、キーが変わっていたみたいなので、zfsonlinux_1~wheezy_all.deb → zfsonlinux_2~wheezy_all.deb へ変更。