* [pve-devel] [PATCH pve-kernel-meta] proxmox-boot: fix #3632 copy kernel+initrd unconditionally
@ 2021-09-23 8:43 Stoiko Ivanov
2021-10-04 7:44 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2021-09-23 8:43 UTC (permalink / raw)
To: pve-devel
do not use the -u (update) flag when copying kernel images and inird
from /boot to the ESPs:
* the ESPs are formatted with vfat, which has a 2 second precision for
mtime (`linux/fs/fat/misc.c` - `fat_truncate_time`)
* cp -u compares the mtimes of source (kernel image in /boot not on
vfat) and destination - leading to the copy always being carried
out, if the source files remain the same (and do not happen to have
a mtime exactly happening on a even second)
as laid out in the bug-report - the case where this leads to an
unbootable system is when a kernel-version is shipped twice (built
with different tool-chains) - e.g. currently the 5.11 kernels in PVE 6
and PVE 7.
tested the behavior of `cp -u` by running opensnopp-bpfcc and copying
a file twice onto ext4 (opened only once) and on vfat (opened twice).
additionally reproduced the issue (by dist-upgrading a PVE 6 VM to 7
with the pve-no-subscription repo) and verified this patch fixes it.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
Initially considered using the output of `stat --format=%s:%Y` of both
files as 'fingerprint' for comparison
proxmox-boot/zz-proxmox-boot | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/proxmox-boot/zz-proxmox-boot b/proxmox-boot/zz-proxmox-boot
index 244fe8e..4bd63a6 100755
--- a/proxmox-boot/zz-proxmox-boot
+++ b/proxmox-boot/zz-proxmox-boot
@@ -132,21 +132,21 @@ copy_and_config_kernels() {
KERNEL_ESP_DIR="${PMX_ESP_DIR}/${kver}"
KERNEL_LIVE_DIR="${esp}/${KERNEL_ESP_DIR}"
mkdir -p "${KERNEL_LIVE_DIR}"
- cp -u --preserve=timestamps "${linux_image}" "${KERNEL_LIVE_DIR}/"
- cp -u --preserve=timestamps "${initrd}" "${KERNEL_LIVE_DIR}/"
+ cp --preserve=timestamps "${linux_image}" "${KERNEL_LIVE_DIR}/"
+ cp --preserve=timestamps "${initrd}" "${KERNEL_LIVE_DIR}/"
# create loader entry
cat > "${esp}/loader/entries/proxmox-${kver}.conf" <<- EOF
title ${LOADER_TITLE}
version ${kver}
options ${CMDLINE}
- linux /${KERNEL_ESP_DIR}/vmlinuz-${kver}
- initrd /${KERNEL_ESP_DIR}/initrd.img-${kver}
+ linux /${KERNEL_ESP_DIR}/vmlinuz-${kver}
+ initrd /${KERNEL_ESP_DIR}/initrd.img-${kver}
EOF
else
warn " Copying kernel ${kver}"
- cp -u --preserve=timestamps "${linux_image}" "${esp}/"
- cp -u --preserve=timestamps "${initrd}" "${esp}/"
+ cp --preserve=timestamps "${linux_image}" "${esp}/"
+ cp --preserve=timestamps "${initrd}" "${esp}/"
fi
done
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH pve-kernel-meta] proxmox-boot: fix #3632 copy kernel+initrd unconditionally
2021-09-23 8:43 [pve-devel] [PATCH pve-kernel-meta] proxmox-boot: fix #3632 copy kernel+initrd unconditionally Stoiko Ivanov
@ 2021-10-04 7:44 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-10-04 7:44 UTC (permalink / raw)
To: Proxmox VE development discussion, Stoiko Ivanov
On 23.09.21 10:43, Stoiko Ivanov wrote:
> do not use the -u (update) flag when copying kernel images and inird
> from /boot to the ESPs:
> * the ESPs are formatted with vfat, which has a 2 second precision for
> mtime (`linux/fs/fat/misc.c` - `fat_truncate_time`)
> * cp -u compares the mtimes of source (kernel image in /boot not on
> vfat) and destination - leading to the copy always being carried
> out, if the source files remain the same (and do not happen to have
> a mtime exactly happening on a even second)
>
> as laid out in the bug-report - the case where this leads to an
> unbootable system is when a kernel-version is shipped twice (built
> with different tool-chains) - e.g. currently the 5.11 kernels in PVE 6
> and PVE 7.
>
> tested the behavior of `cp -u` by running opensnopp-bpfcc and copying
> a file twice onto ext4 (opened only once) and on vfat (opened twice).
>
> additionally reproduced the issue (by dist-upgrading a PVE 6 VM to 7
> with the pve-no-subscription repo) and verified this patch fixes it.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> Initially considered using the output of `stat --format=%s:%Y` of both
> files as 'fingerprint' for comparison
>
> proxmox-boot/zz-proxmox-boot | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
>
applied (on friday), thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-04 7:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 8:43 [pve-devel] [PATCH pve-kernel-meta] proxmox-boot: fix #3632 copy kernel+initrd unconditionally Stoiko Ivanov
2021-10-04 7:44 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox