sudo unknown group - Need help getting NextCloud setup with external HD - docker

I installed nextcloud on a raspberry via docker. I've had it running fine. Now I'm trying to get it to use an external USB HD. I mounted the HD to /media/exhd.
I'm following this tutorial, this command is giving me an error that I don't understand:
https://ownyourbits.com/2017/06/08/nextcloudpi-docker-for-raspberry-pi/
ExecStart=/usr/bin/dockerd -g /media/exhd -H fd://
sudo: unknown group: /media/exhd
sudo: unable to initialize policy plugin
Please help me understand the error. I don't understand what it's trying to do. The dockers man page only shows a '-G' option.
Thanks

Indeed an interesting problem. Even the dockerd reference does not include a -g option on top, but refers to it later on, what seems kind of weird to me.
But as long as you are not typing commands by hand, I would always recommend to use the long option's name, because if you come back later, you will most likely understand the long options much better as the short ones:
ExecStart=/usr/bin/dockerd --data-root /media/exhd --host fd://
You could also consider adding (or changing) the config file at /etc/docker/daemon.json - for me this is the best solution, because it can easily be backed up...
{
"data-root": "/media/exhd/data",
"exec-root": "/media/exhd/exec"
}
exec-root contains the execution state files, that you might also want to store on your hdd (--exec-root if using the cmd option), to keep everything together...

Related

How do I resolve this OSError: [Erno 48] Address already in use error while working with the byob botnet on GitHub?

(I have seen other solutions to "Errno 48" issues on StackOverflow, but none have been successful yet.)
I am trying to develop a botnet using byob on github here: https://github.com/malwaredllc/byob
I am encountering a address in use error every time I run the command sudo ./startup.sh. It returns OSError: [Errno 48] Address already in use.
However when I attempt to use the ps -fA | grep python and kill the associated 502 18126 16973 0 9:16PM ttys000 0:00.00 grep python by using kill -9 181216, I get this error: kill: kill 18126 failed: no such process.
Does anyone have any idea what to do?
I am using a "MacOS M1Pro Chip OS V12.0.1 Monterey". Also the program byob is trying to run on port 5000 of IPv4 127.0.0.1 (this is a generic IP not specifically mine). http://127.0.0.1/5000.
In case you try to duplicate the problem you need to install docker.io or the docker desktop app depending on os then navigate to cd <outer-dir>/byob-master/web-gui then execute sudo ./startup.sh. The code will not work without access to docker, and the program needs to be ran with admin perms using the prefix sudo. The actual downloads take a while and it will prompt you to restart once. Then when you run it again, I encounter this problem...
Please let me know if someone was able to fix this. Thanks!

Change default volume mount point for docker rootless?

I saw this post with different solutions for standard docker installation:
How to change the default location for "docker create volume" command?
At first glance I struggle to repeat the steps to change the default mount point for the rootless installation.
Should it be the same? What would be the procedure?
I just got it working. I had some issues because I had the service running while trying to change configurations. Key takeaways:
The config file is indeed stored in ~/.config/docker/. One must make a daemon.json file here in order to change preferences. We would like to change the data-root option (and storage-driver, in case the drive does not have capabilities
To start and stop the headless service one runs systemctl --user [start | stop] docker.
a. Running the systemwide service starts a parallel and separate instance of docker, which is not rootless.
b. When stopping make sure to stop the docker.socketfirst.
Sources are (see Useage section for rootless)
and (config file information)
We ended up with the indirect solution. We have identified the directory where the volumes are mounted by default and created a symbolic link which points to the place where we actually want to store the data. In our case it was enough. Something like that:
sudo ln -s /data /home/ubuntu/.local/share/docker/volumes"

docker ignores daemon.json file

I'm trying to add a mirror to my docker in order to use my server
to cache images from docker hub using the following syntax:
/etc/docker/daemon.json
{
"registry-mirrors": ["https://myserver.com"]
}
I have seen the above config even docker's official documentation.
but my ubuntu 20.04 does not read that file at all. Even if I restart the
docker service.
You should rewrite the configuration file as follow:
{
"registry-mirrors": ["myserver.com"]
}
Remove the protocol!
Intro
Added a directive to daemon.json which was just being ignored when I restarted Docker. Docker was restarting without error, it was just ignoring my change.
Problem
I was attempting to change the default log target to syslog from json-file by APPENDING the log-driver directive to the end of /etc/docker/daemon.json (I was scripting my Docker install and so was building this file incrementally).
But no matter WHAT I did, I could not get the change read. The output of docker info --format '{{.LoggingDriver}}' was always json-file.
Troubleshooting
Investigated the potential of a formatting error like the accepted answer, but this bore no fruit. Reading, re-reading of the Docker docs. Googling. Nothing could clear the error.
Solution
The Problem? Looks like Docker was really finicky about the ORDER the logging directive "log-driver" appeared. After wasting hours and beating my brains in, I changed the order the directive appeared in the file by PREPENDING it to the top of daemon.json like so:
{
"log-driver": "syslog",
"default-address-pools":
[
{"base":"192.168.X.X/24","size":28}
]
}
With the directive at the TOP, the change was recognized after restarting Docker and the output of docker info --format '{{.LoggingDriver}}' was now as expected: syslog. Go figure...
Conclusion
It was a silly problem, but wow did it waste some cycles figuring out how things were broken. Hope this get folks like myself out of a hole who couldn't find this solution Googling-

Need to remove symbolic link I created for /var/lib/docker/ but can't find it. Unable to use docker and feel helpless

I'm feeling really terrible atm so any help would be really appreciated. I kept running out of space when downloading docker images on /var, so I decided I needed to change the location for where docker was installing images. I tried several methods but had no success. First, I tried creating daemon.json in etc/docker and mapping data-root to a place with more storage (data2/docker). I stopped docker, moved everything over, made the file, but no dice. The docker daemon wouldn't start.
Then, I saw this method https://stackoverflow.com/a/49743270/13034460 which involves creating a symbolic link between /var/lib/docker and the new directory (data2/docker). I followed his instructions:
Much easier way to do so:
Stop docker service: sudo systemctl stop docker
Move existing docker directory to new location sudo mv /var/lib/docker/ /path/to/new/docker/
Create symbolic link
sudo ln -s /path/to/new/docker/ /var/lib/docker
Start docker service
sudo systemctl start docker
Well, this didn't work for me. I can't find the error message b/c it's too far up in my terminal, but it was along the lines of "you don't have enough storage/we don't know where to store this image". /data2/docker should have tons of storage so that can't be the issue.
But the big problem now is that this symbolic link exists and I can't figure out how to get rid of it. I tried removing everything related to docker on the computer, uninstalling, then reinstalling docker (which always used to work for me if there were any issues). But when I reinstall, it won't even run docker hello-world b/c of the link (I think). I get a message:
docker: open /data2/docker/tmp/GetImageBlob289478576: no such file or directory
So...it's looking in data2/docker because of the symbolic link (I assume), but that directory doesn't exist anymore. But neither does /var/lib/docker! All I want is to delete this link and get everything back to fresh defaults. I can worry about the storage issue another time. If I can't use docker at all, I'm so screwed. I've tried looking in every directory to find the link using -ls -l, but I can't find it. I used the exact code that the above references when I created the link (just my paths instead).
I would be so grateful to anyone who could help--I'm so lost on this. Thank you!

socat struggle to create serial ports

For testing purposes I want to use socat to create virtual serial ports to use in my Python program.
I have limited success, but struggle again and again with the many options in socat. I use this command in Ubuntu Linux:
sudo socat -d -d pty,b9600,raw,echo=0,link=/dev/ttyS90 pty,b9600,raw,echo=0,link=/dev/ttyS91
As it should, it creates the virtual ports like /dev/pts/2 and 4, and links them to /dev/ttyS90 and *91. It does not work without sudo (it fails with unable to unlink for the *90, *91 ports, although the regular user is in the dialout group).
But as you see the permissions 'lrwxrwxrwx' look like reading/writing for everybody. However, this is NOT true: I CANNOT use these devices unless I am root. The file manager (=Nemo) gives this result:
The permissions are significantly different. Huh?
After issuing 'sudo chmod 777 /dev/ttyS90' (and same for *91) nothing changes in the terminal output, because it is already, but incorrectly, showing 777 permissions, but the Nemo output changes to
And now I can use the ports as regular user! How comes? Am I doing something wrong?
And one more socat problem: the above socat command gives an 8-bit, no-parity connection, but I really need a 7-bit, even-parity connection. My attempts to implement this by juggling some of the many options all failed. I am lost; any insight?
Try changing the permission on /dev/pts/2 and /dev/pts/4 instead of on the link

Resources