Skip to content

Commit 03f754a

Browse files
committed
flatcar-postinst: Clean up incomplete move target
When the old OEM contents and a yet inactive systemd-sysext image are on the OEM partition (or if no two sysexts fit on it), it can fail to write the second systemd-sysext image on the OEM partition and the rootfs is used instead. However, "mv" doesn't clean up the incomplete target file which filled the disk, this results in the migration flag file creation to fail, which fails the update action. Clean up the incomplete move target that filled the disk.
1 parent f9211bc commit 03f754a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

flatcar-postinst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ if [ "${OEMID}" != "" ] && { [ -e "${INSTALL_MNT}/share/flatcar/oems/${OEMID}" ]
158158
# We don't need to check if it's the initial MVP OEM because it's an update payload provided for a particular version
159159
echo "Trying to place /var/lib/update_engine/oem-${OEMID}-${NEXT_VERSION}.raw on OEM partition" >&2
160160
if ! mv "/var/lib/update_engine/oem-${OEMID}.raw" "${NEW_SYSEXT}"; then
161+
rm -f "${NEW_SYSEXT}"
161162
echo "That failed, moving it to right location on root partition" >&2
162163
NEW_SYSEXT="/etc/flatcar/oem-sysext/oem-${OEMID}-${NEXT_VERSION}.raw"
163164
mv "/var/lib/update_engine/oem-${OEMID}.raw" "${NEW_SYSEXT}"

0 commit comments

Comments
 (0)