Orphaned subvolumes, owned by nobody, can't do anything with them - docker

I'm running Debian Buster inside of Crostini on a Pixelbook, and am using Docker. I'd backed-up my Linux container, performed a power wash on the Chromebook, then restored the Linux container.
That's when I started getting permission-denied issues when building containers, during the mkdir calls in my Dockerfile.
So I did the typical troubleshooting:
uninstall/reinstall docker
uninstall docker and run rm -rf /var/lib/docker
kill all processes that might be using those subvolmes
check mount for active mounts
check /etc/fstab (which is empty?) for mounts
check /etc/mtab (is this new?) for mounts
reinstall docker and run docker system prune (which also didn't touch those directories)
even tried running btrfs subvolume delete XXXXXX
...all of which squawk at me due to a lack of permissions... this is even when I sudo su root to run the comands.
I'm a complete newbie to both Docker and definitely to BTRFS... so I'm completely stumped now.
I'm able to build containers again... since it's building them into NEW subvolumes now... but now it's personal... I want the following subvolumes gone!
Here they are (all inside of /var/lib/docker/btrfs/subvolumes):
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 f96f6fbdbfd84db115c253880a0e8919b63d758d4a3f9e2645bcf959657f6c45-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 f547c01038e1479c65383ee4baba4f9212c2ca42ab9536931b1df9d8149d004f-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 efff78d70c412ad613d88e58ae0a84c058d1ccce63a588f2da8612cda2099ecc
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 e1b8aacd80a48e400052fb921cc52567a75ae210aa005519671bbf3cc1e7d3e5-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 c928040adbd4fe7ec8e71643d66c7a036436fcf52318573038153bf2d73e000e-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 bc0a723bece1df18eaf4fbc2deb108909546e2088ed4cff5c29d473881061bde
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 b52f2bf1a1404a773f6ed7bdfe1cfabb1c241e74ce846da65afbdce18b021502-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 aacc82c84f1aee572a20325d5ea3ff6ccd0604dfeecf34efc6af952d62926012-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 a5a6cd588f4995f5e8517d31bce652235bfc920ba694cc681eb5dfe4e1c24192-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 9cc9807d3c3d036f38086f52ceb2d9ebc87a14a4e3f0ba41bb4e1d89f965bf99-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 9aef1d128a4608916c01c44accc883a6069a4b8131e35568337fc5b5b4c4998e
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 8de3efc8c709f46a46362e60fcc4d948cbe543f4f1a1615ccfb21d83decb7e3e
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 815d91c859262e5e556191a03438761d97bd21556cdd3b4d75d2fbdfcbb4082c-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 7c27d56096add6bb0352dc4d8d8d9c0613d79fdf370bed04c2dfe90e90215569-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 72fb7e0f7732f59c45b7872140dc64d59aaa1e719266d3e299398d7a8040f57c
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 6e284d02177f0a6fa6aea122086a3934c0e6b8498d862df718f333bf50fd77db
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 617f090a6c681e1345fb32af0aa76d410c7e3b5353bceda11c266efaafaca09e
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 5312ab94752a8ad47a222e98c7633c0d3ca650242505ab7530f531782bffd6b1
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 4ffd4a084cac545b680fd879a891f20db814bc4b74901e26fbe1676b5a29ade1
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 4658094e3d4aeadec4e1d70023c8b20970c98543a569c5c0e3edc4caee4277c5
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 46438c1226b4684f69512bc2829e32a4e2420ae2cb1e8ab516c3439f2988bcdc-init
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 1a618f110ebebf2423780b6ee030b1e357ce9f426f877f55a1606caa0bbc107e
drwx--x--x 1 nobody nogroup 78 Jul 26 13:25 02ba91d136afc3790be35ae35c5ad022b68377edc3963cf757e4e0b6da0d3414

I was just having a similar problem, but this method solved it. What do you think?
$ btrfs subvolume delete /var/lib/docker/btrfs/subvolumes/*
$ apt remove docker-ce
$ rm -rf /var/lib/docker/
$ apt install docker-ce

Same here. And my workaround is...
# systemctl stop docker
# mv /var/lib/docker/btrfs/subvolumes /var/lib/docker/btrfs/delme
# systemctl start docker
Files are still alive. But your Docker will work again.

apt install thunar
then refer to the
/var/lib/
and open terminal there then
write
sudo thunar
and delete docker folder
and then reinstall docker from scratch it did work to me with manjaro

Related

how to run a dbt container from command line with volumes

was trying to make a quick dbt container:
docker pull xemuliam/dbt
docker run -d --name dbt \
-p 8085:8085 \
-v /home/mypath/app:/usr/app \
xemuliam/dbt:latest
that didn't work, so i tried to inspect and saw the binding was rprivate, so i changed it to:
docker run -d --name dbt \
-p 8085:8085 \
-v /home/mypath/app:/usr/app,rshared:rshared \
xemuliam/dbt:latest
the issue is that /home/mypath/app ends up being empty, and if i go inside the container it has in the working directory of /usr/app:
drwxr-xr-x 15 root root 4096 Apr 29 12:24 .
drwxr-xr-x 1 root root 4096 Jun 21 20:14 ..
-rw-rw-r-- 1 root root 4895 Apr 28 16:54 ARCHITECTURE.md
-rwxrwxr-x 1 root root 16732 Apr 28 16:54 CHANGELOG.md
-rw-rw-r-- 1 root root 18081 Apr 28 16:54 CONTRIBUTING.md
-rw-rw-r-- 1 root root 2239 Apr 28 16:54 Dockerfile.test
-rw-rw-r-- 1 root root 11344 Apr 28 16:54 License.md
-rw-rw-r-- 1 root root 3271 Apr 28 16:54 Makefile
-rw-rw-r-- 1 root root 2365 Apr 28 16:54 README.md
drwxrwxr-x 5 root root 4096 Apr 28 16:54 core
drwxrwxr-x 4 root root 4096 Apr 29 12:23 dbt-core-1.1.0
-rw-rw-r-- 1 root root 205 Apr 28 16:54 dev-requirements.txt
drwxrwxr-x 2 root root 4096 Apr 28 16:54 docker
-rw-rw-r-- 1 root root 777 Apr 28 16:54 docker-compose.yml
drwxrwxr-x 3 root root 4096 Apr 28 16:54 docs
-rw-rw-r-- 1 root root 51 Apr 28 16:54 editable-requirements.txt
drwxrwxr-x 2 root root 4096 Apr 28 16:54 etc
drwxrwxr-x 3 root root 4096 Apr 28 16:54 events
-rw-rw-r-- 1 root root 65 Apr 28 16:54 mypy.ini
drwxrwxr-x 8 root root 4096 Apr 28 16:54 performance
drwxrwxr-x 6 root root 4096 Apr 28 16:54 plugins
-rw-r--r-- 1 root root 95 Apr 29 12:23 plugins.txt
-rw-rw-r-- 1 root root 242 Apr 28 16:54 pytest.ini
-rw-rw-r-- 1 root root 26 Apr 28 16:54 requirements.txt
drwxrwxr-x 2 root root 4096 Apr 28 16:54 scripts
drwxrwxr-x 5 root root 4096 Apr 28 16:54 test
drwxrwxr-x 7 root root 4096 Apr 28 16:54 tests
drwxrwxr-x 10 root root 4096 Apr 28 16:54 third-party-stubs
-rw-rw-r-- 1 root root 798 Apr 28 16:54 tox.ini
drwxr-xr-x 2 root root 4096 Apr 29 12:24 wheels
in my postgres db i am able to do a volume like this and it works:
-v /home/mypath/data:/var/lib/postgresql/data
i would like to access that stuff on the host so i can play around with editing it.
this is probably the worst way to get this done, so i would appreciate a better answer - but my solution:
step 1: pull image
$ podman pull xemuliam/dbt
step 2: create a container through cli instead of dockerfile
$ podman run -d --name db_dbt \
-p 8085:8085 \
-v /home/myusr/dbt_test/_official:/home/dbt_test/_official \
xemuliam/dbt:latest
step 3: copy files from /usr/app to /home/dbt_test/_official
$ cp -R /usr/app/* /home/dbt_test/_official
exit
$ podman stop db_dbt && podman rm db_dbt
step 4: copy files on the host
$ mkdir /home/myusr/dbt_test/app1
$ cp -R /home/myusr/dbt_test/_official/* /home/myusr/dbt_test/app1/
step 5: create a new volume
$ podman run -d --name db_dbt \
-p 8085:8085 \
-v /home/myusr/dbt_test/app1/:/usr/app/ \
xemuliam/dbt:latest
i really dont like this roundabout way, but now i am able to edit from the host and see what the container does.

execution of chown(container files) get hung

I'm trying to run Zalenium docker on ubuntu 18.04. Below is my command.
curl -sSL https://raw.githubusercontent.com/dosel/t/i/p | bash -s start
or
docker run --rm -ti -p 4404:4444 -v /var/run/docker.sock:/var/run/docker.sock -v /home/emiteqa/eMite/videos:/home/seluser/videos --privileged dosel/zalenium start
I got stuck at "Copying files for Dashboard"
Docker binary already present, will use that one.
Docker version 18.09.0, build 4d60db4
-- LOG 07:33:35:233537096 Ensuring docker works...
-- LOG 07:33:35:414698248 Ensuring docker-selenium is available...
haveged: haveged starting up
Copying files for Dashboard...
After investigate, I find the cause is the zalenium get hung at below line in zalenium.sh
sudo chown -R ${HOST_UID}:${HOST_GID} /home/seluser
Then, I go into the zalenium container. I try to run sudo chown on any file in the container, it get stuck.
seluser#5ada56c01231:~$ ls -ltr
total 40396
-rwxrwxr-x 1 seluser root 41277 Nov 24 15:23 zalenium.sh
-rwxrw-r-- 1 seluser root 15086 Nov 24 15:23 zalando.ico
-rwxrwxr-x 1 seluser root 770 Nov 24 15:23 wait-testingbot.sh
-rwxrwxr-x 1 seluser root 983 Nov 24 15:23 wait-saucelabs.sh
-rwxrwxr-x 1 seluser root 933 Nov 24 15:23 wait-lambdatest.sh
-rwxrwxr-x 1 seluser root 746 Nov 24 15:23 wait-cbt.sh
-rwxrwxr-x 1 seluser root 831 Nov 24 15:23 wait-browserstack.sh
-rwxrwxr-x 1 seluser root 1268 Nov 24 15:23 start-testingbot.sh
-rwxrwxr-x 1 seluser root 2679 Nov 24 15:23 start-saucelabs.sh
-rwxrwxr-x 1 seluser root 1061 Nov 24 15:23 start-lambdatest.sh
-rwxrwxr-x 1 seluser root 1078 Nov 24 15:23 start-cbt.sh
-rwxrwxr-x 1 seluser root 1287 Nov 24 15:23 start-browserstack.sh
-rwxrw-r-- 1 seluser root 2699 Nov 24 15:23 logging_info.properties
-rwxrw-r-- 1 seluser root 2738 Nov 24 15:23 logging_debug.properties
-rwxrw-r-- 1 seluser root 1082 Nov 24 15:23 logback.xml
-rwxrw-r-- 1 seluser root 2128 Nov 24 15:23 LICENSE.md
-rwxrw-r-- 1 seluser root 637 Nov 24 15:23 error.html.bak
-rwxrw-r-- 1 seluser root 10996 Nov 24 15:23 dashboard_template.html
-rwxrw-r-- 1 seluser root 4529 Nov 24 15:23 Analytics.md
-rw-rw-r-- 1 root root 41184199 Nov 24 15:23 zalenium-3.141.59v.jar
drwxrwxr-x 1 seluser root 4096 Nov 24 15:27 css
drwxrwxr-x 1 seluser root 4096 Nov 24 15:27 js
drwxrwxr-x 1 seluser root 4096 Nov 24 15:27 img
drwxrwxr-x 5 seluser seluser 4096 Dec 5 01:56 videos
-rwxrw-r-- 1 seluser seluser 3420 Dec 6 07:00 nginx.conf.bak
-rwxrw-r-- 1 seluser seluser 3404 Dec 6 07:00 nginx.conf
-rwxrw-r-- 1 seluser seluser 627 Dec 6 07:00 error.html
drwxr-xr-x 2 seluser seluser 4096 Dec 6 07:00 logs
-rw-r--r-- 1 seluser seluser 1181 Dec 6 07:00 docker_info.txt
seluser#5ada56c01231:~$ pwd
/home/seluser
seluser#5ada56c01231:~$ sudo chown seluser:seluser wait-testingbot.sh
^C^C
seluser#5ada56c01231:~$ ^C
seluser#5ada56c01231:~$ sudo chown seluser:seluser wait-testingbot.sh
seluser#5ada56c01231:~$ sudo chown seluser:seluser wait-saucelabs.sh
^C^C
seluser#5ada56c01231:~$ sudo chown seluser:seluser wait-saucelabs.sh
seluser#5ada56c01231:~$
What I have tried
If I touch a new file and run sudo chown, there is no problem.
If I CTRL+C and retry, it will pass.
By using exact same steps starting from docker installation, I can run zalenium successfully on aws
server.
I googled, but didn't find any similar issue. I know it's possibly due to env issue, but I have no clue how to troubleshoot.
Thanks in advance for any suggestion and help.

docker cp - "Error response from daemon: not a directory"

I am trying to copy file from docker to host using the below command,
docker cp <container_name>:<file FQN> ./
But getting the below error,
Error response from daemon: not a directory
As verified, the file name and container name are valid.
Note: Using Docker in Mac
Thanks for all the answers. After a bit of struggle found out that the error message was not actually directly related to the docker cp command.
The scenario was, I ran the docker with the link to a local file. When the docker was running I deleted it. Then the file got created as a folder somehow (Probably, when I restarted the docker).
And whenever I am executing some command, the docker was giving me that error. Then once I created the file the error disappeared.
It seems your command is correct. You please try like the below from your local machine not from inside the container. sometimes unfortunately if we run this command with in the container we will get this kind of errors.
docker cp [container_name]:[docker dir abs path] [host dir path]
Hope it will help you.
Here is a full example on how to copy a file:
$ docker run -it ubuntu /bin/bash
root#9fc8a1af7f23:/#
root#9fc8a1af7f23:/# ll
total 72
drwxr-xr-x 34 root root 4096 Jul 13 21:51 ./
drwxr-xr-x 34 root root 4096 Jul 13 21:51 ../
-rwxr-xr-x 1 root root 0 Jul 13 21:51 .dockerenv*
drwxr-xr-x 2 root root 4096 Feb 14 23:29 bin/
drwxr-xr-x 2 root root 4096 Apr 12 2016 boot/
drwxr-xr-x 5 root root 360 Jul 13 21:51 dev/
drwxr-xr-x 45 root root 4096 Jul 13 21:51 etc/
drwxr-xr-x 2 root root 4096 Apr 12 2016 home/
drwxr-xr-x 8 root root 4096 Sep 13 2015 lib/
drwxr-xr-x 2 root root 4096 Feb 14 23:29 lib64/
drwxr-xr-x 2 root root 4096 Feb 14 23:28 media/
drwxr-xr-x 2 root root 4096 Feb 14 23:28 mnt/
drwxr-xr-x 2 root root 4096 Feb 14 23:28 opt/
dr-xr-xr-x 288 root root 0 Jul 13 21:51 proc/
drwx------ 2 root root 4096 Feb 14 23:29 root/
drwxr-xr-x 6 root root 4096 Feb 27 19:41 run/
drwxr-xr-x 2 root root 4096 Feb 27 19:41 sbin/
drwxr-xr-x 2 root root 4096 Feb 14 23:28 srv/
dr-xr-xr-x 13 root root 0 Jul 13 21:51 sys/
drwxrwxrwt 2 root root 4096 Feb 14 23:29 tmp/
drwxr-xr-x 11 root root 4096 Feb 27 19:41 usr/
drwxr-xr-x 13 root root 4096 Feb 27 19:41 var/
root#9fc8a1af7f23:/# cd tmp/
root#9fc8a1af7f23:/tmp# ls
root#9fc8a1af7f23:/tmp# echo "hello docker" > docker_test.txt
root#9fc8a1af7f23:/tmp# cat docker_test.txt
hello docker
root#9fc8a1af7f23:/tmp#
Then, in another terminal
dali#dali-X550JK:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9fc8a1af7f23 ubuntu "/bin/bash" 2 minutes ago Up 2 minutes fervent_hodgkin
dali#dali-X550JK:~$ docker cp fervent_hodgkin:/tmp/docker_test.txt /tmp/
dali#dali-X550JK:~$ cat /tmp/docker_test.txt
hello docker
dali#dali-X550JK:~$
Please follow these instruction, make sure your don't have typo in the file paths, otherwise share a reproducible error.
This error also appears when trying to copy a file that is actually a volume in the container, but the file has been deleted on the host.
This is simply an error in the path you want to copy.
You may not believe it, but that it is.

Install Neo4j 2.1 on redhat 6.x

I downloaded and unzipped the package on redhat.
ls
bin conf lib LICENSE.txt plugins system
CHANGES.txt data LICENSES.txt NOTICE.txt README.txt UPGRADE.txt
bin ls -lt
drwxr-xr-x. 2 root root 4096 Jan 25 00:04 lib
-rwxr-xr-x. 1 root root 10521 Jul 24 2014 neo4j
-rwxr-xr-x. 1 root root 4404 Jul 24 2014 neo4j-installer
-rwxr-xr-x. 1 root root 3443 Jul 24 2014 neo4j-shell
-rwxr-xr-x. 1 root root 478 Jul 24 2014 org.neo4j.server.plist
-rw-r--r--. 1 root root 138 Jul 24 2014 README.txt
-rwxr-xr-x. 1 root root 10263 Jul 24 2014 utils
bin ./neo4j-installer install
WARNING: this installer is deprecated and may not be the optimal way to install Neo4j on your system.
Please see the Neo4j Manual for up to date information on installing Neo4j.
Any suggestions?
Instead of using the install script you can simply start the Neo4j server by running path/to/neo4j/bin/neo4j start.
There is also an experimental YUM package here

jenkins doesn't have rights to copy files - or does it?

I have a strange problem in jenkins, I cannot copy files in a job, however, with the user jenkins on the command line, I can do that without problem.
I am using jenkins on debian running under the user "jenkins".
I added the user "jenkins" to the group "www-data", so that I can copy files to the www-folder of apache.
The folder rights of the target folder look like this:
drwxrwxr-x 9 www-data www-data 4096 Jun 23 16:19 .
drwxrwxr-x 4 www-data www-data 4096 Jun 23 12:45 ..
-rw-rw-r-- 1 volker www-data 368 Jun 23 17:10 about.php
-rw-rw-r-- 1 volker www-data 366 Jun 23 17:10 bio.php
-rw-rw-r-- 1 volker www-data 370 Jun 23 17:10 contact.php
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 content
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 css
drwxrwxr-x 8 volker www-data 4096 Jun 23 16:19 default
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 fonts
drwxrwxr-x 2 volker www-data 4096 Jun 23 13:40 image
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 images
-rw-rw-r-- 1 volker www-data 372 Jun 23 17:10 impressum.php
-rw-rw-r-- 1 volker www-data 367 Jun 23 17:10 index.php
-rw-rw-r-- 1 volker www-data 296 Jun 23 13:52 kontakt.php
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 layout
-rw-rw-r-- 1 volker www-data 367 Jun 23 17:10 news.php
-rw-rw-r-- 1 volker www-data 370 Jun 23 17:10 termine.php
-rw-rw-r-- 1 volker www-data 369 Jun 23 17:10 videos.php
So everything is writable for group www-data.
If I am using the jenkins user to copy the files in the shell, I get no error:
jenkins#rootserver:~/jobs/deploy_notundellende/workspace$ whoami
jenkins
jenkins#rootserver:~/jobs/deploy_notundellende/workspace$ cp -R * /var/www/nue
jenkins#rootserver:~/jobs/deploy_notundellende/workspace$
But if I use the same command in jenkins itself, it fails with permission error:
pwd
/var/lib/jenkins/jobs/deploy_notundellende/workspace
whoami
jenkins
cp -R about.php bio.php contact.php content css fonts images impressum.php index.php layout news.php termine.php videos.php /var/www/nue
cp: cannot create regular file `/var/www/nue/about.php': Permission denied
cp: cannot create regular file `/var/www/nue/bio.php': Permission denied
cp: cannot create regular file `/var/www/nue/contact.php': Permission denied
cp: cannot create regular file `/var/www/nue/content/videos.php': Permission denied
How is that possible? Does anyone have an idea?
OK, I got it to work, I restarted the jenkins server and it worked. I assume it did not work before, because the jenkins server was already running when I changed its permissions. Makes sense to me now, come to think of it :) Anyway, thanks for anybody reading and thinking about this!
Solution 1: Restart Jenkins
(jenkins_url)/safeRestart - Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.
(jenkins_url)/restart - Forces a restart without waiting for builds to complete.
Solution 2: Check the user and permission for the same user
Check user: whoami
change permission: sudo chmod -R 777 /var/www/html/* or sudo chmod a+rwx /var/szDirectoryName
Solution 3:
If you get error/warning like Linux: 'Username' is not in the sudoers file. This incident will be reported ref the link

Resources