mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Fix for zfs-dracut regression
Line 31 and 32 overwrote the ${root} variable which broke mount-zfs.sh
We have create a new variable for the dataset instead of overwriting the
${root} variable in zfs-load-key.sh${root} variable in zfs-load-key.sh
Reviewed-by: Kash Pande <kash@tripleback.net>
Reviewed-by: Garrett Fields <ghfields@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Dacian Reece-Stremtan <dacianstremtan@gmail.com>
Closes #8913
Closes #9379
			
			
This commit is contained in:
		
							parent
							
								
									ff3e2e3c70
								
							
						
					
					
						commit
						0be40959fe
					
				| @ -25,22 +25,23 @@ while true; do | |||||||
| done | done | ||||||
| 
 | 
 | ||||||
| # run this after import as zfs-import-cache/scan service is confirmed good | # run this after import as zfs-import-cache/scan service is confirmed good | ||||||
|  | # we do not overwrite the ${root} variable, but create a new one, BOOTFS, to hold the dataset | ||||||
| if [ "${root}" = "zfs:AUTO" ] ; then | if [ "${root}" = "zfs:AUTO" ] ; then | ||||||
|     root="$(zpool list -H -o bootfs | awk '$1 != "-" {print; exit}')" |     BOOTFS="$(zpool list -H -o bootfs | awk '$1 != "-" {print; exit}')" | ||||||
| else | else | ||||||
|     root="${root##zfs:}" |     BOOTFS="${root##zfs:}" | ||||||
|     root="${root##ZFS=}" |     BOOTFS="${root##ZFS=}" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # if pool encryption is active and the zfs command understands '-o encryption' | # if pool encryption is active and the zfs command understands '-o encryption' | ||||||
| if [ "$(zpool list -H -o feature@encryption $(echo "${root}" | awk -F\/ '{print $1}'))" = 'active' ]; then | if [ "$(zpool list -H -o feature@encryption $(echo "${BOOTFS}" | awk -F\/ '{print $1}'))" = 'active' ]; then | ||||||
|     # if the root dataset has encryption enabled |     # if the root dataset has encryption enabled | ||||||
|     ENCRYPTIONROOT=$(zfs get -H -o value encryptionroot "${root}") |     ENCRYPTIONROOT=$(zfs get -H -o value encryptionroot "${BOOTFS}") | ||||||
|     if ! [ "${ENCRYPTIONROOT}" = "-" ]; then |     if ! [ "${ENCRYPTIONROOT}" = "-" ]; then | ||||||
|         # decrypt them |         # decrypt them | ||||||
|         TRY_COUNT=5 |         TRY_COUNT=5 | ||||||
|         while [ $TRY_COUNT -gt 0 ]; do |         while [ $TRY_COUNT -gt 0 ]; do | ||||||
|             systemd-ask-password "Encrypted ZFS password for ${root}" --no-tty | zfs load-key "${ENCRYPTIONROOT}" && break |             systemd-ask-password "Encrypted ZFS password for ${BOOTFS}" --no-tty | zfs load-key "${ENCRYPTIONROOT}" && break | ||||||
|             TRY_COUNT=$((TRY_COUNT - 1)) |             TRY_COUNT=$((TRY_COUNT - 1)) | ||||||
|         done |         done | ||||||
|     fi |     fi | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 dacianstremtan
						dacianstremtan