Comment 5 for bug 1729836

Revision history for this message
Jeff Turner (jeffturner) wrote :

I think I figured out the cause. Basically PEBCAK..

There's a program called stderred (https://github.com/sickill/stderred) which colorizes stderr to differentiate it from stdout, via a LD_PRELOAD hook. I have had this set for years in my ~/.bashrc:

root@jturner-home:~# echo $LD_PRELOAD
/home/jturner/src/github/stderred/build/libstderred.so

When I examine the initrd file as follows, I see half the binaries in bin/ contain ANSI escape codes, and the libstderred.so library has been pulled in:

root@jturner-home:/boot# update-initramfs -u -k 4.13.0-25-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-25-generic
root@jturner-home:/boot# mkdir bad
root@jturner-home:/boot# ( cd bad; zcat ../initrd.img-4.13.0-25-generic | cpio -idmv; )
root@jturner-home:/boot# ls bad/home/jturner/src/github/stderred/build/libstderred.so
bad/home/jturner/src/github/stderred/build/libstderred.so
root@jturner-home:/boot# ls -1 bad/bin
?[0m
?[0m?[1m?[31m[[?[0m?[1m?[31m
?[0m?[1m?[31macpid?[0m?[1m?[31m
?[0m?[1m?[31mash?[0m?[1m?[31m
?[0m?[1m?[31mawk?[0m?[1m?[31m
?[0m?[1m?[31mbasename?[0m?[1m?[31m
?[0m?[1m?[31mblockdev?[0m?[1m?[31m
?[0m?[1m?[31mcat?[0m?[1m?[31m
...
?[1m?[31m[?[0m?[1m?[31m
busybox
cat
chroot
cpio
dash
date
dd
...

The output of update-initramfs goes red halfway.

Perhaps update-initramfs could sanitize its environment, or explicitly unset LD_PRELOAD. Hard to be idiot-proof when there's such sophisticated idiots :)