I got this error upon starting Squid Proxy Server using the command sudo squid -z

fatal: ipc::mem::segment::create failed to shm_open(/squid-cf__metadata.shm): 13 permission denied

How shall I fix it? Im using version 3.5.26 of Squid. I tried any fixes I found in the web but nothing works. I tried implementing the fix below I found in the web:

Just add the following line to your /etc/fstab file: shm /dev/shm tmpfs nodev,nosuid,noexec 0 0 After that use (as root): # mount shm

Unfortunately, it doesn't work. Another possible fix on the web is error reading squid.pid

squid: ERROR: Could not read pid file /var/run/squid.pid: (13) Permission denied

Unfortunately, as I look in my directory, I could not find squid.pid. How will I get my Squid working? Thanks.


fatal: ipc::mem::segment::create failed to shm_open()

This error is related to permission denied of accessing a shared memory segments (man shm_open). The issue is, that you probably run squid process with the wrong user (either before or now).

The solution is to remove .shm files from /dev/shm:

$ sudo rm -v /dev/shm/squid*.shm

To run squid with the right user (e.g. proxy), use sudo, make sure your cache_effective_user is correct in the config file (squid.conf), your cache and log directories are owned by that user.

Check the following Docker container at sameersbn/docker-squid as the working example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.