DragonFlyBSD / DPorts

The dedicated application build system for DragonFly BSD
Other
89 stars 46 forks source link

Squid fails #158

Closed bluesun08 closed 8 years ago

bluesun08 commented 9 years ago

I run Dfly 4.3. After installing Squid via Dports and "squid -z" i get the following error:

FATAL: Ipc::Mem::Segment::create failed to shm_open(/squid-cf__metadata.shm): (13) Permission denied

What goes wrong?

jrmarino commented 9 years ago

In general, this is not an appropriate question for dports issues -- better the user list, etc. However, you are in luck. According to google, somebody had this exact issue on DragonFly and it's been solved:

http://comments.gmane.org/gmane.os.dragonfly-bsd.user/1405

jrmarino commented 9 years ago

well, hold on, let me read this further

jrmarino commented 9 years ago

This seems to need a patch to be ideally fixed, but venk's response got somebody going:

"Some workarounds -- patch squid to create its shm file in /tmp/≤...> or some other common path; or if the shm segment is opened w/o O_EXCL and you don't mind a file in /, create it manually and set permissions so squid can read/write it."

jrmarino commented 9 years ago

I'll leave the issue open to remind me to patch this (or figure out what's going on with FreeBSD -- why they don't have the same issue)

jrmarino commented 9 years ago

does "/var/run/squid" exist on your machine?

I suspect it is not, and it's failing because this directory is missing. It should be using this location, not "/"

jrmarino commented 9 years ago

I opened a PR on this, I think I know the cause but not why it's set up this way:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201405

bluesun08 commented 9 years ago

I created "/var/run/squid" (chmod 777) and get the same error message. Now i'm completely confused. What is the solution?

By the way 1: I wonder why the often used "squid"-daemon don't run correctly under a server operating system.

By the way 2: My experience is, if i post this in a user list i will get the info: please post it in dports.

jrmarino commented 9 years ago

well, I initially thought this was "how do I run the software" question, but it's seems more like an issue suitable for this list now.

The original suggestion was to precreate the file that's missing with easy permissions but that seems like a hack to me.

I think the code I published is what is responsible, but precreating /var/run/squid should have worked.

jrmarino commented 9 years ago

seems that shm_portable_segment_name_is_path is not supported on DragonFly

bluesun08 commented 9 years ago

ok. so how can i get run squid?

jrmarino commented 9 years ago

you have to wait until this is sorted out.

jrmarino commented 9 years ago

or pre-create the filename in root

bluesun08 commented 9 years ago

pre-create the filename in root? Can you give me detailed instructions?

jrmarino commented 9 years ago

If I post a post, can you add it to "files" and rebuild squid to test?

jrmarino commented 9 years ago

post a *patch

jrmarino commented 9 years ago

if you want to download this patch, put it in www/squid/files and rebuild squid, the patch is here: http://leaf.dragonflybsd.org/~marino/patch-compat_shm.cc

jrmarino commented 9 years ago

if it works, we'll have to update the port at some level.

bluesun08 commented 9 years ago

now it works! thank you - i love you :-)

jrmarino commented 9 years ago

Did it write to /var/run/squid ?

bluesun08 commented 9 years ago

yep

jrmarino commented 9 years ago

ok. So we still need to modify the port to create that directory by default (in addition to the patch)

jrmarino commented 9 years ago

fyi, squid 3.5.6 is in dports now if you want to pull it and build it. (new version)

bluesun08 commented 8 years ago

i need squid to run on port 80. google says that in this case squid have to run as user root. how can i run squid as root?

jrmarino commented 8 years ago

If this is an "how do I use this software?" question, it's not appropriate for "DPorts Issues". If there is a problem with the port that prevents the s/w (squid) from running correctly, it is appropriate.

So is there an actual issue with the port preventing normal use?

bluesun08 commented 8 years ago

ok, let me go in detail:

i write " squid_user="root" " in /etc/rc.conf. If then i try to start squid there is the following error message: "squid: Ipc::Mem::Segment::create failed to shm_open(/var/run/squid/cf__metadata.shm): (13) Permission denied"

so i think it is a dports problem.

jrmarino commented 8 years ago

How about more detail? for example, does /var/run/squid/cf__metadata.shm already exist? if so, what are file permissions? Maybe it exists and it's write only.

why would something work as a normal user and not as root?

bluesun08 commented 8 years ago

Please have a look at my initial post. The same error message again ...

jrmarino commented 8 years ago

not, it is not the same message. You are misleading any diagnosis by suggesting a fixed problem has returned.
Note "/" vs "/var/run/squid". That's a big difference.

Plus, you didn't answer my questions. I have other things to do esp. if you are holding back on details and thinking my questions are rhetorical.

bluesun08 commented 8 years ago

:-) It seems to me that "/var/run/squid/cfmetadata.shm" is created while starting squid. if squid_user="squid" then squid starts and /var/run/squid/cf__metadata.shm exists if squid_user="root" then squid don't start (see error message above) and /var/run/squid/cfmetadata.shm don't exist The directory permissions of /var/run/squid are 777.

I agree with you: why would something work as a normal user and not as root? So i think this is a bug.

jrmarino commented 8 years ago

try opening a PR at https://bugs.freebsd.org/bugzilla/ put "www/squid : " at the beginning on the title. The maintainer is good guy and dragonfly-friendly. He'll probably be able to figure this out quickly. Remind him of shm patch for dragonfly as a hint. I just have no time at the moment.

bluesun08 commented 8 years ago

Thank you! But i'll wait until you're less busy.

jrmarino commented 8 years ago

well, it's also the correct thing to do. He's the maintainer. I just get these building, but any advanced problems really needs to go to maintain unless they refuse to support dragonfly

jrmarino commented 8 years ago

I'm going to close this unless new information comes that illustrates this as a build problem (vs something suitable for FreeBSD bugzilla report)