Ubuntu 16.04 を ZFS Root でインストールすると grub-probe: error: failed to get canonical path of なんたら

## Ubuntu 16.04 on ZFS Root

https://github.com/zfsonlinux/zfs/wiki/Ubuntu-16.04-Root-on-ZFS に書いてある通りにやれば概ねうまく行きます…が、ハマりポイントが。

## 問題と対処方法

```
# grub-probe /
grub-probe: error: failed to get canonical path of `/dev/nvme-SAMSUNG_MZVKW512HMJP-00000_S316NA0HA02470'.
```

ググったところ、これと同じ現象だった。 https://askubuntu.com/questions/827126/zfs-grub-probe-error-failed-to-get-canonical-path-of-dev-disk-name/943425#943425

`export ZPOOL_VDEV_NAME_PATH=1` してから続行すればOK。

## 2017-10-25追記

`apt upgrade` してkernel等が更新される時にも同じ現象が発生するので `/etc/environment` に書いておいた方がいいかも知れない。

```
export ZPOOL_VDEV_NAME_PATH=1
```

## あとがき

入力コマンド多くてめんどすぎるのでインストーラが対応してくれると嬉しいと思ったが、ともかくZFSがUbuntuでも使えて幸せ。ZFSはいいぞ。

あと、なんか `/var/lib/docker` をZFSにしてるとDockerさんがZFS storage driverのおかげでうまいこと使ってくれてるらしい。ステキ。

```
$ sudo zfs list
NAME                                                                                     USED  AVAIL  REFER  MOUNTPOINT
rpool                                                                                   6.67G   454G    96K  /
rpool/ROOT                                                                               730M   454G    96K  none
rpool/ROOT/ubuntu                                                                        730M   454G   596M  /
rpool/home                                                                              1.15G   454G  1.15G  /home
rpool/home/root                                                                          116K   454G   116K  /root
rpool/swap                                                                              4.25G   459G    64K  -
rpool/var                                                                                565M   454G    96K  /var
rpool/var/cache                                                                          127M   454G   127M  /var/cache
rpool/var/docker                                                                         437M   454G  2.44M  /var/lib/docker
rpool/var/docker/0aaacb3138f365e1d4c9d964a1b4a10492f83ec443ca87b9c6d0764f272daa4e        144K   454G   177M  legacy
rpool/var/docker/109ae97aed9f6a3c2206b69bb6c8e47501fd81055bba01d46da683f5b98c928a       91.1M   454G   402M  legacy
rpool/var/docker/369076459d433adc3864d6f8fc25939b5155220f434456e78b721f0170ffd756        136K   454G   177M  legacy
rpool/var/docker/3d97fe01e33c6b131875009213dc48062e55761298c5064c587703fbd5d38ca9        336K   454G   402M  legacy
rpool/var/docker/45f269bd976694049e6bc6de384a2ecee04cbf1fac0a1cf4b2b36b5e279f26fe        112K   454G   310M  legacy
rpool/var/docker/4a2fcd050b468dae60876722da2ce32417c6db3feb9518d00ddc1c96af6ead25        120K   454G   102M  legacy
rpool/var/docker/59bb8f36e8a3b79187a7b614031d603e7496f54071471860f1dba6bb0838b945        544K   454G   403M  legacy
rpool/var/docker/6c64c52e51fea90aaf3348389f5211033d48c567df7d614a8f6f7a96ca5f8b26        124K   454G   177M  legacy
rpool/var/docker/76f0d5d1c90273ae2cc66804cf76d7dabdc258982d77e0148b05651fb8870f7b        112K   454G   402M  legacy
rpool/var/docker/81d8a1fdfac94e536022daf5bfdd2e97e79de9f20ca9c835b6397ed929de51ef         64K   454G   116K  legacy
rpool/var/docker/81d8a1fdfac94e536022daf5bfdd2e97e79de9f20ca9c835b6397ed929de51ef-init    96K   454G   116K  legacy
rpool/var/docker/8b4c060de084290d631cf3cc23e472b4a5996023844cf7f1991d0227363385f6        116K   454G   310M  legacy
rpool/var/docker/924cef4f8b52d6dff39e22de47f73813bbd86bd87e9d11ee248d23bef7ba74ed       76.7M   454G   177M  legacy
rpool/var/docker/95bfeb74816304f20cb37ed58c261c75cc062fbe3cc52871885ad884cc4b79d1        100K   454G   100K  legacy
rpool/var/docker/994e42058dbb89c7b9f54ce08f0373434bc0a3fa8e75daf0054c376014d2ef90        168K   454G   102M  legacy
rpool/var/docker/ad974f4b93c83cdd16daa580c42c294f25083ad828fd4c89c7d6a3f0e9d4157b        116K   454G   310M  legacy
rpool/var/docker/ae2cdec0dacb92dfcf36060601f88dbc7c41089c18afadc04d145f48c6d39553        232K   454G  90.3M  legacy
rpool/var/docker/af7685f0366cde61798c189da6c806f3e09e187458cf32d51c98b34905479306       90.3M   454G  90.3M  legacy
rpool/var/docker/b3ede8363841c8c0344e5d7e61078c1f6d79606f9ad1cce0518dffae5b38d5c6        104K   454G   177M  legacy
rpool/var/docker/ba9e8732c0c14341a1f20a01d44b43237fa8a4f2dd9abfc4b5c17061182f4198        158M   454G   310M  legacy
rpool/var/docker/c25bcbd9be4a1467fb790a3b2a55ab2722ce0ac0e802a69849797bc14e1b06f4        824K   454G   402M  legacy
rpool/var/docker/d91dd9229ca9c1f5f3abca276e64d5d9dd338c1cbf57dcca57b72fa9860100c6       1.98M   454G  91.1M  legacy
rpool/var/docker/dde1751b5f2dc92c16bc14eb49845d20d5afc79c5e802a4f689e4fc0549a96c4       12.7M   454G   102M  legacy
rpool/var/docker/e172e784d8125cf9d12e7caa228f175d356dc63c6f3716f413d4c623ee8d71bc        164K   454G   177M  legacy
rpool/var/log                                                                           1.42M   454G  1.42M  legacy
rpool/var/nfs                                                                             96K   454G    96K  /var/lib/nfs
rpool/var/spool                                                                           96K   454G    96K  /var/spool
rpool/var/tmp                                                                            128K   454G   128K  legacy
$ sudo zfs list -t snapshot
NAME                                                                                               USED  AVAIL  REFER  MOUNTPOINT
rpool/ROOT/ubuntu@install                                                                          134M      -   428M  -
rpool/var/docker/0aaacb3138f365e1d4c9d964a1b4a10492f83ec443ca87b9c6d0764f272daa4e@527162310           0      -   177M  -
rpool/var/docker/109ae97aed9f6a3c2206b69bb6c8e47501fd81055bba01d46da683f5b98c928a@609333623           0      -   402M  -
rpool/var/docker/369076459d433adc3864d6f8fc25939b5155220f434456e78b721f0170ffd756@297918631           0      -   177M  -
rpool/var/docker/3d97fe01e33c6b131875009213dc48062e55761298c5064c587703fbd5d38ca9@852818813           0      -   402M  -
rpool/var/docker/45f269bd976694049e6bc6de384a2ecee04cbf1fac0a1cf4b2b36b5e279f26fe@509857509           0      -   310M  -
rpool/var/docker/4a2fcd050b468dae60876722da2ce32417c6db3feb9518d00ddc1c96af6ead25@235067456           0      -   102M  -
rpool/var/docker/5d3515381e591ced9cc8eaa04e90fb59b06f817c381b5640c91aa2d3b26a9fd4@481486000           0      -  79.3M  -
rpool/var/docker/6c64c52e51fea90aaf3348389f5211033d48c567df7d614a8f6f7a96ca5f8b26@748012719           0      -   177M  -
rpool/var/docker/76f0d5d1c90273ae2cc66804cf76d7dabdc258982d77e0148b05651fb8870f7b@208507973           0      -   402M  -
rpool/var/docker/81d8a1fdfac94e536022daf5bfdd2e97e79de9f20ca9c835b6397ed929de51ef-init@886456240      0      -   116K  -
rpool/var/docker/8b4c060de084290d631cf3cc23e472b4a5996023844cf7f1991d0227363385f6@436875356           0      -   310M  -
rpool/var/docker/91e9d8907939e828a3125b1191d29cce9c780b71e016a9d261a0fbef728980b0@23615240            0      -  72.2M  -
rpool/var/docker/924cef4f8b52d6dff39e22de47f73813bbd86bd87e9d11ee248d23bef7ba74ed@969024219           0      -   177M  -
rpool/var/docker/95bfeb74816304f20cb37ed58c261c75cc062fbe3cc52871885ad884cc4b79d1@809046251           0      -   100K  -
rpool/var/docker/994e42058dbb89c7b9f54ce08f0373434bc0a3fa8e75daf0054c376014d2ef90@445200769           0      -   102M  -
rpool/var/docker/a6b14f4ab9d7345dcd7bd5f9a43ffe1ecdabd0aaec72517b6f42b781dc7dc518@594635060           0      -  79.3M  -
rpool/var/docker/ad974f4b93c83cdd16daa580c42c294f25083ad828fd4c89c7d6a3f0e9d4157b@93431459            0      -   310M  -
rpool/var/docker/ae2cdec0dacb92dfcf36060601f88dbc7c41089c18afadc04d145f48c6d39553@456453904           0      -  90.3M  -
rpool/var/docker/af7685f0366cde61798c189da6c806f3e09e187458cf32d51c98b34905479306@331942715           0      -  90.3M  -
rpool/var/docker/b3ede8363841c8c0344e5d7e61078c1f6d79606f9ad1cce0518dffae5b38d5c6@499943365           0      -   177M  -
rpool/var/docker/b90b20699bb19211ea0f9e00cfafd3a7d0a258a10a209d09b661b9d207d1ac4b@809108571           0      -  72.2M  -
rpool/var/docker/ba9e8732c0c14341a1f20a01d44b43237fa8a4f2dd9abfc4b5c17061182f4198@523936063           0      -   310M  -
rpool/var/docker/c25bcbd9be4a1467fb790a3b2a55ab2722ce0ac0e802a69849797bc14e1b06f4@765601723           0      -   402M  -
rpool/var/docker/d91dd9229ca9c1f5f3abca276e64d5d9dd338c1cbf57dcca57b72fa9860100c6@729483018           0      -  91.1M  -
rpool/var/docker/dde1751b5f2dc92c16bc14eb49845d20d5afc79c5e802a4f689e4fc0549a96c4@102507222           0      -   102M  -
rpool/var/docker/e172e784d8125cf9d12e7caa228f175d356dc63c6f3716f413d4c623ee8d71bc@82883823            0      -   177M  -
```