You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by ha...@xsmail.com on 2018/03/28 22:15:46 UTC

New 7.2.1 install on linux; "permission denied" on exec?

I'm attempting to install Solr 7.2.1 on linux.

Following instructions at

	https://lucene.apache.org/solr/guide/7_2/taking-solr-to-production.html#taking-solr-to-production

I install

	cd /home/test/
	wget http://apache.osuosl.org/lucene/solr/7.2.1/solr-7.2.1.tgz
	tar zxvf ./solr-7.2.1.tgz

	id solr; grep solr /etc/passwd
		uid=485(solr) gid=482(solr) groups=482(solr),100(users)
		solr:x:485:482::/var/solr:/bin/sh

	cd /home/test/solr-7.2.1

	./bin/install_solr_service.sh \
	 /home/test/solr-7.2.1.tgz \
	 -n \
	 -i /opt/solr \
	 -d /var/solr \
	 -s solr \
	 -u solr \
	 -p 8888

	chown -R solr:solr /opt/solr

	cat /etc/default/solr.in.sh | egrep -v "^$|^#"
		SOLR_PID_DIR="/var/solr"
		SOLR_HOME="/var/solr/data"
		LOG4J_PROPS="/var/solr/log4j.properties"
		SOLR_LOGS_DIR="/var/solr/logs"
		SOLR_PORT="8888"

On exec, it fails to start due to permissions

	systemctl daemon-reload
	systemctl start solr
		Job for solr.service failed because the control process exited with error code. See "systemctl status solr.service" and "journalctl -xe" for details.

	systemctl status solr.service -l
		● solr.service - LSB: Controls Apache Solr as a Service
		   Loaded: loaded (/etc/init.d/solr; bad; vendor preset: disabled)
		   Active: failed (Result: exit-code) since Wed 2018-03-28 14:42:21 PDT; 18s ago
		     Docs: man:systemd-sysv-generator(8)
		  Process: 7458 ExecStart=/etc/init.d/solr start (code=exited, status=126)

		Mar 28 14:42:20 test.loc su[7460]: (to solr) root on none
		Mar 28 14:42:20 test.loc su[7460]: pam_unix(su-l:session): session opened for user solr by (uid=0)
		Mar 28 14:42:21 test.loc solr[7458]: -sh: /opt/solr/solr/bin/solr: Permission denied

	journalctl -f
		Mar 28 14:43:23 test.loc su[7658]: (to solr) root on none
		Mar 28 14:43:23 test.loc su[7658]: pam_unix(su-l:session): session opened for user solr by (uid=0)
		Mar 28 14:43:23 test.loc systemd[7659]: pam_unix(systemd-user:session): session opened for user solr by (uid=0)
		Mar 28 14:43:23 test.loc systemd[7659]: Startup finished in 100ms.
		Mar 28 14:43:23 test.loc solr[7656]: -sh: /opt/solr/solr/bin/solr: Permission denied
		Mar 28 14:43:23 test.loc su[7658]: pam_unix(su-l:session): session closed for user solr
		Mar 28 14:43:23 test.loc systemd[1]: solr.service: Control process exited, code=exited status=126
		Mar 28 14:43:23 test.loc systemd[1]: Failed to start LSB: Controls Apache Solr as a Service.
		Mar 28 14:43:23 test.loc systemd[1]: solr.service: Unit entered failed state.
		Mar 28 14:43:23 test.loc systemd[1]: solr.service: Failed with result 'exit-code'.
		Mar 28 14:43:23 test.loc systemd[7659]: Received SIGRTMIN+24 from PID 7701 (kill).
		Mar 28 14:43:23 test.loc systemd[7660]: pam_unix(systemd-user:session): session closed for user solr

But the executable perm is

	ls -al /opt/solr/solr/bin/solr
		-rwxr-xr-x 1 solr solr 75K Jan  9 13:32 /opt/solr/solr/bin/solr*

Why's "permission denied", and what's specifically to be done to fix the launch/exec?

Re: New 7.2.1 install on linux; "permission denied" on exec?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 3/30/2018 6:01 AM, hal469@xsmail.com wrote:
> WHY that works, that's still an open question for me ... 

If you had tried the "-x" trick, it might have given me some insight.  
But if your solution is acceptable to you, then we can let the matter 
drop.  If you ever upgrade Solr, you're probably going to be in the same 
situation again.  At that point you can either try to figure it out, or 
apply the same fix.

Thanks,
Shawn


Re: New 7.2.1 install on linux; "permission denied" on exec?

Posted by ha...@xsmail.com.
hi

On Thu, Mar 29, 2018, at 10:35 AM, Shawn Heisey wrote:
> Looks fine.  It's a little odd to be changing the install location to
> /opt/solr instead of /opt ... but if that's what you really want, it
> won't cause any issues.

Just testing that it does what I want, where I want.  I always *1st* install into a dedicated subdir ... have had one too many apps fail to create their own subdir, and 'pollute'!

> > 	chown -R solr:solr /opt/solr
> 
> Why are you doing this step?

Because it was complaining about permissions.  1st assumption was ownership ...

>  Those files are *MEANT* to be owned by
> root.  The solr user has no need to write to files in that location. 
> (Changing permissions in this way is unlikely to hurt anything, but
> isn't at all necessary)

Noted.

> distribution 

I'm on OpenSuse.  So still have to do this

  https://github.com/apache/lucene-solr/pull/305/files

1st.

> Try the following as a troubleshooting step.  Either log in as "solr" or
...


I managed to 'fix' the problem.

rm -f /etc/init.d/solr

and replace it with a systemd unit file,

/etc/systemd/system/solr.service

That seems to do the trick:

ps aux | grep solr
   solr     35445  181  1.6 4047996 267116 ?      Sl   04:57   0:11 java -server -Xms512m -Xmx51 ...

and all's good.

WHY that works, that's still an open question for me ...

Re: New 7.2.1 install on linux; "permission denied" on exec?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 3/28/2018 4:15 PM, hal469@xsmail.com wrote:
> 	cd /home/test/
> 	wget http://apache.osuosl.org/lucene/solr/7.2.1/solr-7.2.1.tgz
> 	tar zxvf ./solr-7.2.1.tgz
>
> 	id solr; grep solr /etc/passwd
> 		uid=485(solr) gid=482(solr) groups=482(solr),100(users)
> 		solr:x:485:482::/var/solr:/bin/sh
>
> 	cd /home/test/solr-7.2.1
>
> 	./bin/install_solr_service.sh \
> 	 /home/test/solr-7.2.1.tgz \
> 	 -n \
> 	 -i /opt/solr \
> 	 -d /var/solr \
> 	 -s solr \
> 	 -u solr \
> 	 -p 8888

Looks fine.  It's a little odd to be changing the install location to
/opt/solr instead of /opt ... but if that's what you really want, it
won't cause any issues.

> 	chown -R solr:solr /opt/solr

Why are you doing this step?  Those files are *MEANT* to be owned by
root.  The solr user has no need to write to files in that location. 
(Changing permissions in this way is unlikely to hurt anything, but
isn't at all necessary)

> 		Mar 28 14:42:21 test.loc solr[7458]: -sh: /opt/solr/solr/bin/solr: Permission denied

Try the following as a troubleshooting step.  Either log in as "solr" or
use the following command as root to change users:

su - solr

Then run this command:

/usr/bin/env bash -x /opt/solr/solr/bin/solr

What I'm hoping that will do is either output a better error message, or
output some longer data that can hopefully pinpoint the problem.  If
that command actually works, then you MIGHT be able to get something
helpful by editing that script and adding " -x" (without the quotes, but
WITH the space) to the end of the first line.  After that edit, try
running the init script again.

What specific distribution and version of Linux are you running?  The
output of "lsb_release -a" and "uname -a" can be very useful to answer
this question with a lot of detail.

What shell does the solr user have?  This is the last entry on the
user's line in /etc/passwd.  That user will need a REAL shell --
/bin/false and other things that prevent login will NOT work.

Thanks,
Shawn