1

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.

  • 1
    Something's wrong with your permissions in /dev/shm, but the permissions in fstab should be okay. Do you have SElinux enabled? If yes, then disable it for testing. Please add the output of ls -la /dev/shm. – Freddy Apr 8 at 8:54
  • 1
    Could you include more info, please? OS and the squid.conf file could be helpful – Jose Raul Barreras Apr 8 at 22:24
  • How did you install squid? Current version for Ubuntu 18.04 is 3.5.27. Please apply updates. And did you try starting squid from its startup script with systemctl start squid? – wazoox Apr 10 at 15:42
1

You've run squid with the wrong user, which created files with wrong permissions.

squid: ERROR: Could not read pid file

You need to run with sudo: sudo squid -z.

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

You need to remove Squid's .shm files from /dev/shm or assign the right permissions.

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

Also make sure that:

  • Squid's log dir (/var/log/squid?) is owned by the right user (proxy?).
  • Squid's cache dir (/var/spool/squid?) is owned by the right user.

For the full example, check the following Docker container at sameersbn/docker-squid.

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.