octopkg - couldn't lock 16384 bytes of memory (libgcrypt)
Posted: Thu Jul 23, 2015 6:24 pm
I was using octopkg, (github version) just for test, it worked fine a couple of days.
Suddenly I have got the error in subject, more precisely, when refreshing the pkg database, the output window shown:
couldn't lock 16384 bytes of memory (libgcrypt): Resource temporarily unavailable
a fast search around the problem highlighted the fact it was probably related to gnome-keyring, a short mail exchange with octopkg author confirmed that the problem is restricted to gnome environment and that kdesu always work correctly.
A further search directed me to mlock(2) and the related man page says:
$ sysctl vm.max_wired
vm.max_wired: 326864
$ sysctl vm.stats.vm.v_wire_count
vm.stats.vm.v_wire_count: 377931
as you can see the second value already exceed the system wide limit above.
The solution is to tweak the kernel limits:
sudo sysctl vm.max_wired=512000
and the error disappeared.
Suddenly I have got the error in subject, more precisely, when refreshing the pkg database, the output window shown:
couldn't lock 16384 bytes of memory (libgcrypt): Resource temporarily unavailable
a fast search around the problem highlighted the fact it was probably related to gnome-keyring, a short mail exchange with octopkg author confirmed that the problem is restricted to gnome environment and that kdesu always work correctly.
A further search directed me to mlock(2) and the related man page says:
my values at error time:Since physical memory is a potentially scarce resource, processes are
limited in how much they can lock down. The amount of memory that a sin-
gle process can mlock() is limited by both the per-process RLIMIT_MEMLOCK
resource limit and the system-wide ``wired pages'' limit vm.max_wired.
vm.max_wired applies to the system as a whole, so the amount available to
a single process at any given time is the difference between vm.max_wired
and vm.stats.vm.v_wire_count.
$ sysctl vm.max_wired
vm.max_wired: 326864
$ sysctl vm.stats.vm.v_wire_count
vm.stats.vm.v_wire_count: 377931
as you can see the second value already exceed the system wide limit above.
The solution is to tweak the kernel limits:
sudo sysctl vm.max_wired=512000
and the error disappeared.
