[pve-devel] [PATCH kernel-meta] fix #2297: trap exit to always umount ESP in pve-efiboot-tool init

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Jul 22 12:17:07 CEST 2019


On Mon, Jul 22, 2019 at 09:41:17AM +0200, Thomas Lamprecht wrote:
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>  bin/pve-efiboot-tool | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/bin/pve-efiboot-tool b/bin/pve-efiboot-tool
> index a2ff4e1..95ba0d9 100755
> --- a/bin/pve-efiboot-tool
> +++ b/bin/pve-efiboot-tool
> @@ -143,6 +143,8 @@ init() {
>  
>  	esp_mp="/var/tmp/espmounts/$UUID"
>  
> +	trap "{ mountpoint -q $esp_mp && umount -Rf $esp_mp; }" EXIT

shouldn't this be quoted like this

trap '{ mountpoint -q "$esp_mp" && umount -rF "$esp_mp"; }' EXIT

? AFAICT, this should already happen automatically since the namespace
dies with the last process anyway, so maybe we don't need it after all
(except maybe to print a nicer message ;))?

the actual problem in the installer is this, I think:

line 1703 bind mounts /dev into $targetdir
line 1715 calls prepare_systemd_boot_esp
that dies
line 1730 with the umount for $targetdir/dev never gets called

not sure whether we want to just eval the whole block with the
bootloader installation and unmount there, or add the unmount to the
final cleanup?

> +
>  	mkdir -p "$esp_mp"
>  	echo "Mounting '$part' on '$esp_mp'."
>  	mount -t vfat "$part" "$esp_mp"



> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list