# pkg_info error "can't chdir back to"



## Beeblebrox (Dec 31, 2011)

`# portsdb -u`

```
[Updating the portsdb <format:dbm_hash> in /usr/ports ... - 23072 port entries found .........1000
.........2000.........3000.........4000.........5000.........6000.........7000.........8000.........
9000.........10000.........11000.........12000.........13000.........14000.........15000.........
16000.........17000.........18000.........19000.........20000.........21000.........22000.........
23000 ....HASH: Out of overflow pages.  Increase page size
 error] Remove and try again.
```
Repeat in endless loop. Tried fixes:
- Delete INDEX-9 files and make index also make fetchindex.
- Delete ports tree and csup entirely new tree.
- re-build lang/ruby18

The real error I was trying to fix before I got into this mess was:
`$ pkg_info`

```
3dc-0.8.1_3         3-Dimensional Chess for X Window System
FreeMat-4.0_2       An environment for rapid engineering and scientific process
GeoIP-1.4.8_1       Find the country that any IP address or hostname originates
ImageMagick-6.7.3.4 Image processing tools
ORBit-0.5.17_5      High-performance CORBA ORB with support for the C language
[color="Red"]pkg_info: leave_playpen: can't chdir back to ''[/color]
```


----------



## jb_fvwm2 (Dec 31, 2011)

First suggestion:
dbd_btree (ruby-bdb port maybe, then check an option in portupgrade...), rather than dbm_hash. No time to research a full fix today though.


----------



## Beeblebrox (Jan 2, 2012)

Thanks, but not understood.
I use ports-mgmt/portmaster and not ports-mgmt/portupgrade. The reason I am messing with portsdb is because (as I understand) pkgdb is used for pkg_info and I want to fix that error. Fixing pkgdb calls portsdb during the fixing run, which does not complete and therefore the pkgdb errors are not flushed completely.


----------



## wblock@ (Jan 2, 2012)

Beeblebrox said:
			
		

> Thanks, but not understood.
> I use portmaster and not portupgrade.



portsdb is part of portupgrade.



> The reason I am messing with portsdb is because (as I understand) pkgdb is used for pkg_info and I want to fix that error. Fixing pkgdb calls portsdb during the fixing run, which does not complete and therefore the pkgdb errors are not flushed completely.



pkg_info(1) is part of the base system and does not need or use portsdb from the portupgrade port.  I'm not sure what's causing the problem with pkg_info, though.


----------



## Beeblebrox (Jan 3, 2012)

OK wblock, seems I took some bad / incomplete notes on all of that from my noob days - that clears up the *db problem but now I need to find the reason for pkg_info(1)() error.
I Changed the post title accordingly.


----------



## SirDice (Jan 3, 2012)

I'm guessing one of the +CONTENTS files in /var/db/pkg/ is either corrupt or contains bad information.


----------



## Beeblebrox (Jan 3, 2012)

I also figured as such and noticed that pkg_info(1)() was listing the packages in the same alphabetical order which the folders existed in /var/db/pkg. Based on that observation, the next folder in line that should be listed in the first post is ORBit2. I had checked the +CONTENTS and even re-installed devel/ORBit2 prior to posting.


----------



## SirDice (Jan 3, 2012)

Have a look at the +CONTENTS of ORBit-0.5.17_5 too. Perhaps it's leaving that one in some undefined state.


----------



## wblock@ (Jan 3, 2012)

portmaster(8) can probably fix this, but I can't recall how.  -check-port-dbdir and --check-depends should do no harm, at least.


----------



## Beeblebrox (Jan 4, 2012)

@ SirDice: de & re-installed devel/ORBit as well - no change.

@ wblock: I run the portmaster commands regularly after major upgrades. No errors found with the exception of some repeat-offenders (ports which don't register correctly) like:
www/py-django and py-qt4-core and py-qt4-dbus and py-qt4-gui and some others...


----------



## Beeblebrox (Feb 4, 2012)

Seems pkg does not like the PKG_PATH setting to be toyed with. As an environment setting in .cshrc I had:

```
setenv  PKG_PATH /repository/pkg/All
```
Removing this entry solved the pkg_info error (I now have a different problem, but that's life).

p.s: I also have PKGREPOSITORY set in .cshrc but this setting is not causing any interference.


----------



## jb_fvwm2 (Jun 18, 2012)

I am wondering about that error, I consistently[1] encounter it using pkg_add...

```
pkg_add: leave_playpen: can't chdir back to '' 
# about one of every 20 or thirty [FILE]pkg_add[/FILE]
```
[1] year after year...


----------



## Beeblebrox (Jun 18, 2012)

Yes, once that error starts, all pkg_* (pkg related) functions seem to be affected. My diagnosis was that the error is not related to an issue like


> ```
> +CONTENTS file in /var/db/pkg/ is either corrupt or contains bad information.
> ```


But is a problem related to env settings. Consequently you will have to fiddle around with one or all of /etc/csh.cshrc,  ~/.cshrc and of course /etc/login.conf.

Try disabling PKG_ related config options one by one and at some point it should clear the error.


----------



## jb_fvwm2 (Nov 22, 2012)

jb_fvwm2 said:
			
		

> I am wondering about that error, I consistently[1] encounter it using pkg_add...
> 
> ```
> pkg_add: leave_playpen: can't chdir back to ''
> ...



Consistently still getting this error... v9 packages can't install to other v9 machines.


----------



## Beeblebrox (Nov 23, 2012)

Do you have any settings in the environment relating to PKG_* (like PKG_PATH for example)?


----------



## jb_fvwm2 (Nov 23, 2012)

No.  I see the error often after "Building Chrome's registry..." at the end of the package install but before registering it.  Permissions on /tmp?
A PWD set to opera's cache?


----------

