Starting tomcat7 service on OpenShift error - tomcat7

Was able to stop the tomcat 7 service on OpenShift, but trying to start it gives an error:
/etc/init.d/tomcat7 start
Starting tomcat7: touch: cannot touch /var/run/tomcat7.pid': Permission denied
chown: cannot access/var/run/tomcat7.pid': No such file or directory
/etc/init.d/tomcat7: line 181: /var/log/tomcat7-initd.log: Permission denied
[FAILED]
Permission is denied to /var/log so I cannot check/change the /var/log/tomcat7-initd.log permissions. No permission for sudo either.
Any ideas will be welcome.

I just deleted and recreated the OpenShift application.

Related

Docker unable to copy files to mounted volume

I am unable to run this command on jenkins, but i am able to run this same command on the windows powershell
16:13:55 + docker run -v /opt/jenkins/workspace/tas/zigbee-gateway/hostoutput/:/home/jenkins/output_to_host tas-gateway cp -a /home/jenkins/output/. /home/jenkins/output_to_host
16:13:55 cp: cannot create regular file '/home/jenkins/output_to_host/./Gateway_INTL_1.0.4-10_ramips_24kec.ipk': Permission denied
16:13:55 cp: cannot create regular file '/home/jenkins/output_to_host/./Gateway_CN_1.0.4-10_ramips_24kec.ipk': Permission denied
16:13:55 cp: cannot create regular file '/home/jenkins/output_to_host/./Gateway_TEST_1.0.4-10_ramips_24kec.ipk': Permission denied
16:13:55 cp: preserving times for '/home/jenkins/output_to_host/.': Operation not permitted
What am I missing out? the jenkins is run on amazon linux
It looks like Jenkins' user does not have write permission to the specified folder.
edit: please try
sudo usermod -aG docker jenkins

PostgreSQL docker container on Windows

I've been trying to run a PostgresSQL Docker container on my Windows machine and mounting the data volume, using the following command:
docker run -p 5432:5432 -it --volume c:\Users\me\Desktop\pg\data\:/var/lib/postgresql/data postgres:latest -e POSTGRES_USER=user POSTGRES_PASSWORD=password
However I keep getting a list of permission denied errors when the container tries to spin up:
chown: changing ownership of ‘/var/lib/postgresql/data/pg_log’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_logical/mappings’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_logical/snapshots’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_logical’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_multixact/members/0000’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_multixact/members’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_multixact/offsets/0000’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_multixact/offsets’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_multixact’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_notify/0000’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_notify’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_replslot’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_serial’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_snapshots’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_stat’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_stat_tmp/db_0.stat’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_stat_tmp/db_16395.stat’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_stat_tmp/global.stat’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_stat_tmp’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_subtrans/0000’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_subtrans’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_tblspc’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_twophase’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/PG_VERSION’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_xlog/00000001000000000000000A’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_xlog/00000001000000000000000B’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_xlog/archive_status’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/pg_xlog’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/postgresql.auto.conf’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/postgresql.conf’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/postmaster.opts’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data/postmaster.pid’: Permission denied
chown: changing ownership of ‘/var/lib/postgresql/data’: Permission denied
Can someone point out what I'm doing wrong?
Thanks in advance.
This is known limitation in Docker for Windows. The Linux <-> Windows filesystem mapping semantics from your Windows dir to the Linux dir are imperfect because the mount is done with CIFS/SMB. One of the things that won't work is chown (changing the owner) because that cannot be mapped to your Windows filesystem.
You should probably use a named volume instead. This forum post has details: https://forums.docker.com/t/data-directory-var-lib-postgresql-data-pgdata-has-wrong-ownership/17963/24?u=friism
I posted a partial solution to one of the related git issue links.
A partial workaround can be done by using Postgres tablespaces to store the database object files on the windows host system. It is not a perfect solution because the core data directory (represented by PGDATA) still resides on the LinuxVM. But at least you can manage subsequent database creation and file storage on the Windows host and outside the Linux VM.
docker run --rm --name mypostgres
-e POSTGRES_PASSWORD=pwd
-d -p 5432:5432
-v /var/lib/docker/basedata:/var/lib/postgresql/data
-v d:/data/largedb:/mnt/largedb
postgres
This sets the default data storage to a (persistent) directory on the Linux VM (/var/lib/docker/basedata).
It also tells docker to mount your windows D:\data\largedb as a volume that is visible to the Postgres container as /mnt/largedb. (The windows directory need not exist yet.)
Log into postgres and using psql or whatever tool, execute the following DDL:
CREATE TABLESPACE winhoststorage LOCATION '/mnt/largedb';
CREATE DATABASE "my_large_db" WITH TABLESPACE = "winhoststorage";
Go ahead and create tables and data in my_large_db. Stop the containter. Navigate to D:\data\largedb in Windows Explorer and you will see data files. Restart the container and you will see the data from the previous session.
(Note: Docker Desktop for Windows (2.2) on Win 10 which uses the DockerDesktopVM and not MobyLinux or docker-machine.)
Are you using docker with hyper-v or docker-toolbox? Because in my experience, I used only docker-toolbox (it uses docker-machine), and to map a volume successfully using --volume or -v (is the same) you should put this nomenclature for the Win path:
docker run -p 5432:5432 -it -v /c/Users/me/Desktop/pg/data:/var/lib/postgresql/data postgres:latest -e POSTGRES_USER=user POSTGRES_PASSWORD=password
Not sure if it can help. Maybe your problem is because of the path for the mapped volume. Good luck!

Permission Denied, Laravel and Monolog -

Error in exception handler:
The stream or file "/home/wwwroot/default/tor_service/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /home/wwwroot/default/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:84
Anyone knows how to fix this?
Thank you.
Storage folder should be writable by your web server.
You can change the owner of the storage directory to www-data
chown -R www-data:www-data storage

Datameer installation failure

I was trying to install the trail version of Datameer for RHEL which comes in form of rpm package.
The install was done properly but when I started the services, i got the below error:
[root#ip-xx-xxx-xx-xx ~]# /etc/init.d/das-conductor start
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
Found JAVA=/usr/java/jdk1.7.0_67/jre/bin/java in JAVA_HOME=/usr/java/jdk1.7.0_67
Java 7 found
DeployMode: trial
DAS Options:
Java native libraries: /opt/datameer/Datameer-5.5.0-apache-1.0.3/lib/native/Linux-amd64-64
Starting jetty using port 8080
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
find: failed to restore initial working directory: Permission denied
Starting Jetty: STARTED Jetty Mon May 18 04:02:03 EDT 2015
I ran into same issue. I think you are starting up Datameer as root user.
After installation of Datameer, there is a user 'datameer'created. You need to switch to that user and run the startup under that user account.

When I upload my CodeIgniter System to my Amazon EC2, why are all of my permissions messed up?

For some weird reason, my "system" folder has permissions of "000" when I upload it. This totally breaks CodeIgniter as I get all sorts of errors:
Message: CI_Config::include(/[mysite]/system/application/config/assetlibpro.php) [ci-config.include]: failed to open stream: Permission denied
I don't think this is an EC2-specific problem. If you fix the permissions using
chmod -R 755 /[mysite]/system
you should be OK (755 means read/write/execute for owner, read/execute for group and world)

Resources