Postgresql Failed to start on linux - linux

My PostgreSQL stopped working suddenly and I am unable to start it. (Last changes in my Linux were, I tried to install dockers).
When I run the command:
sudo service postgresql restart
OR
sudo service postgresql start
I get the error:
* Starting PostgreSQL 11 database server
* Failed to issue method call: Unit postgresql#11-main.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql#11-main.service' for details.
[fail]
and
~$ sudo service postgresql status
11/main (port 5434): down
There result of systemctl status:
~ $ sudo systemctl status postgresql#11-main.service
postgresql#11-main.service
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)
I have tried all the available options on SO and on other forums but neither worked for me.
What can be the issue?
EDIT:
cat /etc/os-release
Output:
NAME="Ubuntu"
VERSION="14.04.6 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.6 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
and
ls -al /var/lib/pgsql
output:
ls: cannot access /var/lib/pgsql: No such file or directory
Then I tried
ls -al /var/lib/postgresql/
output:
total 40
drwxr-xr-x 7 postgres postgres 4096 Mar 24 13:34 .
drwxr-xr-x 90 root root 4096 Apr 6 18:36 ..
drwxr-xr-x 4 postgres postgres 4096 Apr 6 18:20 11
drwxr-xr-x 3 postgres postgres 4096 Feb 11 2016 9.3
drwxr-xr-x 3 postgres postgres 4096 Dec 3 2018 9.4
drwx------ 2 postgres postgres 4096 Jan 31 11:20 .aptitude
-rw------- 1 postgres postgres 5898 Apr 6 18:33 .bash_history
drwx------ 3 postgres postgres 4096 Feb 11 2016 .cache
-rw------- 1 postgres postgres 2180 Mar 24 13:34 .psql_history
and
yum info postgresql11-server
Error: No matching Packages to list
EDIT 2
sudo systemctl list-unit-files | grep postg et
output:
grep: et: No such file or directory
and
ls -l /var/lib/postgresql/11
output:
total 8
drwxr-xr-x 2 root root 4096 Apr 6 18:20 data
drwx------ 19 postgres postgres 4096 Apr 2 18:53 main

Related

bash: line : docker: command not found

I am using jenkins in a docker container and would like to start another instance, whenever I try to use docker command like
docker run -t -i ap/dashboard /bin/bash
I get this error:
bash: line 61: docker: command not found
How do I navigate to another container or solve this error?
I can clearly see that the vm creator was able to use the docker command by reading the /root/.ash_history
here are some details about the system:
[-] Specific release information:
3.3.1
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.3.1
PRETTY_NAME="Alpine Linux v3.3"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"
Hostname:
b51cdbb7eebd
ENVIRONMENTAL #######################################
Environment information:
JENKINS_VOL=/var/lib/jenkins
JAVA_VERSION_BUILD=17
HOSTNAME=b51cdbb7eebd
JAVA_VERSION_MAJOR=8
JENKINS_HOME=/opt/jenkins
NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/java/jre/bin
JAVA_BASE=/usr/local/java
PWD=/
JAVA_HOME=/usr/local/java/jre
JAVA_PKG=server-jre
LANG=C.UTF-8
XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt
SHLVL=2
HOME=/root
PKG_URL=https://circle-artifacts.com/gh/andyshinn/alpine-pkg-glibc/6/artifacts/0/home/ubuntu/alpine-pkg-glibc/packages/x86_64
JENKINS_VERSION=1.637
JAVA_VERSION_MINOR=66
_=/usr/bin/env
[-] Available shells:
# valid login shells
/bin/sh
/bin/ash
/bin/bash
[+] We can read root's home directory!
total 76
drwx------ 5 root root 4.0K Aug 28 2018 .
drwxr-xr-x 1 root root 4.0K Nov 24 10:55 ..
-rw------- 1 root root 3.1K Aug 29 2018 .ash_history
-rw------- 1 root root 155 May 16 2016 .bash_history
drwxr-xr-x 2 root root 4.0K May 12 2016 .oracle_jre_usage
drwx------ 2 root root 4.0K Aug 28 2018 .ssh
-rwxr-xr-x 1 root root 46.0K Aug 28 2018 LinEnum.sh
drwxr-xr-x 3 root root 4.0K May 12 2016 dockerfiles
-rw-r--r-- 1 root root 0 Aug 28 2018 foo
Looks like we're in a Docker container:
10:net_prio:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
9:net_cls:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
8:freezer:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
7:devices:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
6:memory:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
5:blkio:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
4:cpuacct:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
3:cpu:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
2:cpuset:/docker/b51cdbb7eebd806431ee4120d9b3ae050dbefe4a835bf2063446724572e45e30
1:name=openrc:/docker
-rwxr-xr-x 1 root root 0 May 16 2016 /.dockerenv
[-] Anything juicy in the Dockerfile:
-rw-r--r-- 1 root root 617 May 12 2016 /root/dockerfiles/jenkins/Dockerfile
I tried many docker commands without hope
is it because that I'm already inside the container??
Try with docker run -t -i ap/dashboard /bin/ash.
Maybe your container does not use bash so you should try with /bin/sh which is a symcolic link to the default installed shell processor.

Permission denied in "make qemu" in wtakuo/xv6-env docker image

I have an image from https://hub.docker.com/r/wtakuo/xv6-env. I pull it with docker pull wtakuo/xv6-env and run it with:
$ docker run -it --rm -v $(pwd):/home/xv6/xv6-riscv wtakuo/xv6-env
After container created and run image on its, I run make qemu but I get this error:
mkfs/mkfs fs.img README user/_cat user/_echo user/_forktest user/_grep user/_init user/_kill user/_ln user/_ls user/_mkdir user/_rm user/_sh user/_stressfs user/_usertests user/_grind user/_wc user/_zombie
fs.img: Permission denied
make: *** [Makefile:137: fs.img] Error 1
I don't know what should be do to fix it.
this is my directory content (with ll command):
drwxrwxr-x 8 root root 4096 Nov 1 16:30 .git/
-rw-rw-r-- 1 xv6 xv6 1174 Nov 1 16:27 LICENSE
-rw-rw-r-- 1 xv6 xv6 4709 Nov 1 16:27 Makefile
-rw-rw-r-- 1 root root 2305 Nov 1 16:24 README
-rw-rw-r-- 1 xv6 xv6 17 Nov 1 16:30 README.md
drwxrwxr-x 2 xv6 xv6 4096 Nov 4 17:57 kernel/
drwxrwxr-x 2 xv6 xv6 4096 Nov 4 17:57 mkfs/
drwxrwxr-x 2 xv6 xv6 4096 Nov 4 17:57 user/
I googled for this but not found effectively answer.
I tried
sudo chown -R user1:user1 *
but show this error: fs.img: Permission denied
For this problem, we must use from sudo command.
our user is xv6 and the password is also the same.
after use from it, we see this output:
xv6 kernel is booting
hart 1 starting
hart 2 starting
init: starting sh

kestrel-dotnetapp.service: Failed at step EXEC spawning /usr/local/dotnet: Permission denied

I'm trying to install .NET Core(3.1) app in Centos8 using steps given in MS enter .
Service File as per Microsoft document /etc/systemd/system/kestrel-dotnetapp.service
[Unit]
Description= .NET Web API App for centos
[Service]
WorkingDirectory=/var/Application/netcoreapp31
ExecStart=/usr/local/dotnet /var/Application/netcoreapp31/helloapp.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnetapp
User=user
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
When i do > sudo systemctl start kestrel-dotnetapp.service am getting error.
Jun 04 22:51:28 hostname systemd[1827]: kestrel-dotnetapp.service: Failed to execute command: Permission denied
Jun 04 22:51:28 hostname systemd[1827]: kestrel-dotnetapp.service: Failed at step EXEC spawning /usr/local/dotnet: Permission denied
-- Subject: Process /usr/local/dotnet could not be executed
-- Defined-By: systemd
Find below ls -la :
[user#hostname dotnet]$ ls -la
total 108
drwxr-xr-x. 4 root root 94 Apr 22 09:34 .
drwxr-xr-x. 14 root root 154 Jun 4 21:11 ..
-rwxr-xr-x. 1 root root 73048 Apr 22 09:32 dotnet
drwxr-xr-x. 3 root root 17 Apr 22 09:34 host
-rw-r--r--. 1 root root 1116 Apr 22 09:29 LICENSE.txt
drwxr-xr-x. 4 root root 67 Apr 22 09:34 shared
-rw-r--r--. 1 root root 31330 Apr 22 09:29 ThirdPartyNotices.txt
My application deliverables folder
[user#hostname Application]$ ls -la
total 8
drwxr-xr-x. 3 root root 26 Jun 4 20:53 .
drwxr-xr-x. 22 root root 4096 Jun 4 20:53 ..
drwxr-xr-x. 2 777 user 4096 Jun 4 20:45 netcoreapp31
Found that service is starting when we change path of ExecStart to ExecStart=/usr/local/dotnet/dotnet . No idea why microsoft blog said till ExecStart=/usr/bin/dotnet is enough !
PS: Also if the Linux is SE service files shouldn't be in /home directory
After hours and hours of searching... the answer above is valid
even for Dotnet 5.0 application with default installation and default user pi with custom publish folder:
[Service]
WorkingDirectory=/home/pi/myPublishDirectory
ExecStart=/home/pi/.dotnet/**dotnet** /home/pi/myPublishDirectory/MyApplication.dll
User=pi
...

Tomcat installed folder access is denied on linux

Please find below set of cmds & outputs
[ec2-user#ip-172-31-38-218 opt]$ ls -al
total 9416
drwxr-xr-x 3 root root 4096 Nov 7 13:52 .
dr-xr-xr-x 25 root root 4096 Nov 7 13:16 ..
-rw-r--r-- 1 root root 9625824 Sep 4 22:52 apache-tomcat-8.5.34.tar.gz
drwxr-xr-x 5 root root 4096 Aug 11 01:26 aws
[ec2-user#ip-172-31-38-218 opt]$ sudo groupadd tomcatgrp
[ec2-user#ip-172-31-38-218 opt]$ sudo useradd -s /bin/false -g tomcatgrp -d /opt/tomcatfolder tomcatuser
[ec2-user#ip-172-31-38-218 opt]$ ls -al
total 9420
drwxr-xr-x 4 root root 4096 Nov 7 13:53 .
dr-xr-xr-x 25 root root 4096 Nov 7 13:16 ..
-rw-r--r-- 1 root root 9625824 Sep 4 22:52 apache-tomcat-8.5.34.tar.gz
drwxr-xr-x 5 root root 4096 Aug 11 01:26 aws
drwx------ 2 tomcatuser tomcatgrp 4096 Nov 7 13:53 tomcatfolder
Now, when I run the cmd I am getting Permission denied as follows
[ec2-user#ip-172-31-38-218 opt]$ cd /opt/tomcatfolder/
-bash: cd: /opt/tomcatfolder/: Permission denied
Can you please help in resolving this above issue..?
I followed instructions of installing Tomcat from this link how-to-install-apache-tomcat-8-on-centos-7
It seems you are the ec2-user, but the directory is owned by tomcatuser and the permissions on the directory do now allow other users or groups to read it.
Try sudo chmod 755 /opt/tomcatfolder/ and then cd into it.
That will add read and execute permissions to the directory.

Create symbolic link fails in Docker for Windows, it's not supported yet?

I have a docker container running Ubuntu Server. I am running Docker for Windows and I have the following version of Docker and Docker Compose respectively installed:
> docker-compose -v
docker-compose version 1.11.2, build f963d76f
> docker -v
Docker version 17.03.1-ce-rc1, build 3476dbf
This is what I have tried so far without success:
// The dojo linked file exists so I've tried to update it as per this answer (http://stackoverflow.com/a/1951752/719427)
> docker exec -it dockeramp_webserver_1 ln -sf /var/www/html/externals/dojo /var/www/html/externals/public_html/js/dojo
ln: failed to create symbolic link '/var/www/html/externals/public_html/js/dojo': No such file or directory
// I have deleted the previous linked file and then I tried to create a new one
> docker exec -it dockeramp_webserver_1 ln -s /var/www/html/externals/dojo /var/www/html/externals/public_html/js/dojo
ln: failed to create symbolic link '/var/www/html/externals/public_html/js/dojo': No such file or directory
// removed the directory name from the link name
> docker exec -it dockeramp_webserver_1 ln -s /var/www/html/externals/dojo /var/www/html/externals/public_html/js
ln: failed to create symbolic link '/var/www/html/externals/public_html/js': No such file or directory
Because the error keep saying the directory doesn't exists then I've checked if the error is right or wrong:
> docker exec -u www-data -it dockeramp_webserver_1 ls -la /var/www/html/externals/dojo
total 80
drwxr-xr-x 2 root root 0 Mar 25 15:09 .
drwxr-xr-x 2 root root 4096 Mar 25 15:09 ..
drwxr-xr-x 2 root root 0 Mar 25 15:09 dijit
drwxr-xr-x 2 root root 0 Mar 25 15:09 dojo
drwxr-xr-x 2 root root 0 Mar 25 15:09 dojox
drwxr-xr-x 2 root root 0 Mar 25 15:09 mmi
-rwxr-xr-x 1 root root 74047 Mar 25 15:09 tundra.css
> docker exec -u www-data -it dockeramp_webserver_1 ls -la /var/www/html/public_html/js
total 24
drwxr-xr-x 2 root root 4096 Mar 26 14:40 .
drwxr-xr-x 2 root root 4096 Mar 25 15:11 ..
-rwxr-xr-x 1 root root 7123 Mar 25 15:09 jquery.PrintArea.js
-rwxr-xr-x 1 root root 6141 Mar 25 15:11 quoteit_delegate_search.js
They both exists so ... what I am missing here? It's not supported in Windows just yet? I have found the development team added something called mfsymlinks in a previous version than mine.
The command is telling you that /var/www/html/externals/public_html does not exist. You only showed that the /var/www/html/externals/dojo and /var/www/html/public_html/js folders exist. I believe this is a simple typo in your commands.

Resources