]> git.proxmox.com Git - mirror_zfs-debian.git/blob - debian/patches/0004-Remove-the-upstream-dracut-component.patch
Refresh debian/patches after upstream merge.
[mirror_zfs-debian.git] / debian / patches / 0004-Remove-the-upstream-dracut-component.patch
1 From: Darik Horn <dajhorn@vanadac.com>
2 Date: Tue, 17 Jan 2012 20:27:32 -0600
3 Subject: Remove the upstream dracut component.
4
5 The dracut/ component broke deb systems when it first added to the
6 upstream ZoL repository, had a near-zero download count when it was
7 fixed, seems to be unmaintained, and is incompatible with the
8 dracut-005 package that is currently published in Debian and Ubuntu.
9 ---
10 Makefile.am | 2 +-
11 configure.ac | 2 -
12 dracut/90zfs/.gitignore | 3 -
13 dracut/90zfs/Makefile.am | 21 -----
14 dracut/90zfs/module-setup.sh.in | 55 -------------
15 dracut/90zfs/mount-zfs.sh.in | 71 -----------------
16 dracut/90zfs/parse-zfs.sh.in | 58 --------------
17 dracut/Makefile.am | 3 -
18 dracut/README.dracut.markdown | 166 ---------------------------------------
19 9 files changed, 1 insertion(+), 380 deletions(-)
20 delete mode 100644 dracut/90zfs/.gitignore
21 delete mode 100644 dracut/90zfs/Makefile.am
22 delete mode 100755 dracut/90zfs/module-setup.sh.in
23 delete mode 100755 dracut/90zfs/mount-zfs.sh.in
24 delete mode 100755 dracut/90zfs/parse-zfs.sh.in
25 delete mode 100644 dracut/Makefile.am
26 delete mode 100644 dracut/README.dracut.markdown
27
28 diff --git a/Makefile.am b/Makefile.am
29 index 833bee6..fac18fd 100644
30 --- a/Makefile.am
31 +++ b/Makefile.am
32 @@ -5,7 +5,7 @@ include $(top_srcdir)/config/arch.am
33
34 SUBDIRS = include
35 if CONFIG_USER
36 -SUBDIRS += dracut udev etc man scripts lib cmd
37 +SUBDIRS += udev etc man scripts lib cmd
38 endif
39 if CONFIG_KERNEL
40 SUBDIRS += module
41 diff --git a/configure.ac b/configure.ac
42 index da40356..2e136d3 100644
43 --- a/configure.ac
44 +++ b/configure.ac
45 @@ -56,8 +56,6 @@ ZFS_AC_DEBUG_DMU_TX
46
47 AC_CONFIG_FILES([
48 Makefile
49 - dracut/Makefile
50 - dracut/90zfs/Makefile
51 udev/Makefile
52 udev/rules.d/Makefile
53 etc/Makefile
54 diff --git a/dracut/90zfs/.gitignore b/dracut/90zfs/.gitignore
55 deleted file mode 100644
56 index 6f4a5ae..0000000
57 --- a/dracut/90zfs/.gitignore
58 +++ /dev/null
59 @@ -1,3 +0,0 @@
60 -module-setup.sh
61 -mount-zfs.sh
62 -parse-zfs.sh
63 diff --git a/dracut/90zfs/Makefile.am b/dracut/90zfs/Makefile.am
64 deleted file mode 100644
65 index 4112061..0000000
66 --- a/dracut/90zfs/Makefile.am
67 +++ /dev/null
68 @@ -1,21 +0,0 @@
69 -pkgdracutdir = $(datadir)/dracut/modules.d/90zfs
70 -pkgdracut_SCRIPTS = \
71 - $(top_srcdir)/dracut/90zfs/module-setup.sh \
72 - $(top_srcdir)/dracut/90zfs/mount-zfs.sh \
73 - $(top_srcdir)/dracut/90zfs/parse-zfs.sh
74 -
75 -EXTRA_DIST = \
76 - $(top_srcdir)/dracut/90zfs/module-setup.sh.in \
77 - $(top_srcdir)/dracut/90zfs/mount-zfs.sh.in \
78 - $(top_srcdir)/dracut/90zfs/parse-zfs.sh.in
79 -
80 -$(pkgdracut_SCRIPTS):
81 - -$(SED) -e 's,@bindir\@,$(bindir),g' \
82 - -e 's,@sbindir\@,$(sbindir),g' \
83 - -e 's,@udevdir\@,$(udevdir),g' \
84 - -e 's,@udevruledir\@,$(udevruledir),g' \
85 - -e 's,@sysconfdir\@,$(sysconfdir),g' \
86 - '$@.in' >'$@'
87 -
88 -distclean-local::
89 - -$(RM) $(pkgdracut_SCRIPTS)
90 diff --git a/dracut/90zfs/module-setup.sh.in b/dracut/90zfs/module-setup.sh.in
91 deleted file mode 100755
92 index c01915e..0000000
93 --- a/dracut/90zfs/module-setup.sh.in
94 +++ /dev/null
95 @@ -1,55 +0,0 @@
96 -#!/bin/sh
97 -
98 -check() {
99 - # We depend on udev-rules being loaded
100 - [ "$1" = "-d" ] && return 0
101 -
102 - # Verify the zfs tool chain
103 - which zpool >/dev/null 2>&1 || return 1
104 - which zfs >/dev/null 2>&1 || return 1
105 -
106 - return 0
107 -}
108 -
109 -depends() {
110 - echo udev-rules
111 - return 0
112 -}
113 -
114 -installkernel() {
115 - instmods zfs
116 - instmods zcommon
117 - instmods znvpair
118 - instmods zavl
119 - instmods zunicode
120 - instmods spl
121 - instmods zlib_deflate
122 - instmods zlib_inflate
123 -}
124 -
125 -install() {
126 - inst_rules @udevruledir@/90-zfs.rules
127 - inst_rules @udevruledir@/60-zpool.rules
128 - inst_rules @udevruledir@/60-zvol.rules
129 - inst @sysconfdir@/zfs/zdev.conf
130 - inst @sysconfdir@/zfs/zpool.cache
131 - dracut_install @sbindir@/zfs
132 - dracut_install @sbindir@/zpool
133 - dracut_install @bindir@/zpool_layout
134 - dracut_install @udevdir@/zpool_id
135 - dracut_install @udevdir@/zvol_id
136 - dracut_install mount.zfs
137 - dracut_install hostid
138 - inst_hook cmdline 95 "$moddir/parse-zfs.sh"
139 - inst_hook mount 98 "$moddir/mount-zfs.sh"
140 -
141 - # Synchronize initramfs and system hostid
142 - TMP=`mktemp`
143 - AA=`hostid | cut -b 1,2`
144 - BB=`hostid | cut -b 3,4`
145 - CC=`hostid | cut -b 5,6`
146 - DD=`hostid | cut -b 7,8`
147 - printf "\x$DD\x$CC\x$BB\x$AA" >$TMP
148 - inst_simple "$TMP" /etc/hostid
149 - rm "$TMP"
150 -}
151 diff --git a/dracut/90zfs/mount-zfs.sh.in b/dracut/90zfs/mount-zfs.sh.in
152 deleted file mode 100755
153 index 2d2afd8..0000000
154 --- a/dracut/90zfs/mount-zfs.sh.in
155 +++ /dev/null
156 @@ -1,71 +0,0 @@
157 -#!/bin/sh
158 -
159 -. /lib/dracut-lib.sh
160 -
161 -ZPOOL_FORCE=""
162 -
163 -if getargbool 0 zfs_force -y zfs.force -y zfsforce ; then
164 - warn "ZFS: Will force-import pools if necessary."
165 - ZPOOL_FORCE="-f"
166 -fi
167 -
168 -case "$root" in
169 - zfs:*)
170 - # We have ZFS modules loaded, so we're able to import pools now.
171 - if [ "$root" = "zfs:AUTO" ] ; then
172 - # Need to parse bootfs attribute
173 - info "ZFS: Attempting to detect root from imported ZFS pools."
174 -
175 - # Might be imported by the kernel module, so try searching before
176 - # we import anything.
177 - zfsbootfs=`zpool list -H -o bootfs | sed -n '/-/ !p' | sed 'q'`
178 - if [ "$?" != "0" ] || [ "$zfsbootfs" = "" ] || \
179 - [ "$zfsbootfs" = "no pools available" ] ; then
180 - # Not there, so we need to import everything.
181 - info "ZFS: Attempting to import additional pools."
182 - zpool import -N -a ${ZPOOL_FORCE}
183 - zfsbootfs=`zpool list -H -o bootfs | sed -n '/-/ !p' | sed 'q'`
184 - if [ "$?" != "0" ] || [ "$zfsbootfs" = "" ] || \
185 - [ "$zfsbootfs" = "no pools available" ] ; then
186 - rootok=0
187 - pool=""
188 -
189 - warn "ZFS: No bootfs attribute found in importable pools."
190 -
191 - # Re-export everything since we're not prepared to take
192 - # responsibility for them.
193 - zpool list -H | while read fs rest ; do
194 - zpool export "$fs"
195 - done
196 -
197 - return 1
198 - fi
199 - fi
200 - info "ZFS: Using ${zfsbootfs} as root."
201 - else
202 - # Should have an explicit pool set, so just import it and we're done.
203 - zfsbootfs="${root#zfs:}"
204 - pool="${zfsbootfs%%/*}"
205 - if ! zpool list -H $pool > /dev/null ; then
206 - # pool wasn't imported automatically by the kernel module, so
207 - # try it manually.
208 - info "ZFS: Importing pool ${pool}..."
209 - if ! zpool import -N ${ZPOOL_FORCE} $pool ; then
210 - warn "ZFS: Unable to import pool ${pool}."
211 - rootok=0
212 -
213 - return 1
214 - fi
215 - fi
216 - fi
217 -
218 - # Above should have left our rpool imported and pool/dataset in $root.
219 - # We need zfsutil for non-legacy mounts and not for legacy mounts.
220 - mountpoint=`zfs get -H -o value mountpoint $zfsbootfs`
221 - if [ "$mountpoint" = "legacy" ] ; then
222 - mount -t zfs "$zfsbootfs" "$NEWROOT" && ROOTFS_MOUNTED=yes
223 - else
224 - mount -o zfsutil -t zfs "$zfsbootfs" "$NEWROOT" && ROOTFS_MOUNTED=yes
225 - fi
226 - ;;
227 -esac
228 diff --git a/dracut/90zfs/parse-zfs.sh.in b/dracut/90zfs/parse-zfs.sh.in
229 deleted file mode 100755
230 index 571d263..0000000
231 --- a/dracut/90zfs/parse-zfs.sh.in
232 +++ /dev/null
233 @@ -1,58 +0,0 @@
234 -#!/bin/sh
235 -
236 -. /lib/dracut-lib.sh
237 -
238 -# Let the command line override our host id.
239 -spl_hostid=`getarg spl_hostid=`
240 -if [ "${spl_hostid}" != "" ] ; then
241 - info "ZFS: Using hostid from command line: ${spl_hostid}"
242 - AA=`echo ${spl_hostid} | cut -b 1,2`
243 - BB=`echo ${spl_hostid} | cut -b 3,4`
244 - CC=`echo ${spl_hostid} | cut -b 5,6`
245 - DD=`echo ${spl_hostid} | cut -b 7,8`
246 - printf "\x$DD\x$CC\x$BB\x$AA" >/etc/hostid
247 -elif [ -f /etc/hostid ] ; then
248 - info "ZFS: Using hostid from /etc/hostid: `hostid`"
249 -else
250 - warn "ZFS: No hostid found on kernel command line or /etc/hostid. "
251 - warn "ZFS: Pools may not import correctly."
252 -fi
253 -
254 -case "$root" in
255 - ""|zfs|zfs:)
256 - # We'll take root unset, root=zfs, or root=zfs:
257 - # No root set, so we want to read the bootfs attribute. We
258 - # can't do that until udev settles so we'll set dummy values
259 - # and hope for the best later on.
260 - root="zfs:AUTO"
261 - rootok=1
262 - wait_for_zfs=1
263 -
264 - info "ZFS: Enabling autodetection of bootfs after udev settles."
265 - ;;
266 -
267 - ZFS\=*|zfs:*|zfs:FILESYSTEM\=*|FILESYSTEM\=*)
268 - # root is explicit ZFS root. Parse it now. We can handle
269 - # a root=... param in any of the following formats:
270 - # root=ZFS=rpool/ROOT
271 - # root=zfs:rpool/ROOT
272 - # root=zfs:FILESYSTEM=rpool/ROOT
273 - # root=FILESYSTEM=rpool/ROOT
274 -
275 - # Strip down to just the pool/fs
276 - root="${root#zfs:}"
277 - root="${root#FILESYSTEM=}"
278 - root="zfs:${root#ZFS=}"
279 - rootok=1
280 - wait_for_zfs=1
281 -
282 - info "ZFS: Set ${root} as bootfs."
283 - ;;
284 -esac
285 -
286 -# Make sure Dracut is happy that we have a root and will wait for ZFS
287 -# modules to settle before mounting.
288 -if [ "${wait_for_zfs}" = "1" ]; then
289 - ln -s /dev/null /dev/root 2>/dev/null
290 - echo '[ -e /dev/zfs ]' > $hookdir/initqueue/finished/zfs.sh
291 -fi
292 diff --git a/dracut/Makefile.am b/dracut/Makefile.am
293 deleted file mode 100644
294 index 35b88c3..0000000
295 --- a/dracut/Makefile.am
296 +++ /dev/null
297 @@ -1,3 +0,0 @@
298 -SUBDIRS = 90zfs
299 -
300 -EXTRA_DIST = README.dracut.markdown
301 diff --git a/dracut/README.dracut.markdown b/dracut/README.dracut.markdown
302 deleted file mode 100644
303 index 909273a..0000000
304 --- a/dracut/README.dracut.markdown
305 +++ /dev/null
306 @@ -1,166 +0,0 @@
307 -How to setup a zfs root filesystem using dracut
308 ------------------------------------------------
309 -
310 -1) Install the zfs-dracut package. This package adds a zfs dracut module
311 -to the /usr/share/dracut/modules.d/ directory which allows dracut to
312 -create an initramfs which is zfs aware.
313 -
314 -2) Set the bootfs property for the bootable dataset in the pool. Then set
315 -the dataset mountpoint property to '/'.
316 -
317 - $ zpool set bootfs=pool/dataset pool
318 - $ zfs set mountpoint=/ pool/dataset
319 -
320 -Alternately, legacy mountpoints can be used by setting the 'root=' option
321 -on the kernel line of your grub.conf/menu.lst configuration file. Then
322 -set the dataset mountpoint property to 'legacy'.
323 -
324 - $ grub.conf/menu.lst: kernel ... root=ZFS=pool/dataset
325 - $ zfs set mountpoint=legacy pool/dataset
326 -
327 -3) To set zfs module options put them in /etc/modprobe.d/zfs.conf file.
328 -The complete list of zfs module options is available by running the
329 -_modinfo zfs_ command. Commonly set options include: zfs_arc_min,
330 -zfs_arc_max, zfs_prefetch_disable, and zfs_vdev_max_pending.
331 -
332 -4) Finally, create your new initramfs by running dracut.
333 -
334 - $ dracut --force /path/to/initramfs kernel_version
335 -
336 -Kernel Command Line
337 --------------------
338 -
339 -The initramfs' behavior is influenced by the following kernel command line
340 -parameters passed in from the boot loader:
341 -
342 -* `root=...`: If not set, importable pools are searched for a bootfs
343 -attribute. If an explicitly set root is desired, you may use
344 -`root=ZFS:pool/dataset`
345 -
346 -* `zfs_force=0`: If set to 1, the initramfs will run `zpool import -f` when
347 -attempting to import pools if the required pool isn't automatically imported
348 -by the zfs module. This can save you a trip to a bootcd if hostid has
349 -changed, but is dangerous and can lead to zpool corruption, particularly in
350 -cases where storage is on a shared fabric such as iSCSI where multiple hosts
351 -can access storage devices concurrently. _Please understand the implications
352 -of force-importing a pool before enabling this option!_
353 -
354 -* `spl_hostid`: By default, the hostid used by the SPL module is read from
355 -/etc/hostid inside the initramfs. This file is placed there from the host
356 -system when the initramfs is built which effectively ties the ramdisk to the
357 -host which builds it. If a different hostid is desired, one may be set in
358 -this attribute and will override any file present in the ramdisk. The
359 -format should be hex exactly as found in the `/etc/hostid` file, IE
360 -`spl_hostid=0x00bab10c`.
361 -
362 -Note that changing the hostid between boots will most likely lead to an
363 -un-importable pool since the last importing hostid won't match. In order
364 -to recover from this, you may use the `zfs_force` option or boot from a
365 -different filesystem and `zpool import -f` then `zpool export` the pool
366 -before rebooting with the new hostid.
367 -
368 -How it Works
369 -============
370 -
371 -The Dracut module consists of the following files (less Makefile's):
372 -
373 -* `module-setup.sh`: Script run by the initramfs builder to create the
374 -ramdisk. Contains instructions on which files are required by the modules
375 -and z* programs. Also triggers inclusion of `/etc/hostid` and the zpool
376 -cache. This file is not included in the initramfs.
377 -
378 -* `90-zfs.rules`: udev rules which trigger loading of the ZFS modules at boot.
379 -
380 -* `parse-zfs.sh`: Run early in the initramfs boot process to parse kernel
381 -command line and determine if ZFS is the active root filesystem.
382 -
383 -* `mount-zfs.sh`: Run later in initramfs boot process after udev has settled
384 -to mount the root dataset.
385 -
386 -`module-setup.sh`
387 ----------------
388 -
389 -This file is run by the Dracut script within the live system, not at boot
390 -time. It's not included in the final initramfs. Functions in this script
391 -describe which files are needed by ZFS at boot time.
392 -
393 -Currently all the various z* and spl modules are included, a dependency is
394 -asserted on udev-rules, and the various zfs, zpool, etc. helpers are included.
395 -Dracut provides library functions which automatically gather the shared libs
396 -necessary to run each of these binaries, so statically built binaries are
397 -not required.
398 -
399 -The zpool and zvol udev rules files are copied from where they are
400 -installed by the ZFS build. __PACKAGERS TAKE NOTE__: If you move
401 -`/etc/udev/rules/60-z*.rules`, you'll need to update this file to match.
402 -
403 -Currently this file also includes `/etc/hostid` and `/etc/zfs/zpool.cache`
404 -which means the generated ramdisk is specific to the host system which built
405 -it. If a generic initramfs is required, it may be preferable to omit these
406 -files and specify the `spl_hostid` from the boot loader instead.
407 -
408 -`parse-zfs.sh`
409 -------------
410 -
411 -Run during the cmdline phase of the initramfs boot process, this script
412 -performs some basic sanity checks on kernel command line parameters to
413 -determine if booting from ZFS is likely to be what is desired. Dracut
414 -requires this script to adjust the `root` variable if required and to set
415 -`rootok=1` if a mountable root filesystem is available. Unfortunately this
416 -script must run before udev is settled and kernel modules are known to be
417 -loaded, so accessing the zpool and zfs commands is unsafe.
418 -
419 -If the root=ZFS... parameter is set on the command line, then it's at least
420 -certain that ZFS is what is desired, though this script is unable to
421 -determine if ZFS is in fact available. This script will alter the `root`
422 -parameter to replace several historical forms of specifying the pool and
423 -dataset name with the canonical form of `zfs:pool/dataset`.
424 -
425 -If no root= parameter is set, the best this script can do is guess that
426 -ZFS is desired. At present, no other known filesystems will work with no
427 -root= parameter, though this might possibly interfere with using the
428 -compiled-in default root in the kernel image. It's considered unlikely
429 -that would ever be the case when an initramfs is in use, so this script
430 -sets `root=zfs:AUTO` and hopes for the best.
431 -
432 -Once the root=... (or lack thereof) parameter is parsed, a dummy symlink
433 -is created from `/dev/root` -> `/dev/null` to satisfy parts of the Dracut
434 -process which check for presence of a single root device node.
435 -
436 -Finally, an initqueue/finished hook is registered which causes the initqueue
437 -phase of Dracut to wait for `/dev/zfs` to become available before attempting
438 -to mount anything.
439 -
440 -`mount-zfs.sh`
441 -------------
442 -
443 -This script is run after udev has settled and all tasks in the initqueue
444 -have succeeded. This ensures that `/dev/zfs` is available and that the
445 -various ZFS modules are successfully loaded. As it is now safe to call
446 -zpool and friends, we can proceed to find the bootfs attribute if necessary.
447 -
448 -If the root parameter was explicitly set on the command line, no parsing is
449 -necessary. The list of imported pools is checked to see if the desired pool
450 -is already imported. If it's not, and attempt is made to import the pool
451 -explicitly, though no force is attempted. Finally the specified dataset
452 -is mounted on `$NEWROOT`, first using the `-o zfsutil` option to handle
453 -non-legacy mounts, then if that fails, without zfsutil to handle legacy
454 -mount points.
455 -
456 -If no root parameter was specified, this script attempts to find a pool with
457 -its bootfs attribute set. First, already-imported pools are scanned and if
458 -an appropriate pool is found, no additional pools are imported. If no pool
459 -with bootfs is found, any additional pools in the system are imported with
460 -`zpool import -N -a`, and the scan for bootfs is tried again. If no bootfs
461 -is found with all pools imported, all pools are re-exported, and boot fails.
462 -Assuming a bootfs is found, an attempt is made to mount it to `$NEWROOT`,
463 -first with, then without the zfsutil option as above.
464 -
465 -Ordinarily pools are imported _without_ the force option which may cause
466 -boot to fail if the hostid has changed or a pool has been physically moved
467 -between servers. The `zfs_force` kernel parameter is provided which when
468 -set to `1` causes `zpool import` to be run with the `-f` flag. Forcing pool
469 -import can lead to serious data corruption and loss of pools, so this option
470 -should be used with extreme caution. Note that even with this flag set, if
471 -the required zpool was auto-imported by the kernel module, no additional
472 -`zpool import` commands are run, so nothing is forced.
473 --