FS#49816 - [dkms] /usr/bin/dkms: line ****: echo: write error: Broken pipe

Attached to Project: Arch Linux
Opened by Carlos jimenez (ozmage) - Thursday, 23 June 2016, 08:27 GMT
Last edited by Sébastien Luttringer (seblu) - Friday, 19 August 2016, 00:47 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Sébastien Luttringer (seblu)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 17
Private No

Details

Description:


Additional info:
* package version(s)
* config and/or log files etc.

dkms-2.2.0.3+git151023-11-any.pkg.tar.xz

Steps to reproduce:

Upgrade Any kernel Version.

This dont Happend with version dkms-2.2.0.3+git151023-10
This task depends upon

This task blocks these from closing
 FS#56756 - Resetting signal handlers prior to calling hooks 
Closed by  Sébastien Luttringer (seblu)
Friday, 19 August 2016, 00:47 GMT
Reason for closing:  Fixed
Comment by Francisco Cribari (cribari) - Sunday, 26 June 2016, 20:15 GMT
I noticed that problem as well.
Comment by Llewelyn Trahaearn (llewelyn) - Monday, 27 June 2016, 18:32 GMT
I'm experiencing the same issue during updates that trigger the dkms remove hook prior to installing an update.
Comment by Rich (rlees85) - Monday, 27 June 2016, 21:52 GMT
Also starting seeing this with Virtualbox DKMS module removal when upgrading package 'linux':

==> dkms remove -m vboxhost -v 5.0.22_OSE -k 4.6.2-1-ARCH
/usr/bin/dkms: line 1972: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1974: echo: write error: Broken pipe
/usr/bin/dkms: line 1972: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1974: echo: write error: Broken pipe
/usr/bin/dkms: line 1972: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1974: echo: write error: Broken pipe
/usr/bin/dkms: line 1972: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1916: echo: write error: Broken pipe
/usr/bin/dkms: line 1974: echo: write error: Broken pipe

I assume as its just trying to echo something it is 'harmless' ?
Comment by Francisco Cribari (cribari) - Tuesday, 05 July 2016, 18:32 GMT
Is this "harmless"? Will it be fixed?
Comment by Sébastien Luttringer (seblu) - Wednesday, 06 July 2016, 21:45 GMT
This dkms output was hidden by our alps hook. It has changed since  FS#49816  to let users get feedback from dkms builds.

Only virtualbox-*-dkms seems produce these noisy outputs. I don't know yet if the problem is in dkms or in the virtualbox.
Comment by Jacob S (Gourdcaptain) - Wednesday, 06 July 2016, 22:34 GMT
I think I've also gotten it from bbswitch-dkms, but I don't have my system with bbswitch currently on it to check.
Comment by Andrey Vihrov (andreyv) - Thursday, 07 July 2016, 06:19 GMT
I can confirm this with bbswitch-dkms. Note that if you run the same uninstall command from the shell, it works.
Comment by Bernhard Landauer (oberon) - Wednesday, 13 July 2016, 16:56 GMT
Same with broadcom-wl-dkms
Comment by Andrew Gregory (andrewgregory) - Friday, 15 July 2016, 17:59 GMT
The error is harmless. Hooks are run with SIGPIPE ignored which causes '... | grep -q ...' in the dkms script to print the error when the grep exits early and the echo receives EPIPE.
Comment by Kevin Brodsky (Corax) - Friday, 15 July 2016, 21:15 GMT
@Andrew Gregory: agreed on the diagnostic. However, that doesn't mean it is OK to have these errors displayed, an error (however harmless) is never expected when all goes well.

Apparently it is not possible (in bash) to trap (or reset) a signal that was ignored when the shell was launched ("Signals ignored upon entry to the shell cannot be trapped or reset."), so there's not much we can do in the dkms hook. It also seems logical that libalpm runs hooks with SIGPIPE ignored, as a hook could close its pipe side while still having work to do.

I see 3 options:
1. As a workaround, do not ignore SIGPIPE in libalpm, and instead install a handler that does nothing. Not beautiful, but with that we can restore the default handler in the dkms hook.
2. Use some kind of (C?) wrapper to launch dkms from the hook, restoring SIGPIPE to default. Quite heavy, I guess.
3. Make dkms handle SIGPIPE being ignored properly. Probably not trivial.

Option 1 sounds like the most doable.
Comment by Andrew Gregory (andrewgregory) - Friday, 15 July 2016, 22:45 GMT
libalpm does not ignore SIGPIPE, GPGME does. I need to look into resetting signal handlers prior to calling the hook. In the meantime, this can be fixed by writing the hook script in something other than bash that is capable of restoring the default handler, like Perl. If rewriting the script is too much, a one line Perl wrapper can be used as well: Exec = /bin/perl -e "$SIG{PIPE}='DEFAULT'; exec('/usr/lib/dkms/alpm-hook', 'remove');"
Comment by Kevin Brodsky (Corax) - Sunday, 17 July 2016, 20:41 GMT
Could you elaborate on how GPGme is involved here? I don't exactly know how the hooks are invoked so I'm probably missing something here.

Anyway, I wasn't sure how easy it would be to reset the signal handler in Perl, but being that easy I find your oneliner to be quite a reasonable workaround (I don't think rewriting the whole script is reasonable just because of signal handling). I think we should use it until a more proper fix can be made.
Comment by Andrew Gregory (andrewgregory) - Sunday, 17 July 2016, 20:46 GMT
libalpm uses GPGME for signature checking. GPGME uses pipes to communicate with external processes. When GPGME is initialized it sets SIGPIPE to be ignored, so that it can gracefully handle EPIPE rather than have the entire application die.
Comment by Carlos jimenez (ozmage) - Monday, 18 July 2016, 02:15 GMT Comment by A M (s3rb31) - Monday, 18 July 2016, 16:01 GMT
Hey guys I am experiencing the same problems with the "nvidia-dkms" module,

following what Andrew wrote I created "/etc/pacman.d/hooks/70-dkms-remove.hook" (the directory was not existing, so I created it) copied over all the contents from "/usr/share/libalpm/hooks/70-dkms-remove.hook" and adjusted the 'Exec' entry Andrew pointed out.

The error went away. Did I forgot anything? Is this really everything that needs to be changed? I googled and found somehting about "HookDir" in "pacman.conf", but I think it is set by default to the path above? So there is no need to activate it specifically, correct? It may be a stupid question, but i am rather new to Linux, thats why I am asking.

Greets
Comment by Sébastien Luttringer (seblu) - Monday, 18 July 2016, 22:48 GMT
I pushed a version with the perl workaround proposed by Andrew until he can take time to fix properly in pacman/libalpm.
Comment by Kevin Brodsky (Corax) - Tuesday, 19 July 2016, 18:20 GMT
@Andrew: thanks for the explanation.

@Sébastien: thanks!

Loading...