{"action":"opened","issue":{"url":"https://api.github.com/repos/archzfs/archzfs/issues/44","labels_url":"https://api.github.com/repos/archzfs/archzfs/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/archzfs/archzfs/issues/44/comments","events_url":"https://api.github.com/repos/archzfs/archzfs/issues/44/events","html_url":"https://github.com/archzfs/archzfs/issues/44","id":109859012,"number":44,"title":"bogus errors in ZFS hook","user":{"login":"Bronek","id":823856,"avatar_url":"https://avatars.githubusercontent.com/u/823856?v=3","gravatar_id":"","url":"https://api.github.com/users/Bronek","html_url":"https://github.com/Bronek","followers_url":"https://api.github.com/users/Bronek/followers","following_url":"https://api.github.com/users/Bronek/following{/other_user}","gists_url":"https://api.github.com/users/Bronek/gists{/gist_id}","starred_url":"https://api.github.com/users/Bronek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bronek/subscriptions","organizations_url":"https://api.github.com/users/Bronek/orgs","repos_url":"https://api.github.com/users/Bronek/repos","events_url":"https://api.github.com/users/Bronek/events{/privacy}","received_events_url":"https://api.github.com/users/Bronek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-05T18:38:09Z","updated_at":"2015-10-05T18:38:09Z","closed_at":null,"body":"I used to have bogus errors when booting system with ZFS root device \r\n```\r\nLoading ../vmlinuz-linux... ok\r\nLoading ../initramfs-linux.img...ok\r\n:: running early hook [udev]\r\nstarting version 225\r\n:: running hook [udev]\r\n:: Triggering uevents...\r\n:: running hook [zfs]\r\nash: 1: unknown operand\r\ncannot open 'zroot': no such pool\r\nZFS: Importing pool zroot.\r\n:: running late hook [zfs]\r\n:: running cleanup hook [udev]\r\n```\r\n\r\nI suggest to update initcpio hook to get rid of these errors like the following\r\n\r\n```\r\ndiff --git a/zfs-utils.initcpio.hook b/zfs-utils.initcpio.hook\r\nindex 3a92894..64e71be 100644\r\n--- a/zfs-utils.initcpio.hook\r\n+++ b/zfs-utils.initcpio.hook\r\n@@ -35,7 +35,7 @@ zfs_mount_handler () {\r\n     local pool=\"${ZFS_DATASET%%/*}\"\r\n     local rwopt_exp=${rwopt:-ro}\r\n\r\n-    if ! \"/usr/bin/zpool\" list -H $pool 2>&1 > /dev/null ; then\r\n+    if ! \"/usr/bin/zpool\" list -H $pool 2>1 > /dev/null ; then\r\n         if [ \"$rwopt_exp\" != \"rw\" ]; then\r\n             msg \"ZFS: Importing pool $pool readonly.\"\r\n             ZPOOL_IMPORT_FLAGS=\"$ZPOOL_IMPORT_FLAGS -o readonly=on\"\r\n@@ -60,14 +60,14 @@ zfs_mount_handler () {\r\n run_hook() {\r\n     # Force import the pools, useful if the pool has not properly been exported\r\n     # using 'zpool export <pool>'\r\n-    [[ $zfs_force == 1 ]] && ZPOOL_FORCE='-f'\r\n-    [[ \"$zfs_import_dir\" != \"\" ]] && ZPOOL_IMPORT_FLAGS=\"$ZPOOL_IMPORT_FLAGS -d $zfs_import_dir\"\r\n+    [[ \"{$zfs_force}\" = 1 ]] && ZPOOL_FORCE='-f'\r\n+    [[ \"{$zfs_import_dir}\" != \"\" ]] && ZPOOL_IMPORT_FLAGS=\"$ZPOOL_IMPORT_FLAGS -d $zfs_import_dir\"\r\n\r\n-    if [ \"$root\" = 'zfs' ]; then\r\n+    if [ \"{$root}\" = zfs ]; then\r\n         mount_handler='zfs_mount_handler'\r\n     fi\r\n\r\n-    case $zfs in\r\n+    case ${zfs} in\r\n         \"\")\r\n             # skip this line/dataset\r\n             ;;\r\n@@ -76,7 +76,7 @@ run_hook() {\r\n             mount_handler=\"zfs_mount_handler\"\r\n             ;;\r\n         *)\r\n-            ZFS_DATASET=$zfs\r\n+            ZFS_DATASET=${zfs}\r\n             mount_handler=\"zfs_mount_handler\"\r\n             ;;\r\n     esac\r\n```\r\n"}}