# portupgrade error (broken pipe) on deinstalling stage



## goshanecr (Apr 23, 2016)

Good day!

My info:
`uname -a`

```
FreeBSD BSD 10-STABLE FreeBSD 10-STABLE #0 r298405: Thu Apr 21 22:49:24 MSK 2016  user@BSD:/usr/obj/usr/src/sys/BSDSERV  amd64
```

I have similar errors for many ports on `portupgrade -a` procedure. And all fails after successful building port, fails on deinstalling stage.

That's listing for one of them:

```
Making install in tests
/usr/bin/make  install-am
install  -s -m 555 /usr/ports/databases/xapian-core/work/xapian-core-1.2.23/examples/.libs/copydatabase /usr/ports/databases/xapian-core/work/stage/usr/local/bin/xapian-copydatabase
install  -s -m 555 /usr/ports/databases/xapian-core/work/xapian-core-1.2.23/examples/.libs/delve /usr/ports/databases/xapian-core/work/stage/usr/local/bin/xapian-delve
install  -s -m 555 /usr/ports/databases/xapian-core/work/xapian-core-1.2.23/examples/.libs/quest /usr/ports/databases/xapian-core/work/stage/usr/local/bin/xapian-quest
====> Compressing man pages (compress-man)
--->  Backing up the old version
--->  Uninstalling the old version
[Reading data from pkg(8) ... - 682 packages found - done]
--->  Deinstalling 'xapian-core-1.2.22,1'
[Reading data from pkg(8) ... - 682 packages found - done]
** Listing the failed packages (-:ignored / *:skipped / !:failed)
  ! xapian-core-1.2.22,1  (Broken pipe)
** Listing the failed packages (-:ignored / *:skipped / !:failed)
  ! databases/xapian-core (xapian-core-1.2.22,1)  (uninstall error)
```

What can caused the problem?


----------



## goshanecr (Apr 23, 2016)

Guys, is it unique situation, and nobody knows what can causes it?


----------



## talsamon (Apr 23, 2016)

Maybe something with `ruby`? Do you have a (wrong) `DEFAULT_VERSION` of `ruby` in /etc/make.conf?


----------



## goshanecr (Apr 24, 2016)

Thanks! I have not record for ruby version, but ruby installed 2.1 and seems that I just need to follow steps from /usr/ports/UPDATING about ruby version update.


----------



## T-Aoki (Apr 24, 2016)

My case, stable/10 is continuously OK but problem is reproduced on head. (Both amd64)
r298114 was OK, r298476 and later are NG.


Ruby version doesn't matter.
(Both 2.1 and 2.2 are NG for head r298476, while both are OK for stable/10.)​
Updating ports tree didn't help.
(Didn't updated ports tree first when I updated src tree from r298114 to r298476.)​
Currently, stable/10 is at r298510.


----------



## pboehmer (May 3, 2016)

Has anyone found a resolution to this?  I have several boxes doing this after updating yesterday.


----------



## SirDice (May 3, 2016)

As they seem to have issues with uninstalling existing packages I'm wondering what version of pkg(8) is used and if it also fails to uninstall if you pkg-delete(8) it by hand?


----------



## T-Aoki (May 4, 2016)

pboehmer said:


> Has anyone found a resolution to this?  I have several boxes doing this after updating yesterday.



If you're updating via source, and you're at
for head: r298192 or later
for stable/10: r298920 or later,​quick fix is to revert
for head: r298192
for stable/10: r298920.​
These are "Update file to 5.26" and touches a lot of files.
So the easiest way would be downgrading at contrib/file and lib/libmagic using svnlite up -r <rev> and rebuild/reinstall at usr.bin/file and lib/libmagic.

Watch Bug PR 209211 for actual fix.

Unfortunately, I cannot reproduce goshanecr's case (stable/10 r298405), so if it is your case, I cannot help.


----------



## T-Aoki (May 4, 2016)

SirDice said:


> As they seem to have issues with uninstalling existing packages I'm wondering what version of pkg(8) is used and if it also fails to uninstall if you pkg-delete(8) it by hand?



With my case, ports-mgmt/pkg is at 1.7.2.
But it can be unrelated, as ports-mgmt/portmaster is reported  to work and not all ports gets error.
Additionally, pkg-1.7.2 co-worked fine with portupgrade under stable/10 before r298920.

Sorry, pkg-delete(8) by hand is not yet tested, as I need to seek for one affected but not needed for me to proceed.


----------



## pboehmer (May 4, 2016)

I concur that ports-mgmt/portmaster is not affected.  I have migrated problematic boxes from ports-mgmt/portupgrade to portmaster.  With the low overhead of ports-mgmt/portmaster, I think I may go ahead and migrate all of my boxes over since I have no other ports that depend on Ruby.  

That being said, I did notice that there was an update to lang/ruby22 this morning.


----------



## kpa (May 4, 2016)

You might want to take a look at ports-mgmt/synth as the replacement for both portmaster and portupgrade. Both tools are pretty much redundant now because of the new pkg package system and they both have problems in handling dependencies properly that are only solved by using a package builder such as the mentioned Synth.


----------



## SirDice (May 4, 2016)

If you have multiple servers and different versions of FreeBSD I can recommend setting up ports-mgmt/poudriere. Both synth and poudriere can be set up as a local repository. Build once, install many


----------



## YuryG (May 7, 2016)

The same is here.  "Broken pipe" for some ports via `portupgrade`, but O.K. manually `make deinstall` then `make install clean`.
uname: FreeBSD 10.3-STABLE #0 r298933M


----------



## T-Aoki (May 7, 2016)

YuryG said:


> The same is here.  "Broken pipe" for some ports via `portupgrade`, but O.K. manually `make deinstall` then `make install clean`.
> uname: FreeBSD 10.3-STABLE #0 r298933M



As I noted on #8, you need to revert r298920.
Akinori MUSHA confirmed that the problem is in file 5.26.
See the post on freebsd-current ML(linked).
Details are described at upstream bugtracker (first URL written in the post).

The easiest workaround (example step-by-step procedure for stable/10) is:


```
cd /usr/src/contrib/file
svnlite update -r 298919
cd /usr/src/lib/libmagic
svnlite update -r 298919
cd /usr/src/usr.bin/file
make clean
make
make install
cd /usr/src/lib/libmagic
make clean
make
make install
```

After these, portupgrade would work fine again.
svnlite is in base by default.


----------



## recluce (May 8, 2016)

Delete - shot myself in the foot


----------



## T-Aoki (May 8, 2016)

For head, fix is introduced at r299234 by delphij@. MFC after: 3 days.
I could confirm portupgrade works fine with it. (Tested on stable/10 by manually applying the diff.)

But please note that this revision fixes only "Broken pipe" problem.
Another problem Akinori MUSHA mentioned (said fixed on upstream head) isn't fixed on FreeBSD.
Someone having access to upstream head repo would be able to see it, but I couldn't see it via public upstream github.


----------



## SirDice (May 10, 2016)

T-Aoki said:


> Someone having access to upstream head repo would be able to see it, but I couldn't see it via public upstream github.


https://svnweb.freebsd.org/base/head/


----------



## T-Aoki (May 10, 2016)

SirDice said:


> https://svnweb.freebsd.org/base/head/


I meant upstream github of file, but yes, remained problem Akinori mentioned was fixed on head at r299238 (confirmed).
And for stable/10, file is reverted to 5.25 at r299236. So all affected versions should be fixed now.


----------



## YuryG (May 10, 2016)

If I applied workaround with reverting two directories to previous version, should I make additional steps upgrading whole /usr/src with svn?


----------



## SirDice (May 10, 2016)

YuryG said:


> If I applied workaround with reverting two directories to previous version, should I make additional steps upgrading whole /usr/src with svn?


On the next `svn update` run they'll be updated to their latest versions. You don't have to do anything for that.


----------



## T-Aoki (May 15, 2016)

For head, `file` 5.27 is introduced at r299736 by delphij@.
This version is confirmed OK for me. (MFC after: 2weeks)


----------

