Jenkins service does not start with SDKMan Java on Oracle Linux - linux

I have installed SDKMan on my Oracle Linux 6.9 server. And then installed Java and Jenkins. I created symlinks for /usr/bin/java and /usr/bin/javac.
When I try starting the Jenkins service: sudo service jenkins start
I get error saying: Starting Jenkins bash: /usr/bin/java: Permission denied
This is the executable:
lrwxrwxrwx 1 root root 54 Dec 8 00:07 /usr/bin/java -> /home/user/.sdkman/candidates/java/current/bin/java
What am I missing here?

OK solved this now. I had to change the JENKINS_USER (in /etc/sysconfig/jenkins) from jenkins to root in my case. As per the instructions here changing the user should be accompanied with changing ownership of /var/lib/jenkins, /var/log/jenkins, /var/cache/jenkins (which in my case was already root).

Related

docker-compose permission denied error in hidden folder

docker-compose runs for the yml file in /home/mac as follows:
docker-compose -f /home/mac/vscode.yml build
however gives a permission denied error within /home/mac/.config/ folder:
docker-compose -f /home/mac/.config/vscode.yml build
Error is:
ERROR: .PermissionError: [Errno 13] Permission denied: '/home/mac/.config/vscode.yml'
There seems to be a similar problem to what Jamshaid stated below:
https://stackoverflow.com/a/64585125/393171
So I have given 777 permission to both mac and .config folders; but still doesn't work.
drwxrwxrwx 20 mac mac 4096 Oca 26 22:25 mac
drwxrwxrwx 23 mac mac 4096 Oca 26 22:26 .config
Another strange thing is that this works fine with docker compose command
docker compose -f /home/mac/.config/vscode.yml build
Docker version 20.10.23, build 7155243
docker-compose version 1.29.2, build unknown
But I need to make docker-compose run because Visual Studio Code uses docker-compose in Dev Containers extention.
So may anyone help me figure out what kind of a problem is this? :)
I use Ubuntu 22.04.1 LTS.

Ubuntu Xenial upstart service not found

I had an upstart service which worked fine in trusty by simply storing my conf at /etc/init/test.conf. Now that I've upgraded to Xenial 16.04.2 LTS I'm having problems where the service isn't found.
Is a systemd script required now? If you can still have a upstart with just the conf file, what must I do to resolve this?
Here's an example from digital ocean which demonstrates the problem:
ubuntu#vagrant:~$ sudo ls -la /etc/init/test.conf
-rw-r--r-- 1 root root 126 Mar 24 10:54 /etc/init/test.conf
ubuntu#vagrant:~$ sudo cat /etc/init/test.conf
description "Job that runs the foo daemon"
start on runlevel [2345]
exec echo Test Job ran at `date` >> /var/log/testjob.log
ubuntu#vagrant:~$ sudo service test status
● test.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
ubuntu#vagrant:~$ sudo service test start
Failed to start test.service: Unit test.service not found.
Xenial Xerus uses systemd instead of upstart. From the release notes for Xenial:
Users of Ubuntu 15.10 or Debian Jessie may already be familiar with systemd, which is now the default init system for the majority of mainstream GNU/Linux distributions. On Ubuntu, systemd supplants Canonical's Upstart.
If you make use of custom init scripts, or routinely configure long-running services, you will need to know the basics of systemd. For an overview, read Systemd Essentials: Working with Services, Units, and the Journal.
This guide may also be useful, from when Vivid came out.

Fail2Ban Will Not Start

I am running Centos 6.5 (Kernel Linux jspring 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux) and I was wondering if someone could assist - Im installing Fail2Ban through yum however when I go to run it I am getting the following error;
service fail2ban start
Starting fail2ban: ERROR Directory /var/run/fail2ban exists but not accessible for writing
[FAILED]
If anyone could advise me how to fix this that would be great.
Thanks!
There are several things that could be causing this.
First make sure the permissions and ownership are correct as the other answers state. The directory permissions should be drwxr-xr-x (a.k.a. 644) and it should be owned by root:root.
Now make sure you are attempting to run the start command with the proper authority. If service fail2ban start does not work, try sudo service fail2ban start. Using sudo is recommended but you could also switch to or login as the root user.
You may also want to reboot after you get it running and then run sudo service fail2ban status to make sure it successfully started up again.
You need to set the appropriate rights on the mentioned directory:
drwxr-xr-x root:root
You should set the permissions like this: chmod -R 644 /var/run/fail2ban/
As people have mentioned, this is clearly a permissions issue. I'm not sure if this applies to your version but fail2ban in 2018 has a client, run as:
sudo fail2ban-client start
(or restart or status). It must be run as sudo though.
As is documented in the official commands list here the command fail2ban start <jail> is clearly used to start jails and not to start fail2ban. So you completely missunderstood it's usage.
Try to first stop and then quickly start again the jail sshd that is enabled by default:
fail2ban-client stop sshd
fail2ban-client start sshd
Hey! It works!

Can't launch sonar 2.8 (permission denied to execute wrapper )

I'm new to Sonar, and i was trying to install Sonar 2.8 on my server (Linux 64 on HP-UX)
When i tried to launch it (sonar.sh start) i got the following message
[myHomeDirectory]/sonar/2.8/bin/linux-x86-64/./wrapper: Execute permission denied.
what drives me crazy is that i've putthe whole package on 777 permissions, so i really don't understand what's exactly happening.
Can anyone help with this please ?
Thanks in advance !
I hit a similar issue hence why I came to this post. I was attempting to install SonarQube's scanner in a Docker container but when I was running it, I was getting something along the lines of:
/root/sonar-scanner-2.6.1/bin//sonar-scanner: 103: exec: : Permission denied
I had given the whole /root/ folder all permissions so I was curious about the permission denied. In the end for me it wasn't anything to do with permissions. I simply needed to RTFM.
Sonar-scanner needs a JRE to run and my Docker container didn't have one installed. So if anyone else does the same thing as me, I hope this saves you a few minutes of head scratching.
Not really convinced in the way you are launching it. To get Sonar running I recommend running it on tomcat, providing you just want to use the default database that comes with Sonar. The steps would be:
Install Tomcat
Navigate to your /war directory within your sonar instance and run the command: $] ./build-war.sh.
When this finishes you should see a sonar.war file in the same directory.
Rename the war file ROOT.war instead of sonar.war: $] mv sonar.war ROOT.war
This ensures that sonar runs on tomcat's default port.
Move the war file into the tomcat webapps directory: $] mv ROOT.war /tomcathome/webapps
Navigate to the tomcat /bin folder and run the command $] ./catalina.sh start
Type your server hostname in your browser with a port :8080 at the end and you should see sonar running.
These steps will have sonar running on the default database, though. If you want a MySQL database i'd look at sonar tutorials on how to do that.
I finally came out with the conclusion that the binary file (wrapper) is simply not compiled to run under HP-UX
when launching a file command on wrapper under a Linux i get : <ELF-64 executable object file> which doesn't match the <ELF-64 executable object file - IA64> required by HP-UX running on a Itanium processor
Please check if you have java installed on the machine. Java should be installed on the machine before running sonar-runner.
Use this to check java : java -version

Spring roo only works if run by root

I have installed spring roo version 1.2.3.RELEASE on Ubuntu Linux 12.04 using these instructions: http://static.springsource.org/spring-roo/reference/html/intro.html#intro-installation
I then create an empry directory and try to start roo as instructed in the tutorial:
http://static.springsource.org/spring-roo/reference/html/beginning.html#beginning-step-1
But I get this error:
java.lang.Exception: Unable to create bundle cache lock file: java.io.FileNotFoundException: /usr/share/roo/cache/cache.lock (Permission denied)
And indeed my user does not have permission to write to this file, it is owned by root as expected and if I run sudo roo everything seems to work. Does the installation instructions miss some vital part about permissions? Not knowing that much about roo yet, I would prefer not running it as root.
Can you not just give your user (or group) write access to the roo dir (and sub dirs)?
Why don't you install Roo in a path that you're allowed to use? For instance, in your home: ~/Applications/spring-roo-1.2.3.RELEASE

Resources