update-initramfs (latest update) always fails during kernel install

Bug #922340 reported by David A. Cobb
6
This bug affects 1 person
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_return="$?"
+#### <superbiskit> 2012-01-24: capture return AFTER remove
   remove_initramfs_bak
- rm -f "${initramfs}.new"
+ mkinitramfs_return="$?"
+ rm -fv "${initramfs}.new"
   if [ "$mkinitramfs_return" = "2" ]; then
    # minversion wasn't met, exit 0
    exit 0
   fi
   echo "update-initramfs: failed for ${initramfs} with $mkinitramfs_return." >&2
   exit $mkinitramfs_return

//
</code>

Revision history for this message
David A. Cobb (superbiskit) wrote :

Well, that really really needs an edit!!

1) The line number is 177;

2) The command was the function remove_initrdfs_bak.

THUS:
OLD=
               OPTS="-v ${OPTS}"
        fi
        if mkinitramfs ${OPTS} "${initramfs}.new" "${version}"; then
                mv -f "${initramfs}.new" "${initramfs}"
                set_sha1
        else
                mkinitramfs_return="$?" ### <<< This is the problem
                remove_initramfs_bak ### Assuming this is the return code you wanted to capture
                rm -f "${initramfs}.new"
                if [ "$mkinitramfs_return" = "2" ]; then
                        # minversion wasn't met, exit 0
                        exit 0
                fi
                echo "update-initramfs: failed for ${initramfs} with $mkinitram\
fs_return." >&2
                exit $mkinitramfs_return
        fi
}

NEW=
       if mkinitramfs ${OPTS} "${initramfs}.new" "${version}"; then
                mv -f "${initramfs}.new" "${initramfs}"
                set_sha1
        else
#### <superbiskit> 2012-01-24: capture return AFTER remove
                remove_initramfs_bak
                mkinitramfs_return="$?"
                rm -fv "${initramfs}.new"
                if [ "$mkinitramfs_return" = "2" ]; then
                        # minversion wasn't met, exit 0
                        exit 0
                fi
                echo "update-initramfs: failed for ${initramfs} with $mkinitram\
fs_return." >&2
                exit $mkinitramfs_return
        fi
}

Revision history for this message
David A. Cobb (superbiskit) wrote :

Anyway, while it is regrettable if a "initramfs_bak" is left hanging around, that deserves nothing worse than a warning. There is still a good and valid initramfs file created. An error means (IMNSHO) the program was not able to perform its task.

yurikoles (yurikoles)
affects: ubuntu → initramfs-tools (Ubuntu)
Revision history for this message
David A. Cobb (superbiskit) wrote :

Bleach! My own damn fault. (There was an RCS directory where update picked it up).
OK to invalidate this bug.

Revision history for this message
dino99 (9d9) wrote :

This version has expired

Changed in initramfs-tools (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.