portupgrade uninstall error, broken pipe

I too was bitten by the portupgrade uninstall error, due to broken pipes, on my laptop running FreeBSD/amd64 stable/10. Others have identified the file 5.26 utility as the culprit, introduced in stable/10 as r298920.

Watch PR 209211 for any progress. base/head was corrected at r299234, and stable/10 will follow soon.

Luckily, I have several older ZFS boot environments to choose from. The zroot/ROOT/20160425-r298573 BE contained the older file 5.25 utility, so I preserved the new file 5.26 utility and retrieved the old file 5.25 utility using these commands:

mount -t zfs zroot/ROOT/20160425-r298573 /mnt
cd /usr/bin
mv file file.new
cp -p /mnt/usr/bin/file file.old
cp -p file.old file
cd ../lib
mv libmagic.a libmagic.a.new
mv libmagic.so.4 libmagic.so.4.new
mv libmagic_p.a libmagic_p.a.new
cp -p /mnt/usr/lib/libmagic.a libmagic.a.old
cp -p /mnt/usr/lib/libmagic.so.4 libmagic.so.4.old
cp -p /mnt/usr/lib/libmagic_p.a libmagic_p.a.old
cp -p libmagic.a.old libmagic.a
cp -p libmagic.so.4.old libmagic.so.4
cp -p libmagic_p.a.old libmagic_p.a
umount /mnt

If your’re unable to pull the old file 5.25 utility from your snapshots and clones, try extracting the executable and its libraries from the base.txz distribution for 10.3-RELEASE. Here are the relevant links if your running i386 or amd64.

You can also roll your source tree back to r298919, and rebuild and reinstall usr.bin/file and lib/libmagic. You might want to make spare copies of the resurrected executable and its libraries as shown above before rolling the source tree forward again.