# portupgrade -a and now ** Stale lock file was found. Removed.



## janroc (Jun 3, 2009)

Hi all,

My portupgrade -a upgraded the ruby today.
Now every time i run portupgrade -a i get "** Stale lock file was found. Removed."
See below.

Any sugestion why?

Jan


```
===>   Compressing manual pages for ruby-1.8.7.160,1
===>   Running ldconfig
/sbin/ldconfig -m /usr/local/lib
===>   Registering installation for ruby-1.8.7.160,1
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/lib/ruby/1.8/i386-freebsd7/socket.so

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
[url]http://www.ruby-lang.org/en/[/url]
===>  Cleaning for ruby-1.8.7.160,1
--->  Cleaning out obsolete shared libraries
[Updating the pkgdb <format:bdb_btree> in /var/db/pkg ... - 124 packages found (-0 +1) . done]
[root@netmon ~]# portupgrade -a
** Stale lock file was found. Removed.
[root@netmon ~]# portupgrade -a
** Stale lock file was found. Removed.
[root@netmon ~]#
```


----------



## Lowell (Jun 3, 2009)

The portupgrade database lock file is /var/run/pkgdb.db.lock.  I think it determines staleness just by age; anything over two minutes old is considered stale, so it's not really that sophisticated.

If you're sure there's nothing from the portupgrade suite running at the moment, then the message is harmless, if annoying.  I haven't seen this except when I break out of a portupgrade run in the middle, so I can't play with it myself to try to diagnose.

One thing I notice is that the clearing of the lock file doesn't have a lot of error checking.  This may mean that the file isn't really being removed when it says it is.  Try removing the file by hand and see if the message continues to appear.


----------



## ale (Jun 3, 2009)

janroc said:
			
		

> Hi all,
> 
> My portupgrade -a upgraded the ruby today.
> Now every time i run portupgrade -a i get "** Stale lock file was found. Removed."


It's the same for me.
I had no time to investigate further.


----------



## ale (Jun 4, 2009)

```
# ls -la /var/run/pkgdb.db.lock
ls: /var/run/pkgdb.db.lock: No such file or directory
# portversion -l "<"
** Stale lock file was found. Removed.
# ls -la /var/run/pkgdb.db.lock
-rw-r--r--  1 root  wheel  8 Jun  4 01:01 /var/run/pkgdb.db.lock
```
This is happening, as I've said, since ruby upgrade for me too.

EDIT:
I've also found this
http://lists.freebsd.org/pipermail/freebsd-ports/2009-June/055015.html


----------



## janroc (Jun 4, 2009)

I deleted the /var/run/pkgdb.db.lock and my problem are gone.

Jan


----------



## janroc (Jun 5, 2009)

It is back again. :\

** Stale lock file was found. Removed.

Jan


----------



## Copernicus (Jun 6, 2009)

I had the same problem but now it's resolved.

Just delete /var/run/pkgdb.db.lock and /var/run/portsdb.lock


----------



## RalfvdEnden (Jun 9, 2009)

Deleting those lock files doesn't fix the issue. They're recreated, but not actually deleted once the portupgrade tools finish their tasks.


----------



## virgil (Jun 11, 2009)

I believe this is caused by the finalizers for the PkgDB and PortsDB classes no longer being called.  A result of the latest lang/ruby18 update.  I've filed a bug report (http://www.freebsd.org/cgi/query-pr.cgi?pr=135466) to see if anyone agrees and has better insight than I.  -virgil


----------

