Ubuntu 16.04.3
I'd like to install pgAdmin:
I hvae created a virtualenv with python 2.
Then install pgAdmin 4 v2.0:
pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.0/pip/pgadmin4-2.0-py2.py3-none-any.whl
It's time to run pgAdmin:
(pgadmin4) michael#michael-desktop:~/PycharmProjects/venv$ python pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Traceback (most recent call last):
File "pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py", line 55, in <module>
exec(open(file_quote(setupfile), 'r').read())
File "<string>", line 46, in <module>
File "/home/michael/PycharmProjects/venv/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/data_directory.py", line 23, in create_app_data_directory
_create_directory_if_not_exists(os.path.dirname(config.SQLITE_PATH))
File "/home/michael/PycharmProjects/venv/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/data_directory.py", line 15, in _create_directory_if_not_exists
os.mkdir(_path)
OSError: [Errno 13] Permission denied: '/var/lib/pgadmin'
Could you give me a kick here?
If you do not want to change the permission of anything, you can always override default paths in pgAdmin4.
Create a file named config_local.py (if not already present) at your installation location ../pgadmin4/web/
File location in my case:
/usr/local/lib/python2.7/dist-packages/pgadmin4/config_local.py
and add following code in your config_local.py,
import os
DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
SQLITE_PATH = os.path.join(DATA_DIR, 'pgadmin4.db')
SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
Restart pgAdmin4 and check.
Permission error means the user 'michael' (/var/lib has drwxr-xr-x) has the permission to execute but doesn't have the permission to write on the folder (according to your comment of the folder info below).
One of the solutions you can use to be able to access freely the folder would be something like:
chown -R michael:root /path/to/the/directory
The second part of the answer, you've figured it out #Michael.
downloading pgadmin by using the command:
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.5/pip/pgadmin4-1.5-py2.py3-none-any.whl
and then execute command:
pip install pgadmin4*.whl.
create the folders manually (or add to your pgAdmin installation script, if there is one), and assign the permissions:
sudo mkdir "/var/log/pgadmin"
sudo chmod a+wrx "/var/log/pgadmin"
sudo mkdir "/var/lib/pgadmin"
sudo chmod a+wrx "/var/lib/pgadmin"
this would not assign permissions to the entire /var/log but just for the /var/log/pgadmin only.
solved issue with several steps
1. create empty folders on host vm
mkdir /private/var/lib/pgadmin
chmod 777 /private/var/lib/pgadmin
start pgadmin docker image
docker pull dpage/pgadmin4
docker run -p 80:80\
-v /private/var/lib/pgadmin:/var/lib/pgadmin \
...
you will see newly created file structure like this
/private/var/lib/pgadmin
-rw-------. 1 5050 5050 757760 Jan 13 23:11 pgadmin4.db
drwx------. 2 5050 5050 50 Jan 13 23:00 sessions
drwxr-xr-x. 3 5050 5050 31 Jan 13 23:17 storage
thus UID 5050 is our target one
4. copy your pgadmin4.db into target dir and apply proper UID [5050 in my case]
As a result application will work, user settings will be saved.
I installed pgadmin4 v2.1 on Ubuntu 16.04 and had this problem. See the last line of code. (I run this in a script file, lazy.) I also installed 2.0 this way as a test to see if it really is a fix. I did not have to use config_local.py.
cd ..
cd home/vagrant
sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev
virtualenv .pgadmin4
cd .pgadmin4
source bin/activate
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.1/pip/pgadmin4-2.1-py2.py3-none-any.whl
pip install pgadmin4-2.1-py2.py3-none-any.whl
# For this either use your remote host panel to edit the file or:
nano lib/python2.7/site-packages/pgadmin4/config.py
# Change:
# DEFAULT_SERVER = '0.0.0.0'
# Here is the trick. Run this boot up file with sudo. This fixed it for me.
sudo python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
I had the same problem with pgAdmin4 v3.1, I just write sudo python pgAdmin4.py and it worked!.
Related
I have been trying to install microsoft SQL server on my lInux machine but it keeps throwing the same error, even after following the instructions given here on this platform.
When I run:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
It throws this error:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 95, in <module>
sp = SoftwareProperties(options=options)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 103, in __init__
self.sourceslist = SourcesList()
File "/usr/lib/python3/dist-packages/aptsources/sourceslist.py", line 276, in __init__
self.refresh()
File "/usr/lib/python3/dist-packages/aptsources/sourceslist.py", line 292, in refresh
self.matcher.match(source)
File "/usr/lib/python3/dist-packages/aptsources/sourceslist.py", line 484, in match
if (re.search(template.match_uri, source.uri) and
File "/usr/lib/python3.9/re.py", line 201, in search
return _compile(pattern, flags).search(string)
File "/usr/lib/python3.9/re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.9/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.9/sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.9/sre_parse.py", line 834, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.9/sre_parse.py", line 834, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.9/sre_parse.py", line 668, in _parse
raise source.error("nothing to repeat",
re.error: nothing to repeat at position 2
and when I run:
sudo apt install mssql-server
It throws the following error:
The following packages have unmet dependencies:
mssql-server : Depends: libssl1.0.0 but it is not installable
E: Unable to correct problems, you have held broken packages.
I am unable to install libssl1.0.0 since its already in its latest version, libssl1.1
What do I do??
The output for cat /etc/debian_version is parrot
And output of cat /etc/os-release is
PRETTY_NAME="Parrot OS 5.0 (Electro Ara)"
NAME="Parrot OS"
VERSION_ID="5.0"
VERSION="5.0 (Electro Ara)"
VERSION_CODENAME=ara
ID=parrot
ID_LIKE=debian
HOME_URL="https://www.parrotsec.org/"
SUPPORT_URL="https://community.parrotsec.org/"
BUG_REPORT_URL="https://community.parrotsec.org/"
ParrotOS is a Linux distribution based on Debian with a focus on security, privacy and development. You might want to check your reasons for installing SQL Server on it, perhaps you might wish to use a different distro.
The following shows how you can install Microsoft SQL Server 2019 on a ParrotOS 5.0 (ara) Docker container...
./docker-compose.yml:
version: "3.8"
services:
parrot:
build: parrot
container_name: parrot
environment:
- "ACCEPT_EULA=Y"
- "SA_PASSWORD=StrongPassw0rd"
ports:
- "1433:1433"
./parrot/Dockerfile:
# REFs:
# 1. Parrot on Docker
# https://parrotsec.org/docs/parrot-on-docker.html
# 2. SQL Server on Linux
# https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-overview
# 3. Quickstart: Install SQL Server and create a database on Ubuntu
# https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu
FROM parrotsec/core:5.0.0
RUN apt-get update
RUN apt-get install --yes wget
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list > /etc/apt/sources.list.d/mssql-server-2019.list
RUN apt-get update
RUN apt-get install --yes mssql-server
USER mssql
EXPOSE 1433
ENTRYPOINT [ "/opt/mssql/bin/sqlservr" ]
After running docker-compose up --build you can connect to the running container (in this case, from the Docker host computer) to execute SQL queries...
$ sqlcmd -S localhost,1433 -U sa -P StrongPassw0rd
1> SELECT GETDATE()
2> GO
-----------------------
2022-05-28 11:36:37.783
(1 rows affected)
I get this error when I try to commit.
OS - Latest OSX
Git version - git version 2.11.0 (Apple Git-81)
.git/hooks/pre-commit: line 2: ./node_modules/pre-commit/hook: No such file or directory
pre-commit hook runs first when you try to commit changes, it can be used to do certain checks, tests, conditions. In this case, clearly, you don't have it, that's why it's complaining.
Go to .git/hooks directory and remove pre-commit file, as its trying to reference to node_modules/pre-commit/hook. It should resolve it.
Other option is append your commit with option: --no-verify, it will make the commit without checking.
You should delete node_modules folder and install again running npm install or yarn install. After it, you probably solve the problem.
If the script files are actually present, then the cause may be that the first line of the script should be something like:
#!/bin/sh
Otherwise you get the same error.
Any file will work -- e.g., /bin/bash, /usr/local/bin/python3 -- as long as it exists and is executable.
Following #Mutant tip, the simple answer for me was:
rm .git/hooks/pre-commit
Working from macOS, my issue was that Python3 was originally installed via Homebrew, and after I upgraded Python3 via brew update && brew upgrade, I got the same error.
To fix this, I needed to update the symbolic links in the directory that the shebang (#!) line in the .git/hooks/pre-commit file points to.
Here's how I fixed this in my environment:
Look at the contents of the .git/hooks/pre-commit:
cat .git/hooks/pre-commit
The first few lines should look something like:
#!/usr/local/opt/pre-commit/libexec/bin/python3
# File generated by pre-commit: https://pre-commit.com
# ID: 0123456789abcdef0123456789abcdef
import os
import sys
Take note of the path to the python3 executable in the shebang line:
/usr/local/opt/pre-commit/libexec/bin/
cd into that directory.
cd /usr/local/opt/pre-commit/libexec/bin/
Take at look at the Python symlinks:
ls -l | grep python
You'll see some symlinks that are probably broken:
lrwxr-xr-x 1 user group 91 Apr 5 13:33 python -> /usr/local/Cellar/python#3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/bin/python3.9
lrwxr-xr-x 1 user group 91 Apr 5 13:33 python3.9 -> /usr/local/Cellar/python#3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/bin/python3.9
lrwxr-xr-x 1 user group 91 Apr 5 13:33 python3 -> /usr/local/Cellar/python#3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/bin/python3.9
Quick note: In case something goes wrong or my answer isn't the solution, you might want to back up these symlinks first by running:
mv python python.bak
mv python3.9 python3.9.bak
mv python3 python3.bak
Update the symbolic links using ln -s [PATH] [LINK], where [PATH] is the location of the Homebrew-updated Python3 executable and [LINK] is python, python3.9, and python3:
ln -s /usr/local/Cellar/python#3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/bin/python3.9 python
ln -s /usr/local/Cellar/python#3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/bin/python3.9 python3.9
ln -s /usr/local/Cellar/python#3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/bin/python3.9 python3
When you've done that, list your Python symlinks again.
ls -l | grep python
You should see the updated symlinks, and git commit should now work.
lrwxr-xr-x 1 user group 89 Apr 6 13:58 python -> /usr/local/Cellar/python#3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/bin/python3.9
lrwxr-xr-x 1 user group 89 Apr 6 13:58 python3 -> /usr/local/Cellar/python#3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/bin/python3.9
lrwxr-xr-x 1 user group 89 Apr 6 13:58 python3.9 -> /usr/local/Cellar/python#3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/bin/python3.9
I got that error after I was played with brew to make yarn work in Webstorm.
The fix is just re-install pre-commit again.
brew install pre-commit
https://pre-commit.com/
For anyone who is having this problem with husky, for me what solved it is running:
husky install
(which I forgot to run) The docs talk about it under usage, aka npm run prepare for one time after you set up husky. usage
Nothing helps me but remove local repo and clone it again. This kinda error appears when I accidentically tried commit and push changes to master..
If you look at your package.json you will get a better idea about the problem.
Husky is npm dependency so basically you got the error because for some reason it's not available.
So, option one run
npm i
Or if you already did that
rm -rf node_modules
npm i
I had installed pre-commit using homebrew, and installed the pre-commit-vscode extension and got this error.
What solved this was to also run pre-commit install from the root of the git repo.
In my case in Mac OS, upgrading python3 via brew somehow messed up python3 location whereas the shebang in pre-commit was was still pointing to the old python3 location. So finding new python3 location via which python3 and updating same in pre-commit and other scripts under .githooks folder did fixed the issue.
INGW64 ~/code/ingestor-gdelt (test-build)
$ git commit -m "your comment"
.git/hooks/pre-commit: line 9: py: command not found
.git/hooks/pre-commit: line 10: py: command not found
git commit --no-verify -m "your comment"
This command resolved my issue !!
just make sure you have hooks folder inside of .git . if not make one.
Deleting pre-commit from hooks inside .git worked for me
I am using iMac to run Apache Solr in command line. done the following:
wget https://apache.mirrors.nublue.co.uk/lucene/solr/8.5.1/solr-8.5.1-src.tgz
tar -xzf solr-8.5.1-src.tgz
cd to /solr
i then typed : bin/solr start and got permissions denied.
I tried sudo bin/solr start -force
and got :password: type password
after typing the password i get sudo: bin/solr command not found
I read that I need to change the solr home directory for better installation as it is denying root access probably?
Appreciate any suggestion to get Solr starting
Thanks
Paul
I think you need to download the binaries instead of the source files, then run:
cd solr/bin
solr create -c yourCore
solr start -p 8983
change the permission to to bin folder
something like:
sudo chmod -R 777 bin
You should download and install the version without scr at the end:
https://apache.mirrors.nublue.co.uk/lucene/solr/8.5.1/solr-8.5.1.tgz
I am trying to configure apache2 with cgi (python). For that, I have to change permissions of some folders and files but I am getting sudo fatal errors every time I try to change permission of a file or a Folder.
For Example:
1
j#ubuntu:/etc/apache2$ ls
apache2.conf envvars magic mods-enabled sites-available
conf.d httpd.conf mods-available ports.conf sites-enabled
j#ubuntu:/etc/apache2$ sudo chmod 777 httpd.conf
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
...................................................................................
2
j#ubuntu:/usr/lib/cgi-bin$ sudo /etc/init.d/apache2 restart
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
...................................................................................
3
j#ubuntu:/usr/lib$ sudo chmod -R 777 /usr/lib/cgi-bin
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
...................................................................................
Note:
j#ubuntu:/etc/apache2$ ls -l /usr/lib/sudo/sudoers.so
-rwxrwxrwx 1 root root 177452 Jan 31 2012 /usr/lib/sudo/sudoers.so
Any help would be highly appreciated !
If you have docker installed on your host, you can leverage its permission vulnerabilities on volumes to solve this issue.
Run
docker run -it -v /usr/lib/sudo:/tmp ubuntu:xenial
Once inside the container, being the root user there, you can:
cd /tmp
chown root sudoers.so or chmod 644 sudoers.so depending on the exact issue
It's not a really clean solution but it solves the issue.
You have to login to root shell to resolve this sudoers.so permission issue. If you have root account login, directly login to root shell otherwise search something like "How do I boot into a root shell" or "Drop to root shell prompt". If you use Ubuntu you can follow this link https://askubuntu.com/questions/92556/how-do-i-boot-into-a-root-shell.
Once you are in root shell change the permission of the file /usr/lib/sudo/sudoers.so to
#chmod 644 /usr/lib/sudo/sudoers.so
for OSX, there is diskutil command to repair disk permissions:
diskutil resetUserPermissions / `id -u`
it will take a while :( ... you might first try to open script editor, create new script and execute:
do shell script "chown -R root /usr/local/libexec/sudo/sudoers.so" with administrator privileges
if that does not work, the repairpermission should do the trick.
Please try to login as a root user and change the file permission for the directory as
chmod 700 /usr/lib/sudo/sudoers.so then it will solve your problem.
It worked for me!
Try this:
pkexec chmod go-w /usr/lib/sudo/sudoers.so
I have a standard homebrew install inside of usr/local/
When I try:
Larson-2:~ larson$ brew install postgresql
Error: Cannot write to /usr/local/Cellar
And when I use sudo:
Larson-2:~ larson$ sudo brew install postgresql
Cowardly refusing to `sudo brew install'
What am I doing wrong?
You somehow have limited permissions to /usr/local/Cellar. Brew doesn't like to install with sudo which is why it refuses.
Check the permissions:
ls -ld /usr/local/Cellar
Open them up for writing:
sudo chmod a+w /usr/local/Cellar
Do not use sudo when working with brew (for security reasons).
You've to simple set-up your permissions.
So I would go even further and change the permissions to:
sudo chgrp -R admin /usr/local /Library/Caches/Homebrew
sudo chmod -R g+w /usr/local /Library/Caches/Homebrew
and then apply the specific group (either admin or staff) to user which should be allowed to use brew command. Check groups of your user via: id -Gn).
If there are further issues, run: brew doctor to see what's wrong.
I'd change the group permissions:
$ chgrp -R admin /usr/local/Cellar
$ chmod g+w /usr/local/Cellar
assuming your user account is in group admin.
This also happens if you have multiple users on your machine. If so, it would be best for you to change the user since every other approach would have you messing around with a lot more files and folders than just /usr/local/Cellar
Use su userWhoInstalledBrew.
The problem can be solved by changing the directory's owner to the current user:
sudo chown -R $USER /usr/local
This answer is taken from: https://github.com/Homebrew/homebrew/issues/17884
Following the advice chukcha14 provided in his answer at There is no Cellar file in my usr/local dir for brew, I did this:
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community#4.2
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Error: Could not create /usr/local/Cellar
Check you have permission to write to /usr/local
jaimes-mbp:SMR jaimemontoya$ sudo mkdir /usr/local/Cellar
Password:
jaimes-mbp:SMR jaimemontoya$ sudo chown $(whoami) /usr/local/Cellar
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community#4.2
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
==> Installing mongodb-community from mongodb/homebrew-brew
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.3.tgz
###################################################################################### 100.0%
Error: Failed to install plist file
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink .
/usr/local/opt is not writable.
You can try again using:
brew link mongodb-community
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall mongodb/brew/mongodb-community`
==> Caveats
To have launchd start mongodb/brew/mongodb-community at login:
ln -sfv /usr/local/opt/mongodb-community/*.plist ~/Library/LaunchAgents
Then to load mongodb/brew/mongodb-community now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
Or, if you don't want/need launchctl, you can just run:
mongod --config /usr/local/etc/mongod.conf
==> Summary
🍺 /usr/local/Cellar/mongodb-community/4.2.3: 20 files, 304M, built in 110 seconds
jaimes-mbp:SMR jaimemontoya$ sudo mkdir /usr/local/opt
jaimes-mbp:SMR jaimemontoya$ sudo chown $(whoami) /usr/local/opt
jaimes-mbp:SMR jaimemontoya$ brew link mongodb-community
Linking /usr/local/Cellar/mongodb-community/4.2.3... 13 symlinks created
jaimes-mbp:SMR jaimemontoya$
funny but I received the Error: Cannot write to /usr/local/Cellar message due to lack of disk space .. :/ ( 18MB left )