pid file disappears after starting pgpool with ubuntu and postgresql - linux

I´ve installed postgresql 9.1 on ubuntu 12.04 with pgpoolII-3.3.3 and pgPoolAdmin
If I try to run pgpool from a terminal with sudo pgpool it seems to start. Viewing ubuntu file explorer I can see how a pgpool.pid file is created at /var/run/pgpool/pgpool.id (this is the path in pgpool.conf)
But after one second the file disappears.
I have tried to change the owner of the directory and the directory permissions but nothing seems to fix it.
If after that I try to stop pgpool wiht sudo pgpool -m fast stop I got an error: Error. pid file not found
It seems like the file is created and suddenly destroyed. I´m wondering why.
If I try to run pgpool from pgPoolAdmin I got this error: pgpool start failed. pgpool.pid not found.
Like other times, it´s maybe and stupid issue and I´m not being able to solve it as i don´t have a high level of knowledge on those systems.
Any idea about what to try?
Xrry Christmas

Solved. I think the problem was caused by a permission problem. After trying
sudo mkdir /var/run/pgpool
sudo chmod 777 /var/run/pgpool
sudo chown postgres/postgres /var/run/pgpool
sudo postgresql service restart
It seems to be working now.

check the tmp directory using ls -la command and delete the file .s.PGSQL.9999 and .s.PGSQL.9898 and restart the server

Upon configuring PgPool-II, I found some documentation explaining that using the default directory /var/run/pgpool for the PID file was a bad idea, for that file could be erased when the service reboots.
The contents of the /var/run directory (including the pgpool
directory) may be removed by the operating system during a reboot. The
/var/run/pgpool directory should NOT be used as the location for the
pgpool.pid file.
The issue seems to occur when using Ubuntu.
So a possible solution would be to store the PID file in a directory named so as to not match the name of a service that could be rebooted. For instance, you could change the pgpool.conf file :
pid_file_name = '/var/run/pgpool4ever/pgpool.pid'
I could not try it on my own as I do not use Ubuntu, but maybe this could help someone facing a similar problem. Although I am not sure that it is very wise to go past basic Ubuntu way of working....

Related

/usr/bin/env: node: Permission denied

As the title suggests I am receiving the error
/usr/bin/env: node: Permission denied
when trying to run
npm run build
for my react app. The following link is the leadup to this point with all that I've done and tried, not to be included here for the sake of not duplicating questions Error with react-scripts in npm run build.
Additionally, I have viewed this posting, Getting Error /usr/bin/env: node : Permission Denied, and it was unhelpful to me.
Any help is much appreciated.
I was working in a dockerized node environment and noticed that the mounted source code directory had different ownership (running the container as root) from host environment. Changing the ownership using:
chown -R root:root .
made the error go away for me!
The issue ended up being a matter of file ownership. Root was the owner of many things for the project rather than my profile. Simply changed the ownership from root to me.
For me, re-installing node with NVM solved the issue:
Install nvm
nvm install 14
nvm use 14
you should running command as super user sudo npm run build
For anyone else hitting this, there is another avenue of investigation. There might be another factor affecting execute permissions. There's an exec flag on drive mounts to enable script execution (neat safety feature for automounted usb sticks!). So if your code is on a drive that you've mounted, you need that option set to run scripts on it. Tell-tale signs are the permissions on the script being correct (appropriate user, group and execute bits set), but it still complaining about the shebang line (1st line) being the permission denied. Also, if you type mount, you might see noexec set on the mount point where your source code is (it may not show here if exec is set). How your mount is set up varies greatly, but a place to start is your /etc/fstab.

VS Code on linux, various permissions errors

Is there any way to get vs code to work properly in linux? I can't run sudo code . because that gives me an error saying it's not secure to do so, I can't do anything within the editor to force doing things, like staging a file in git, or reloading a newly installed extension. I've googled around, and it seems nobody else has posted about this, and it seems highly unlikely that I'm the first to raise issue about this. (Take it easy on me, I'm a relatively new linux user). I'm trying to figure this out on Ubuntu 18.04 if that's relevant at all. My version of vs code is 1.30.2
I guess my main question is what's the right way to get applications like vs code to be able to perform tasks that required doing things without fighting the OS about sudo and privileges?
Launch via sudo from terminal
To launch VSCode as root --which is highly discouraged-- you must specify an alternate user data directory as follows:
$ sudo code --user-data-dir /path/to/alternate/folder
VSCode will automatically generate the required folders in the selected directory and launch with root privileges.
Change permissions to fix "permission denied" error
The solution in this case is to manually change the permissions of the two directories /home/$USER/.config/Code/ and /home/$USER/.vscode/. Perform these steps:
$ sudo chmod 755 /home/$USER/.config/Code
$ sudo chmod 755 /home/$USER/.vscode
To answer your other question:
If you really need to run several commands as root and you are annoyed by having to enter your password several times (when sudo has expired), just do sudo -i and you'll become root.
If you want to run commands using pipes, use sudo sh -c "comand1 | command2".
You may also want to take a look at this Ask Ubuntu answer about running applications as root.
I solve this problem using:
sudo chown -R YOUR_USER YOUR_PROJECT/
You basically need to tell the OS that you are the owner of the files you create. Use sudo chown <user name> <projects directory>
However, if you already created some files before applying chown, don't forget to change their permission also sudo chown <user name> <projects directory>/<file name>.

Having trouble creating path to executable program in linux

I've been having a lot of trouble trying to set up a path to an executable file in linux. Sorry If it's a dumb question, but I'm new to linux and still figuring things out.
Anyways, the file I want to create a path to is located at:
/opt/gitools/gitools-2.3.1/gitools
So I created a path at the end of my .bashrc file:
export PATH=$PATH:/opt/gitools/gitools-2.3.1/
I've checked, and the file gitools as well as all parent directories are marked as executable. However, when I enter "gitools", it returns:
/bin/bash: /opt/gitools/gitools-2.3.1/gitools: Permission denied
And when I enter "sudo gitools", it returns:
sudo: gitools: command not found
There is nothing wrong with the program itself, because I can run it by going to its directory and entering "sudo ./gitools", however, I'm unsure of why I need sudo when it should be executable for all users.
Any help is greatly appreciated!
I finally figured out a solution that works.
I tried to give full read write execute permission to all files in the program, but that just created errors that prevented running the program at all.
However, I noticed that the owner of all of the files was set to root, so in a last ditch attempt to get it to work I decided to recursively change the ownership of all directories and files associated with the program by going to the /opt directory and entering:
sudo chown -R myUsername:myUsername gitools/
Hope that this might help someone with a similar problem!

ubuntu backup-manager Permission denied

I've recently installed backup manager onto my ubuntu machine to have automated backup going. The problem is when I go to set up the automatization using this code -
it comes us up saying this "bash: /etc/backup-manager.sh: Permission denied"
I do not understand this error. I've tried change the user who read/writes to someone other than root and that didn't work. I tried changed the chmod number from 770 to 700 and still didn't work.
any info on this is welcome. Thank you to those who help :)
those wondering I am using this tutorial giving to me by the host. https://documentation.online.net/en/dedicated-server/tutorials/backup/configure-backup/start
I'm using the desktop version of ubuntu 16 incase that is needed
The sudo doesn't do what you want in this case. What happens is that the shell evaluates the redirection and attempts to open the /etc/backup-manager.sh for you before the sudo cat even gets started. That fails because the shell still runs as you unprivileged user. You have to say sudo -i to open a new root shell, execute the commands and exit again.
Alternatively you could try sudo nano /etc/backup-manager.sh and paste the contents there. This would work because the editor is run as root and does the file opening itself when you save.

RStudio cannot reach .Rhistory on Ubuntu

I was working with markdown file on RStudio. I have Ubuntu 14.04 on my laptop. I produce html files using knitr. I decided to clean my enviroment and added rm and gc commands at the end.
Now here is a message in my console window:
Error attempting to read history from ~/.Rhistory: permission denied (is the .Rhistory file owned by root?)
What it means? Is it bad for my code?
You are right - the first time you ran it, you were in sudo mode, and the .Rhistory file was created with root as the owner. Running RStudio as root would remove the symptom, but is not ideal. To be able to run it as a regular user, simply change the owner of the .Rhistory file:
sudo chown -c <user_name> .Rhistory
In the best traditions of stackoverflow I reply to my own question! The problem occurred because when I first started R, I did it as su:
sudo R
so I can load a lot of useful libraries in /usr/lib/R/site-library and not in my account. As result .Rhistory became su file. It is possible for RStudio to see it if it is started as
sudo rstudio
and then all is fine.

Resources