grub-mkconfig hangs

Bug #1527645 reported by Daniel Convissor

This bug report will be marked for expiration in 42 days if no further activity occurs. (find out why)

6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

Calling "grub-mkconfig -o /boot/grub/grub.cfg" hangs. I came across this when running "apt-get upgrade", during the kernel post install step, where it hangs on this line in the log:

    run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.19.0-41-generic /boot/vmlinuz-3.19.0-41-generic

I ran strace on calling grub-mkconfig. I'll attach the output, but here's a summary of the output. To my untrained eye, it looks like grub-mkconfig is calling pipe() and read() on a closed handle.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
... snip ...
read(3, "/dev/mapper/ubuntu--vg-root\n", 128) = 28
read(3, "", 128) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17818, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn() = 0
close(3) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17818
pipe([3, 4]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe3556d7a10) = 17819
close(4) = 0
read(3,
        ^
        |
NOTE: THE PROCESS HANGS THERE

NOTE: AFTER KILLING THE PROCESS, THE LINE CONTINUES THERE
        |
        v
read(3, 0x7ffddd6b62e0, 128) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=16554, si_uid=0} ---
+++ killed by SIGTERM +++
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Here are the package versions on hand as determined by "apt-cache policy grub grub-pc grub-efi"

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
grub:
  Installed: (none)
  Candidate: 0.97-29ubuntu66
  Version table:
     0.97-29ubuntu66 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
grub-pc:
  Installed: 2.02~beta2-9ubuntu1.6
  Candidate: 2.02~beta2-9ubuntu1.6
  Version table:
 *** 2.02~beta2-9ubuntu1.6 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.02~beta2-9 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
grub-efi:
  Installed: (none)
  Candidate: 2.02~beta2-9ubuntu1.6
  Version table:
     2.02~beta2-9ubuntu1.6 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     2.02~beta2-9 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is similar to what happened to me in bug #1510563 about a month ago.

Revision history for this message
Daniel Convissor (convissor) wrote :
Revision history for this message
Steve Langasek (vorlon) wrote :

wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17818
pipe([3, 4]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe3556d7a10) = 17819
close(4) = 0
read(3,

This is the standard usage of pipe. pipe opens two connected file descriptors, and returns these fds in the array that's the argument to pipe. The process then forks, the parent closes one, the child closes the other, and they talk across this pipe.

Since you are only stracing the grub-mkconfig process, and not following forks ('strace -ff'), this trace doesn't show us what's actually hanging.

grub-mkconfig, btw, is a shell script, so it's probably better to debug it using 'sh -x /usr/sbin/grub-mkconfig' instead.

affects: grub (Ubuntu) → grub2 (Ubuntu)
Changed in grub2 (Ubuntu):
status: New → Incomplete
Revision history for this message
Daniel Convissor (convissor) wrote :

So I ran

strace -ff -o 2015-12-18-grub-mkconfig-strace-ff sh -x /usr/sbin/grub-mkconfig

That produced 1000 files and took several attempts to kill off the various processes that spawned after killing the hung ones. I doubt anyone wants to see 1000 strace dumps. Please advise.

Changed in grub2 (Ubuntu):
status: Incomplete → New
Revision history for this message
Daniel Convissor (convissor) wrote :

This problem persists, as seen while upgrading to linux-image-3.19.0-61-generic.

@vorlorn: please advise how to provide debug information.

summary: - grub-mkconfig hangs (due to acting on closed handle?)
+ grub-mkconfig hangs
Mate Kukri (mkukri)
Changed in grub2 (Ubuntu):
status: New → Incomplete
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.