update-initramfs (latest update) always fails during kernel install
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
initramfs-tools (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
ONEIRIC XUbuntu
During a large batch of upgrades, I found a persistent failure to do the kernel update. The error message stated that the post-install script returned an error 127 from update-initramfs, at or near line 1010.
Investigating the script, I find the only command in the vicinity is a "rm -f ${initramfs}.new" .
But the problem appears to be that the return code ( $? ) is tested BEFORE calling the command.
The "diff -U6" output below shows both the way it was, and the way (IMNSHO) it should be. If the $? was intended to capture the result of some previous command, I would strongly suggest capturing it immediately after that command.
<code language="patch">
@@ -170,15 +170,16 @@
OPTS="-v ${OPTS}"
fi
if mkinitramfs ${OPTS} "${initramfs}.new" "${version}"; then
mv -f "${initramfs}.new" "${initramfs}"
set_sha1
else
- mkinitramfs_
+#### <superbiskit> 2012-01-24: capture return AFTER remove
remove_
- rm -f "${initramfs}.new"
+ mkinitramfs_
+ rm -fv "${initramfs}.new"
if [ "$mkinitramfs_
# minversion wasn't met, exit 0
exit 0
fi
echo "update-initramfs: failed for ${initramfs} with $mkinitramfs_
exit $mkinitramfs_return
//
</code>
affects: | ubuntu → initramfs-tools (Ubuntu) |
Well, that really really needs an edit!!
1) The line number is 177;
2) The command was the function remove_ initrdfs_ bak.
THUS:
OPTS=" -v ${OPTS}"
set_sha1
mkinitramfs_ return= "$?" ### <<< This is the problem
remove_ initramfs_ bak ### Assuming this is the return code you wanted to capture return" = "2" ]; then
# minversion wasn't met, exit 0
exit 0
echo "update-initramfs: failed for ${initramfs} with $mkinitram\
exit $mkinitramfs_return
OLD=
fi
if mkinitramfs ${OPTS} "${initramfs}.new" "${version}"; then
mv -f "${initramfs}.new" "${initramfs}"
else
rm -f "${initramfs}.new"
if [ "$mkinitramfs_
fi
fs_return." >&2
fi
}
NEW=
set_sha1
remove_ initramfs_ bak
mkinitramfs_ return= "$?" return" = "2" ]; then
# minversion wasn't met, exit 0
exit 0
echo "update-initramfs: failed for ${initramfs} with $mkinitram\
exit $mkinitramfs_return
if mkinitramfs ${OPTS} "${initramfs}.new" "${version}"; then
mv -f "${initramfs}.new" "${initramfs}"
else
#### <superbiskit> 2012-01-24: capture return AFTER remove
rm -fv "${initramfs}.new"
if [ "$mkinitramfs_
fi
fs_return." >&2
fi
}