permission denied while executing START-DFS.SH in Ubuntu - linux

suresh#suresh-laptop:/$ usr/local/hadoop-2.6.0/sbin/start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
15/02/01 00:24:52 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Incorrect configuration: namenode address dfs.namenode.servicerpc-address or dfs.namenode.rpc-address is not configured.
Starting namenodes on []
suresh#localhost's password:
localhost: mkdir: cannot create directory /usr/local/hadoop-2.6.0/logs': Permission denied
localhost: chown: cannot access/usr/local/hadoop-2.6.0/logs': No such file or directory

Please check these commands:
sudo adduser suresh sudo
chown -R /usr/local/hadoop-2.6.0
chmod -R 755 /usr/local/hadoop-2.6.0

Related

fresh install gogs panic after setup with mkdir data: permission denied

Here just checking out gogs, I followed a tutorial to setup gogs behind apache. I was able to see the install page, ran install successfully. But unable to go past that step, as I don't see a login page for gogs. terminal shows below error
[Macaron] 2020-03-03 16:48:29: Completed GET / 500 Internal Server Error in 743.184µs
[Macaron] 2020-03-03 16:48:29: Started GET /favicon.ico for 10.108.23.170
[Macaron] PANIC: session(start): mkdir data: permission denied
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/session/session.go:162 (0x9bae70)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:79 (0x963b80)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:157 (0x934080)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:135 (0x933daa)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:121 (0x963cd9)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:112 (0x976b1f)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/recovery.go:161 (0x976b0d)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/logger.go:40 (0x967973)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:157 (0x934080)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:135 (0x933daa)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:121 (0x963cd9)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:112 (0x975e40)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/logger.go:52 (0x975e2b)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/logger.go:40 (0x967973)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:157 (0x934080)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/github.com/go-macaron/inject/inject.go:135 (0x933daa)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/context.go:121 (0x963cd9)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/router.go:187 (0x977d66)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/router.go:303 (0x970405)
/home/vagrant/gopath/src/github.com/gogs/gogs/vendor/gopkg.in/macaron.v1/macaron.go:220 (0x968d4c)
/usr/local/go/src/net/http/server.go:2774 (0x74a9c7)
/usr/local/go/src/net/http/server.go:1878 (0x7466b0)
/usr/local/go/src/runtime/asm_amd64.s:1337 (0x466190)
[Macaron] 2020-03-03 16:48:29: Completed GET /favicon.ico 500 Internal Server Error in 649.106µs
I have setup the directory/permissions.
which I can see from
$su -c '/opt/gogs/gogs web' gogs
Password:
2020/03/03 16:52:17 [TRACE] Custom path: /opt/gogs/custom
2020/03/03 16:52:17 [TRACE] Log path: /opt/gogs/log
2020/03/03 16:52:17 [TRACE] Log Mode: File (Info)
when I hit the browser I got the above error.
Solution to this issue is to change dir to the gogs install directory and run
$su -c '/opt/gogs/gogs web' gogs
Password:
2020/03/03 16:52:17 [TRACE] Custom path: /opt/gogs/custom
2020/03/03 16:52:17 [TRACE] Log path: /opt/gogs/log
2020/03/03 16:52:17 [TRACE] Log Mode: File (Info)
solved the issue,
reason: gogs tries to mkdir on present directory, when running from your home, gogs user won't have permission there.
cd /opt/gogs/
helps gogs to run under the gogs user owned directory with needed permissions.
Hope that helps somebody
https://www.itfanr.cc/2017/03/23/docker-ubuntu-gogs-deploy/ explains the workdir for docker, which helped to find this bit of info
Thank you

Hadoop Permission denied on Bash on Ubuntu on Windows

I'm trying to install Hadoop in order to use the HDFS service. I'm doing it in the Bash on Ubuntu on Windows (not VM) :
https://www.microsoft.com/fr-fr/store/p/ubuntu/9nblggh4msv6
The tutorial that I followed was this one (which is really similar to most tutorials for Hadoop installation):
https://www.youtube.com/watch?v=Nb1sinaTlmo
So everything goes well until I try to run the start-dfs.sh but I get this error messages:
17/12/12 22:19:06 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: starting namenode, logging to /usr/local/hadoop/logs/hadoop-hduser-namenode-DESKTOP-QG5RB4T.out
localhost: nice: cannot set niceness: Permission denied
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-hduser-datanode-DESKTOP-QG5RB4T.out
localhost: nice: cannot set niceness: Permission denied
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/logs/hadoop-hduser-secondarynamenode-DESKTOP-QG5RB4T.out
0.0.0.0: nice: cannot set niceness: Permission denied
17/12/12 22:19:25 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
I made sure that the ssh localhost worked, also I gave permission to the hadoop folder chmod -R 755 hadoop/ and also give root privileges to the user I created for doing the hadoop implementation.
If you have any leads or solutions for this problem it would be amazing.
I have the exact same problem and for the love of god, I can't figure it out.
It has been like 2 Months and still nothing helps. I asked so many professionals and they can't figure it out themselves too.
The only tip I received is to check my Windows SSH Broker and disable it, but as far as I tried, it can't be done, cause it's an integral part to Windows. You can only partially disable it, which changes absolutely nothing.
I hope you can find the solution for the problem and I'm sorry that I can't help you with that any further, but I would be soo glad to know the solution to this aswell.
Edit your /etc/passwd file, giving {hadoop} user root permissions (replacing 1001 values with 0)
May be you can see this answer: https://github.com/Linuxbrew/brew/issues/695#issuecomment-386121530.
It says "You can safely ignore this warning. It's an upstream bug in Microsoft Windows."

Can't run Sonar Server caused by Elasticsearch cannot running as root

I'm trying to install SonarQube : i ve followed those steps :
Setting up SOnarQube Tuto : here
To summarize it :
Downloading Sonar and moving it to /opt/sonar
adding those coonfig steps to /opt/sonar/conf/sonar.properties :
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
and
sonar.web.host=127.0.0.1
sonar.web.context=/sonar
sonar.web.port=9000
implementing sonar as a service:
sudo cp /opt/sonar/bin/linux-x86-64/sonar.sh /etc/init.d/sonar
sudo gedit /etc/init.d/sonar
Insert two new lines:
SONAR_HOME=/opt/sonar
PLATFORM=linux-x86-64
Modify the following lines:
WRAPPER_CMD="${SONAR_HOME}/bin/${PLATFORM}/wrapper"
WRAPPER_CONF="${SONAR_HOME}/conf/wrapper.conf"
...
PIDDIR="/var/run"
Register as a Linux service:
sudo update-rc.d -f sonar remove
sudo chmod 755 /etc/init.d/sonar
sudo update-rc.d sonar defaults
After those steps : i ve tried to run Sonar from : localhost:9000/sonar and after executing : sudo /etc/init.d/sonar start
`
Strangely , it didsn't run .
SO when i run `sudo /etc/init.d/sonar status , i discover that it goes steps after few seconds , and it throws some error in it log file , like the following :
es.log:
2017.12.09 18:05:14 ERROR es[][o.e.b.Bootstrap] Exception
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) [elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) [elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) [elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) [elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) [elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) [elasticsearch-5.6.3.jar:5.6.3]
2017.12.09 18:05:14 WARN es[][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.3.jar:5.6.3]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.3.jar:5.6.3]
... 6 more
Any suggestions ??
SonarSource has upgraded the Elasticsearch tool used as a part of the latest SonarQube LTS version. As a result SonarQube cannot be run as a root. See this blog and the SonarQube 6.6 upgrade notes and this SO question.
Change the root access to the sonar file. Try running in normal user access.
chown <another user>:<user group> sonar.sh
I was facing the same issue and spend good amount of time before getting the solution.
Error was same as
2017.12.09 18:05:14 ERROR es[][o.e.b.Bootstrap] Exception
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.3.jar:5.6.3]
Solution
Create a ‘sonar’ user using adduser command //I was using linux system
chown -R sonar sonar-install-folder/
Edit the sonar.sh file sonar-install-folder/bin/linux-x86-6 in start script and change the #RUN_AS_USER to be RUN_AS_USER=sonar
And then use below commands
./sonar.sh stop
Gracefully stopping SonarQube...
SonarQube was not running.
./sonar.sh start
Starting SonarQube...
Started SonarQube.
./sonar.sh status
SonarQube is running (22100).
So, basically elastic search doesnt require to be run by root user. By default the RUN_AS_USER was commented in the startup script which was picking my current user which was root, and then some linux permission rules come into picture due to which elasticsearch process was not getting up and which was causing sonar process to go down as well.
It was evident from sonar.log
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
2020.05.08 06:36:36 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78
2020.05.08 06:36:36 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2020.05.08 06:36:36 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
Create new user to run the sonarQube or access the SonarQube dashboard
for ubuntu flavour user creation.
#sudo adduser sonar.
after executing the above command it will ask for passwd
#adduser sonar sudo
#adduser sonar admin
#sudo su sonar
chown sonar:sonar sonar.sh

How to configure slave node in jenkins with SSH-agent

I was configuring a slave node in Jenkins with SSH Agent but I get the follow error:
[10/31/17 15:23:37] [SSH] Checking java version of java
[10/31/17 15:23:37] [SSH] java -version returned 1.8.0_151.
[10/31/17 15:23:37] [SSH] Starting sftp client.
[10/31/17 15:23:37] [SSH] Remote file system root /var/jenkins does not exist. W
ill try to create it... java.io.IOException: Could not copy slave.jar into /var/
jenkins on slave at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLaunche
r.java:1152) at hudson.plugins.sshslaves.SSHLauncher.access$400(SSHLauncher.java
:145) at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:816) at hu
dson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:793) at java.util.con
current.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolEx
ecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoo
lExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread
.java:748) Caused by: java.io.IOException: Failed to mkdir /var/jenkins at hudso
n.plugins.sshslaves.SFTPClient.mkdirs(SFTPClient.java:83) at hudson.plugins.sshs
laves.SSHLauncher.copySlaveJar(SSHLauncher.java:1120) ... 7 more Caused by: com.
trilead.ssh2.SFTPException: Permission denied (SSH_FX_PERMISSION_DENIED: The use
r does not have sufficient permissions to perform the operation.) at com.trilead
.ssh2.SFTPv3Client.expectStatusOKMessage(SFTPv3Client.java:555) at com.trilead.s
sh2.SFTPv3Client.mkdir(SFTPv3Client.java:955) at hudson.plugins.sshslaves.SFTPCl
ient.mkdirs(SFTPClient.java:81) ... 8 more
[10/31/17 15:23:37] Launch failed - cleaning up connection
[10/31/17 15:23:37] [SSH] Connection closed.
How do I configure slave node in jenkins with SSH-agent?
In the slave configuration on the Jenkins Master, adjust the remote root to a existing directory (or a sub-directory of one that the Jenkins user is allowed to write into), or create /var/jenkins on the slave machine and allow the Jenkins user to write there.
In according to error message:
Caused by: com.
trilead.ssh2.SFTPException: Permission denied (SSH_FX_PERMISSION_DENIED: The use
r does not have sufficient permissions to perform the operation.)
make sure that jenkins user on your slave-node has permissions to create directory /var/jenkins.
log in to your slave, Then run: mkdir /var/jenkins
Then change dir owner to jenkins: chown jenkins /var/jenkins
Re-launch slave agent from master.

watchman.plist permission denied when running a react-native initial project

I'm start using react-native and I followed the tutorials on the website, but when running the example project, it returned some error messages on the terminal:
Looking for JS files in
/Users/username/Desktop/nativeTest/BookSearch
[06:03:00] <START> Building Dependency Graph
[06:03:00] <START> Crawling File System
[06:03:00] <START> Loading bundles layout
[06:03:00] <END> Loading bundles layout (0ms)
React packager ready.
2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
Watchman: watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
ERROR watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
Error: watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
at ChildProcess.<anonymous> (/Users/username/Desktop/nativeTest/BookSearch/node_modules/fb-watchman/index.js:194:18)
at emitTwo (events.js:88:13)
at ChildProcess.emit (events.js:173:7)
at maybeClose (internal/child_process.js:819:16)
at Socket.<anonymous> (internal/child_process.js:320:11)
at emitOne (events.js:78:13)
at Socket.emit (events.js:170:7)
at Pipe._onclose (net.js:470:12)
See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
~
Process terminated. Press <enter> to close the window
I tried to chmod com.github.facebook.watchman.plist but actually there's no such file there. Maybe I should change the path of the file?
Other things I've tried:
brew update
brew upgrade watchman
brew uninstall watchman && brew install --HEAD watchman
Restart and reinit the project
Packages Version (if needed):
node: v5.2.0
watchman: v4.2.0
Current user do not have permission on folder /Users/[username]/Library/LaunchAgents.
Use the following command to fix this:
$ sudo chown $(whoami) /Users/$(whoami)/Library/LaunchAgents
Make sure that /Users/username/Library and /Users/username/Library/LaunchAgents are owned by username and have the correct permissions; here's how mine look:
$ ls -ld ~/Library
drwx------+ 57 wez users 1938 Nov 6 07:49 /Users/wez/Library
$ ls -ld ~/Library/LaunchAgents
drwxr-xr-x 3 wez users 102 Dec 11 16:13 /Users/wez/Library/LaunchAgents
$ ls -l ~/Library/LaunchAgents/com.github.facebook.watchman.plist
-rw-r--r-- 1 wez users 1545 Dec 11 16:13 /Users/wez/Library/LaunchAgents/com.github.facebook.watchman.plist
Also make sure that you don't run watchman as root or via sudo.

Resources