Error Resolving User Permissions + Zsh Command Not Found - path

This is the list of user permissions after logging them to the terminal:
➜ ~ ls -ld / /usr /usr/bin /usr/bin/manpath
drwxr-xr-x 33 root wheel 1190 Nov 14 08:49 /
drwxr-xr-x# 11 root wheel 374 Nov 7 09:12 /usr
drwxr-xr-x 1055 root wheel 35870 Nov 12 11:34 /usr/bin
lrwxr-xr-x 1 root wheel 3 Nov 5 18:13 /usr/bin/manpath -> man
And this is the error I receive when trying to update the permissions:
➜ ~ chmod 755 / /usr /usr/bin /usr/bin/*
chmod: Unable to change file mode on /usr/bin/apropos: Operation not permitted
chmod: Unable to change file mode on /usr/bin/at: Operation not permitted
This all began as an effort to debug the following zsh error:
zsh: command not found
I have tried resetting my $PATH variable to no avail. I've uninstalled and reinstalled zsh, run brew doctor, reinstalled node, etc. and am unsure where to proceed from here. The problems I am trying to fix are two-fold:
fix the PATH so that I can use commands (e.g.: ionic) from the
terminal
fix the permissions so I don't encounter any further
errors as I troubleshoot going forward
Can anyone offer guidance? Been trying to debug this for hours.
This my current PATH:
➜ ~ echo $PATH
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Related

How to install MariaDB ODBC drivers in Docker/Alpine

I see that Alpine supports in its Docker container a MariaDB ODBC Driver as listed here. I need to install it to be used with pyodbc.
What is the Dockerfile command that installs the driver in the image?
Something along the lines of RUN apk add mariadb-connector-odbc
?
My clean install of Alpine had an /etc/apk/repositories file that looked like
#/media/cdrom/apks
http://mirror.reenigne.net/alpine/v3.13/main
#http://mirror.reenigne.net/alpine/v3.13/community
#http://mirror.reenigne.net/alpine/edge/main
#http://mirror.reenigne.net/alpine/edge/community
#http://mirror.reenigne.net/alpine/edge/testing
With that setup
apk add mariadb-connector-odbc
failed. However, after uncommenting the last line …
#/media/cdrom/apks
http://mirror.reenigne.net/alpine/v3.13/main
#http://mirror.reenigne.net/alpine/v3.13/community
#http://mirror.reenigne.net/alpine/edge/main
#http://mirror.reenigne.net/alpine/edge/community
http://mirror.reenigne.net/alpine/edge/testing
… the same command succeeded
localhost:~# apk add mariadb-connector-odbc
fetch http://mirror.reenigne.net/alpine/edge/testing/x86_64/APKINDEX.tar.gz
(1/3) Installing readline (8.1.0-r0)
(2/3) Installing unixodbc (2.3.9-r1)
(3/3) Installing mariadb-connector-odbc (3.1.11-r0)
Executing busybox-1/32/1-r6.trigger
OK: 903 MiB in 146 packages
localhost:~# ls -la /usr/lib/mariadb
total 536
drwxr-xr-x 2 root root 4096 May 14 22:43 .
drwxr-xr-x 6 root root 4096 May 14 22:43 ..
-rwxr-xr-x 1 root root 537856 Jan 6 02:39 libmaodbc.so

Using nix-store --restore to install sources

I'm trying to install mythtv on nixOS.
mythtv uses Qt which uses tremor from xiph.org . git.xiph.org is currently unresponsive, so the install fails. Using nix show-derivation on the relevant .drv file, I see
{
"/nix/store/srhlr1v02a1gkp1ld1hrjzda0kfjcjkf-tremor-562307a.drv": {
"outputs": {
"out": {
"path": "/nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a",
"hashAlgo": "r:sha256",
"hash": "f80ffaf1dc452061c4a2e7566ccec5f8ec1496ef2894857ed42f3ef7097e0754"
}
},
"inputSrcs": [
"/nix/store/jr7l8xyyanakpqr954rvj58lyqal1vfb-builder.sh",
"/nix/store/m9n5a7g5nb7jglcs9i58ycrkmn998wrp-nix-prefetch-git"
],
...
"env": {
...
"url": "https://git.xiph.org/tremor.git"
}
}
}
So I looked for, and succesfully found, this in cache.nixos.org:
$ curl cache.nixos.org/aq8d6qgp55w0g9xdb81cys9b3l95d7hb.narinfo
StorePath: /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
URL: nar/0jm68cws51814dm7gks62vj7a8zrdhwv2x364kq78wbkkqh58maa.nar.xz
Compression: xz
FileHash: sha256:0jm68cws51814dm7gks62vj7a8zrdhwv2x364kq78wbkkqh58maa
FileSize: 109380
NarHash: sha256:0m07gq4zfgigsiz8b518xyb19v7qqp76qmp7lb262825vkqzl3zq
NarSize: 588216
References:
Deriver: cr4d6v24rchmkv26mvzlzrr23z7a5ghb-tremor-562307a.drv
Sig: cache.nixos.org-1:rb9+9oe3LMRlh8TbLuZ7nhMaPIc5fwrAhG4tXtBLAgd7EGBoS2jk6BgYzSRI49MgwdPgAKTtzM3W0Wj0jGojDQ==
Then, I downloaded the narchive: curl -O cache.nixos.org/nar/0jm68cws51814dm7gks62vj7a8zrdhwv2x364kq78wbkkqh58maa.nar.xz and attempted to restore it: nix-store --restore /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a < <(xzdec 0jm68cws51814dm7gks62vj7a8zrdhwv2x364kq78wbkkqh58maa.nar.xz).
This fails initially because the directory exists:
$ nix-store --restore /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a < <(xzdec 0jm68cws51814dm7gks62vj7a8zrdhwv2x364kq78wbkkqh58maa.nar.xz)
error: creating directory '/nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a': File exists
$ ls -ld /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
drwxr-xr-x 3 nixbld10 nixbld 18 Jun 8 20:57 /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
$ ls -l /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
total 0
So I delete it, and try again:
$ nix-store --delete /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
finding garbage collector roots...
removing stale link from '/nix/var/nix/gcroots/auto/f9ldmvya8mix2j52cwsl8h0rqvjycjjy' to '/tmp/martyn/nixos-rebuild.didhrl/nix.drv'
removing stale link from '/nix/var/nix/gcroots/auto/qs606yn37b7irq7jmkvj0ld9wjv36fma' to '/tmp/martyn/nixos-rebuild.didhrl/nix'
deleting '/nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a'
deleting '/nix/store/trash'
deleting unused links...
note: currently hard linking saves 0.00 MiB
1 store paths deleted, 0.07 MiB freed
$ nix-store --restore /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a < <(xzdec 0jm68cws51814dm7gks62vj7a8zrdhwv2x364kq78wbkkqh58maa.nar.xz)
error: creating directory '/nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a': Permission denied
I find that "permission denied" to be a bit odd - I have normal rights to install, indeed to delete (above)...
But it's okay, I can do this with sudo: ```$ sudo nix-store --restore /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a < <(xzdec 0jm68cws51814dm7gks62vj7a8zrdhwv2x364kq78wbkkqh58maa.nar.xz)
$ ls -ld /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
drwxr-xr-x 5 root root 4096 Jun 9 07:27 /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
$ ls -l !$ | head
$ ls -l /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a | head
total 496
-rw-r--r-- 1 root root 6534 Jun 9 07:27 asm_arm.h
-rwxr-xr-x 1 root root 3657 Jun 9 07:27 autogen.sh
-rw-r--r-- 1 root root 4639 Jun 9 07:27 backends.h
-rw-r--r-- 1 root root 14547 Jun 9 07:27 block.c
-rw-r--r-- 1 root root 1109 Jun 9 07:27 block.h
-rw-r--r-- 1 root root 467 Jun 9 07:27 CHANGELOG
-rw-r--r-- 1 root root 10765 Jun 9 07:27 codebook.c
-rw-r--r-- 1 root root 4078 Jun 9 07:27 codebook.h
-rw-r--r-- 1 root root 3084 Jun 9 07:27 codec_internal.h
Better still, the hash looks good:
$ nix-hash /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a --type sha256
f80ffaf1dc452061c4a2e7566ccec5f8ec1496ef2894857ed42f3ef7097e0754
I notice that a lock file remains, so I delete that:
Along the way, I noticed that after the restore, the lock file remains:
$ ls -l /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a.lock
-rw------- 1 root root 0 May 27 08:15 /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a.lock
$ nix-store --delete !$
$ nix-store --delete /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a.lock
finding garbage collector roots...
deleting '/nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a.lock'
deleting '/nix/store/trash'
deleting unused links...
note: currently hard linking saves 0.00 MiB
1 store paths deleted, 0.00 MiB freed
So I should be all set? It seems not:
$ nix-env -i /nix/store/srhlr1v02a1gkp1ld1hrjzda0kfjcjkf-tremor-562307a.drv
installing 'tremor-562307a.drv'
these derivations will be built:
/nix/store/srhlr1v02a1gkp1ld1hrjzda0kfjcjkf-tremor-562307a.drv
building '/nix/store/srhlr1v02a1gkp1ld1hrjzda0kfjcjkf-tremor-562307a.drv'...
exporting https://git.xiph.org/tremor.git (rev 562307a4a7082e24553f3d2c55dab397a17c4b4f) into /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
Initialized empty Git repository in /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a/.git/
I am baffled why nix is rebuilding a store path that is extant and has the requested hash.
I tried repairing the path, to see if maybe the database needed updating in some way:
$ nix-store --repair-path /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
error: you don't have sufficient rights to use this command
$ sudo nix-store --repair-path /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a
error: path '/nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a' is not valid
$ nix-hash /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a --type sha256
f80ffaf1dc452061c4a2e7566ccec5f8ec1496ef2894857ed42f3ef7097e0754
So that 'path ... is not valid' is alarming, but still, it's present with a good hash, so I don't understand why it's supposedly not valid, nor why nix insists on rebuilding it.
Maybe you have a negative narinfo cache entry or maybe the derivation prefers a local build. You could try
nix-store --delete /nix/store/srhlr1v02a1gkp1ld1hrjzda0kfjcjkf-tremor-562307a.drv
nix-store --realise --option narinfo-cache-negative-ttl 0 -vvvvv /nix/store/aq8d6qgp55w0g9xdb81cys9b3l95d7hb-tremor-562307a

How to solve EACCES: permission denied, mkdir 'build/..' - Docker + Ubuntu

I am using this docker file to setup a server at Digital Ocean. I am getting the following errors
EACCES: permission denied, mkdir 'build/emails'
api_1_5a1c41662228 | EACCES: permission denied, mkdir 'build/routes'
api_1_5a1c41662228 | EACCES: permission denied, mkdir 'build/schema'
api_1_5a1c41662228 | EACCES: permission denied, mkdir 'build/utils'
api_1_5a1c41662228 | EACCES: permission denied, open 'build/Context.js'
and so on for a long time.
I have tried the following things
Chown almost everything there is to be.
Tried it on the different versions of OS
Read various blogs about Docker and giving it root access and tried those solutions.
I am using the most recent version of docker.
P.S. It runs perfectly on Mac. Sadly there are no Mac servers.
More info
ls -ltr on the folder
[root#relay-server-centos fusionauth-relay]# ls -ltr /usr/src/
total 0
drwxr-xr-x. 2 1001 1001 6 Apr 11 2018 kernels
drwxr-xr-x. 2 1001 1001 6 Apr 11 2018 debug
drwxr-xr-x. 3 1001 1001 19 Apr 5 11:24 app
I was able to resolve it right now using the root user, which is a really horrible way to do it. But I am out of ideas right now and any help would be welcomed.

unable to lock a file in RHEL6.4

Trying to lock a file in RHEL but seeing following issue
Stopped the services
service rpcbind stop
service nfslock stop
rm -rf /var/lib/nfs/statd/sm/*
rm -rf /var/lib/nfs/statd/sm.bak/*
service rpcbind start
service nfslock start
After this I'm using C program mentioned in https://community.microfocus.com/microfocus/cobol/net_express__server_express/w/knowledge_base/6215/c-program-to-validate-nfs-locking-ability
to :-
• Open File(Create)
• Lock File
• Close File
But seeing below errors
[root#mywebappsserver shared]$ ./nfs_lock
FATAL ERROR: Could not lock file
Even after restarting rpcbind and nfslock not seeing any entry under
# ls -l /var/lib/nfs/statd/sm/
Need your help in same
Fixed it after changing /var/lib permissions
Before:-
ls -ld lib
drwx------. 34 root root 4096 Jul 7 08:32 lib
After:-
ls -ld lib
drwxr-xr-x. 34 root root 4096 Jul 7 08:32 lib

Can't access mounted volume in docker

UPDATE: This wasn't an issue when I setup my project on a Mac. I was using Fedora 24 in this problem.
I am trying to access my app in my docker instance. When I try and ls the mounted directory, I get a permission error:
root#591d02d0d6d2:/app#
ls: cannot open directory .: Permission denied
This is what my docker file looks like:
FROM pvlltvk/ubuntu-trusty-php-fpm-5.6
RUN apt-get install -y\
php5-curl \
php5-sybase \
freetds-dev \
libxml2-dev
ADD freetds.conf /etc/freetds/freetds.conf
USER root
RUN echo 'alias sf="php /app/app/console"' >> ~/.bashrc
WORKDIR /app
I know it's a permissions issue but I couldn't get any solutions to work. If I run ls -lh I can see that the owner id is 1000 and not root.
root#591d02d0d6d2:/# ls -lh
total 24K
drwxrwxr-x. 11 1000 1000 4.0K Dec 12 17:42 app //my project
drwxr-xr-x. 2 root root 4.0K Dec 13 08:25 bin
drwxr-xr-x. 2 root root 6 Apr 10 2014 boot
drwxr-xr-x. 5 root root 360 Dec 15 02:58 dev

Resources