Why I am getting Screen is terminating error in MacOS - macos

When trying to enter into Docker VM in mac, I am getting screen is terminating error whereby I cannot go into Docker Desktop. In Mac, Docker host is not the mac as it runs as a VM. Any solutions?
Thank you for the help.

Workarounds
I think it's a bug since version 2.3.0.4 of Docker Desktop for Mac, as I have used screen successfully to access the Docker VM in the past on Mac without this issue. (edit: this issue appears to be still present at version 2.4.0.0)
There are some alternative methods to access the Docker VM. Here is one that worked for me:
workaround method 1
run this command to enter shell of the Docker VM:
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
Then you can do what you need to do at the usual location for Docker volumes:
/ # ls -lah /var/lib/docker/volumes/
total 72
drwx------ 10 root root 4.0K Aug 27 11:34 .
drwx--x--x 15 root root 4.0K Oct 31 00:51 ..
drwxr-xr-x 3 root root 4.0K Aug 26 10:44 14ce94e174839f1947efa6fcbf5ac1fb2ea3b0f0b3f25311fee333ee374576b6
drwxr-xr-x 3 root root 4.0K Aug 25 12:34 34eb2bd80931ff954e1da80c5383beb4def61129d4005432b77080531cd10a5a
drwxr-xr-x 3 root root 4.0K Aug 27 11:34 830de2ce31519c921b50c448964b54517ca4461d337b56a9fd6e5b354ace3247
drwxr-xr-x 3 root root 4.0K Aug 25 12:34 data-layer_mongo_data
drwxr-xr-x 3 root root 4.0K Aug 26 11:01 ebb440184703bfad17184bd5ff74b677b50d74b8f0fbdd116506a1fcacfb00cd
drwxr-xr-x 3 root root 4.0K Aug 27 11:27 hawakening-services_back-end_log
drwxr-xr-x 3 root root 4.0K Aug 27 11:27 hawakening-services_front-end_log
drwxr-xr-x 3 root root 4.0K Aug 27 11:27 hawakening-services_mongo_data
-rw------- 1 root root 64.0K Oct 31 00:51 metadata.db
workaround method 2
Here's another one that also worked for me.
Run this command to enter shell of the Docker VM:
docker run --rm -it --privileged --pid=host walkerlee/nsenter -t 1 -m -u -i -n sh
As before, here is where the Docker volumes' directories are:
/ # ls -lah /var/lib/docker/volumes/
total 72
drwx------ 10 root root 4.0K Aug 27 11:34 .
drwx--x--x 15 root root 4.0K Oct 31 00:51 ..
drwxr-xr-x 3 root root 4.0K Aug 26 10:44 14ce94e174839f1947efa6fcbf5ac1fb2ea3b0f0b3f25311fee333ee374576b6
drwxr-xr-x 3 root root 4.0K Aug 25 12:34 34eb2bd80931ff954e1da80c5383beb4def61129d4005432b77080531cd10a5a
drwxr-xr-x 3 root root 4.0K Aug 27 11:34 830de2ce31519c921b50c448964b54517ca4461d337b56a9fd6e5b354ace3247
drwxr-xr-x 3 root root 4.0K Aug 25 12:34 data-layer_mongo_data
drwxr-xr-x 3 root root 4.0K Aug 26 11:01 ebb440184703bfad17184bd5ff74b677b50d74b8f0fbdd116506a1fcacfb00cd
drwxr-xr-x 3 root root 4.0K Aug 27 11:27 hawakening-services_back-end_log
drwxr-xr-x 3 root root 4.0K Aug 27 11:27 hawakening-services_front-end_log
drwxr-xr-x 3 root root 4.0K Aug 27 11:27 hawakening-services_mongo_data
-rw------- 1 root root 64.0K Oct 31 00:51 metadata.db

Related

How to run parametrized bash scripts in Docker CLI

I have an issue that I'm not able to solve. I want to run a bash script that is inside my Docker CLI container, and I want to execute it, passing parameters. Usually, I run scripts using a notation like this:
docker exec -i $CLI_ID bash "./script.sh"
But I don't know how to pass parameters to the script. I tried to execute it with:
docker exec -i $CLI_ID bash "./script.sh PARAM"
But it doesn't work. How can I do it?
Thanks
Try with bash -c option
docker exec -i $CLI_ID bash -c "./script.sh PARAM"
Hope this helps.
Make sure the script is executable , then you dont need the bash and double quotes etc. Just run it striaght away by path/name and provide the options.
[root#ap-p1m-ff ~]# docker exec -i 0c cat /tmp/test.sh
#!bin/bash
ls $1
[root#ap-p1m-ff ~]# docker exec -i 0c /tmp/test.sh -l
total 4
-rw-r--r-- 1 root root 159 Jun 4 18:32 RELEASE
drwxr-xr-x 2 root root 120 Jun 4 18:33 assets
drwxr-xr-x 1 root root 31 Jun 4 18:33 bin
drwxr-xr-x 2 root root 6 Apr 12 2016 boot
drwxr-xr-x 5 root root 340 Jun 7 19:50 dev
drwxr-xr-x 1 root root 22 Jun 7 19:50 etc
but if the script is not already executble the bash should work as well:
[root#ap-p1m-ff ~]# docker exec -i 0c bash /tmp/test.sh -l
total 4
-rw-r--r-- 1 root root 159 Jun 4 18:32 RELEASE
drwxr-xr-x 2 root root 120 Jun 4 18:33 assets
drwxr-xr-x 1 root root 31 Jun 4 18:33 bin
drwxr-xr-x 2 root root 6 Apr 12 2016 boot
drwxr-xr-x 5 root root 340 Jun 7 19:50 dev
drwxr-xr-x 1 root root 22 Jun 7 19:50 etc
drwxr-xr-x 2 root root 6 Apr 12 2016 home
drwxr-xr-x 1 root root 45 Sep 13 2015 lib
drwxr-xr-x 2 root root 34 May 15 14:22 lib64
drwxr-xr-x 2 root root 6 May 15 14:22 media
Add your parameter as a separate argument rather than as part of the filename:
docker exec -i "$CLI_ID" bash "./script.sh" PARAM
This way, you don't have to add another level of escaping to the parameter.

Putting files to HDFS

I am running below commands on console:
[root#master ~]# pwd
/root
[root#master ~]# vi test.txt
#editting file
[root#master ~]# su - hdfs -c "hdfs dfs -put /root/test.txt /user/ambari-qa"
put: `/root/test.txt': No such file or directory
the file is there
[root#master ~]# pwd
/root
[root#master ~]# ls -l
total 9636984
-rw-r--r--. 1 root root 1823777034 Jun 12 08:34 ambari-2.6.2.2-centos6.tar.gz
-rw-------. 1 root root 716 Mar 19 2012 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Oct 15 11:30 Desktop
drwxr-xr-x. 2 root root 4096 Oct 15 11:30 Documents
drwxr-xr-x. 2 root root 4096 Oct 15 11:30 Downloads
-rw-r--r-- 1 root root 15 Oct 18 20:16 enabled~
-rw-r--r-- 1 root root 15 Oct 18 20:38 enablez~
-rw-r--r--. 1 root root 511720220 Oct 15 19:33 HDP-2.6.5.0-centos6-rpm.tar.gz
-rw-r--r--. 1 root root 7303095942 May 15 03:50 HDP-2.6.5.0-centos6-rpm.tar.gz.1
-rw-r--r--. 1 root root 43941068 Aug 13 20:28 HDP-UTILS-1.1.0.22-centos6.tar.gz
-rw-r--r--. 1 root root 185646832 Oct 15 17:04 jdk-8u181-linux-x64.tar.gz
drwxr-xr-x. 2 root root 4096 Oct 15 11:30 Music
drwxr-xr-x. 2 root root 4096 Oct 15 11:30 Pictures
-rw-r--r--. 1 root root 12148 Dec 16 2011 post-install
-rw-r--r--. 1 root root 552 Dec 16 2011 post-install.log
drwxr-xr-x. 2 root root 4096 Oct 15 11:30 Public
drwxr-xr-x. 2 root root 4096 Oct 15 11:30 Templates
-rw-r--r-- 1 root root 2 Oct 23 05:39 test
-rwxr-xr-x 1 root root 3 Oct 23 06:37 test.txt
However,I am getting no such file or directory, I am creating the file in the path but I get that error?
Seems the problem was due to privilege at /root directory
dr-xr-x---. 25 root root 4096 Oct 23 06:37 root
using chmod 755 worked then

Why do I need Root privilege to do `git branch -a`?

The git repository is under my username nikhil and group nikhil as follows:
$ ls -l
drwxr-xr-x 10 nikhil nikhil 4096 Sep 1 12:33 CS/
I can get git status as git status without root privilege.
But when I try to list branches:
$ git branch -a
nothing happens.
Also, with root priviledge:
$ sudo git branch -a
[sudo] password for nikhil:
* master
remotes/origin/feature
remotes/origin/master
it does lists all my repository.
Why is it so?
Edit: output of ls -lh .git
$ ls -lh .git
total 332K
drwxr-xr-x 2 nikhil nikhil 4.0K May 25 16:32 branches
-rw-r--r-- 1 nikhil nikhil 2 Sep 1 12:25 COMMIT_EDITMSG
-rw-r--r-- 1 nikhil nikhil 5.6K Sep 1 12:33 config
-rw-r--r-- 1 nikhil nikhil 73 May 25 16:32 description
-rw-r--r-- 1 nikhil nikhil 90 Sep 1 12:33 FETCH_HEAD
-rw-rw-r-- 1 nikhil nikhil 23 Sep 1 12:33 HEAD
drwxr-xr-x 2 nikhil nikhil 4.0K Jun 11 15:25 hooks
-rw-r--r-- 1 nikhil nikhil 229K Sep 1 12:34 index
-rw-r--r-- 1 nikhil nikhil 44K Jun 11 08:56 INDEX
drwxr-xr-x 2 nikhil nikhil 4.0K Jun 11 15:25 info
drwxr-xr-x 3 nikhil nikhil 4.0K Jun 11 15:28 logs
drwxr-xr-x 8 nikhil nikhil 4.0K Aug 11 18:01 modules
drwxr-xr-x 260 nikhil nikhil 4.0K Jun 27 15:29 objects
-rw-rw-r-- 1 nikhil nikhil 41 Sep 1 12:33 ORIG_HEAD
drwxr-xr-x 5 nikhil nikhil 4.0K Jun 11 15:25 refs
I identified the problem it was due to Anaconda in my .bashrc:
export PATH="$HOME/anaconda3/bin:$PATH"
if [ -f $HOME/anaconda3/etc/profile.d/conda.sh ]; then
source $HOME/anaconda3/etc/profile.d/conda.sh
fi
conda activate
What should I do? When I comment this out git branch -a works.
conda provides its own pager binary (not more or less, but pager). Using sudo clears your PATH -- so it fixes the problem not by virtue of changing permissions, but by virtue of preventing this faulty binary from being used at all.
To prevent this from having any undesired behaviors, move it out of the way:
mv ~/anaconda3/bin/pager{,.bad}

Restrict hadoop client to not to create hidden checksum files

CopyToLocal command is creating a hidden checksum file. Is there a way to avoid this being created?
Unless you're running a very old version, Apache Hadoop only creates the local checksum file if you opt in to creating it by passing the -crc option as showing in the Apache Hadoop documentation for the copyToLocal command.
> hdfs dfs -copyToLocal /LICENSE.txt
> ls -lrta
drwxr-xr-x+ 131 naurc001 SWNA\Domain Users 4.3K Jan 27 09:18 ../
-rw-r--r-- 1 naurc001 SWNA\Domain Users 140K Jan 27 10:11 LICENSE.txt
drwxr-xr-x 7 naurc001 SWNA\Domain Users 238B Jan 27 10:11 ./
> hdfs dfs -copyToLocal -crc /LICENSE.txt
> ls -lrta
drwxr-xr-x+ 131 naurc001 SWNA\Domain Users 4.3K Jan 27 09:18 ../
-rw-r--r-- 1 naurc001 SWNA\Domain Users 140K Jan 27 10:07 LICENSE.txt
-rw-r--r-- 1 naurc001 SWNA\Domain Users 1.1K Jan 27 10:07 .LICENSE.txt.crc
drwxr-xr-x 8 naurc001 SWNA\Domain Users 272B Jan 27 10:07 ./
If you have the option, then I recommend running a current version and testing to make sure the -crc option is not being passed anywhere.

Laravel 5.3 blank white screen no errors

I have gone through so many forums trying to find a solution to fix this error but non seems to be working.
Error in site-error.log
Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /path/site/vendor/laravel/framework/src/Illuminate/Foundatio‌​n/helpers.php on line 475
I have assigned
sudo chown -R www-data:www-data /path/directory
results for ls -al
drwxrwxrwx 12 www-data www-data 4096 Oct 25 10:06 .
drwxrwxrwx 6 www-data www-data 4096 Oct 25 06:46 ..
drwxr-xr-x 6 www-data www-data 4096 Oct 25 10:04 app
-rw-r--r-- 1 www-data www-data 1646 Oct 25 10:04 artisan
drwxr-xr-x 3 www-data www-data 4096 Oct 25 10:04 bootstrap
-rw-r--r-- 1 www-data www-data 1412 Oct 25 10:04 composer.json
-rw-r--r-- 1 www-data www-data 134388 Oct 25 10:04 composer.lock
-rw-r--r-- 1 www-data www-data 1723068 Oct 25 10:04 composer.phar
drwxr-xr-x 2 www-data www-data 4096 Oct 25 10:04 config
drwxr-xr-x 5 www-data www-data 4096 Oct 25 10:04 database
-rw-r--r-- 1 www-data www-data 615 Oct 25 09:46 .env
-rw-r--r-- 1 www-data www-data 491 Oct 25 10:04 .env.example
-rw-r--r-- 1 www-data www-data 61 Oct 25 10:04 .gitattributes
-rw-r--r-- 1 www-data www-data 96 Oct 25 10:04 .gitignore
-rw-r--r-- 1 www-data www-data 558 Oct 25 10:04 gulpfile.js
-rw-r--r-- 1 www-data www-data 135 Oct 25 07:17 .htaccess
-rw-r--r-- 1 www-data www-data 401057 Oct 25 10:04 _ide_helper.php
-rw-r--r-- 1 www-data www-data 401 Oct 25 10:04 package.json
-rw-r--r-- 1 www-data www-data 930 Oct 25 10:04 phpunit.xml
drwxr-xr-x 5 www-data www-data 4096 Oct 25 10:04 public
-rw-r--r-- 1 www-data www-data 749 Oct 25 10:04 readme.md
drwxr-xr-x 5 www-data www-data 4096 Oct 25 10:04 resources
drwxr-xr-x 2 www-data www-data 4096 Oct 25 10:04 routes
-rw-r--r-- 1 www-data www-data 563 Oct 25 10:04 server.php
drwxrwxrwx 5 www-data www-data 4096 Oct 25 10:04 storage
drwxr-xr-x 2 www-data www-data 4096 Oct 25 10:04 tests
drwxr-xr-x 34 www-data www-data 4096 Oct 25 10:06 vendor
I also applied
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
but am still getting the black white screen. where am i going wrong
For anyone else who might be facing the same issue, after upgrading to php7 you have to disable Apache2's PHP5 module and enable PHP7, like so:
a2dismod php5
a2enmod php7.0
sudo service apache2 restart

Resources