cannot remove 'folder': Device or resource busy - docker

I create centos with docker and After I start the container, I would remove a directory where there are other two directories.
and I do :
rm -f -r ./folder
and I obtain:
cannot remove 'folder': Device or resource busy
Anyone can help me?

Another pretty much simple answer is following:
1. Close all your terminal windows (bash, shell, etc...)
2. Start a new terminal
3. Execute your command again e.g.:
rm -f -r ./folder
4. done
Hopefully it helps others!

if you use windows, it's com.docker.backend.exe , terminate it, everything will ok.
If you know the reason why backend cause this problem, tell me.

This happened to me, until I closed the code editor VS-Code. Somehow VS code had the folder open so it could not close until the editor was closed.

Maybe you have that folder opened up somewhere. Try lsof to find the opened folder and then sudo kill <pid>. Afterwards, I believe you can remove the folder from there.

1- ps aux | grep docker.
From there you can get all processes containing "docker" word
2- #kill <process_id>
3- #rm -rf <thedir>

Related

Why VI always starts in insert mode?

At some point, whenever I use vi from the command line (windows 10/WSL) it starts up in insert mode, meaning that everything I usually do to navigate ends up adding stuff to the file, wasting time having to clean it up.
I didn't have a vimrc file, and there doesn't seem to be anything in my bash rc files to modify vi behavior. Any ideas what I may have done or any ideas how to stop this behavior? I'm using Ubuntu-20.04
FWIW, adding a .vimrc file with tab related settings didn't change it's behavior. I looked at the /etc/vimrc file, and nothing inside it seemed relevant.
After plowing through google search and trying everything I understand about configuring 'vim' and doing comparison tests, I think:
This behavior is specific to Windows Terminal when opening a WSL terminal. Using WSL's "native" terminal (i.e., clicking the "Ubuntu 20.04 LTS" menu in the "Start" menu) doesn't have this problem.
My original motivation for switching to Windows Terminal is for its multi-tab feature. But this new behavior is crazy -- it works against years of my muscle memory of using "vi", and I'm almost certain that one day I'll accidentally update some configuration file while reading it in "vi". And, I cannot re-train a new muscle memory because all the rest of the UNIX world (e.g., when I SSH into a remote server) hasn't changed. This is like constantly switching between a Mac keyboard and a PC keyboard where the Ctrl key, etc., are in different places.
My solution: I switched to MobaXterm. It has multi-tab support, and is actually richer in features compared to Windows Terminal.
Please run the following:
alias | grep vim
sudo find / -name .vimrc 2>/dev/null
These commands should show you all the places to check, change the alias or fix the .vimrc files found.
Do you find it always going into edit mode, when you vim a file directly and when you use vim as the git commit editor for example?
EDIT:
You could also try which -a vim or whereis vim to see if you have multiple versions. Or failing that sudo find / -name vim 2>/dev/null
here is a better solution. I downloaded the binary.
https://github.com/lxhillwind/vim-bin/releases/tag/v9.0.0978
Put the vim command in /usr/bin/vi
Put the runtime in:
/usr/local/share/vim/runtim
sudo apt remove vim vim-common vim-runtime vim-tiny
sudo apt purge vim vim-common vim-doc vim-runtime vim-tiny
The second line actually gets rid of residual-defaults.
There is also a defaults.vim someplace on the system. I just nuked it.
I went through and made sure there were no aliases or vi or vim configuration files, but still no luck.
This is a horrible solution, but the only thing that is keeping my sanity right now.
vi -c ":imap jj "
You can alias it in your .bashrc. Looking into better solutions.

How to remove a snap application (docker) completely

I made the mistake of installing Docker via Snap... Once I realised that snap hadn't permissions to run in my working directory (on a different partition), I removed it. Now I can't use docker after I've installed it via apt-get.
Please help.
I've done sudo snap remove docker but when I sudo apt install docker and run via docker, I get bash: /snap/bin/docker: No such file or directory
The command you are looking for is:
sudo apt install docker.io
i.e it's docker.io not just docker
On Ubuntu, the package docker is described as a "System tray for KDE3/GNOME2 applications", which is probably not what you want!
I had the same problem. This works for me.
sudo snap remove docker
sudo reboot
the point is to restart the instance or terminal.
I hope this method can help
I did the same and just restarting the instance fixed it.
The problem is simply that your bash shell caches the locations of known executables, in order to avoid having to scan through your executables search path (that is, the directories listed in $PATH) every time you type a command. Because you have removed the executable from one directory (/snap/bin) and added it to another directory (/usr/bin), this cache is now out of date. This means that it will look in the wrong location if you try to invoke the executable simply by typing docker rather than its full path.
It is possible to fix it simply by starting a new bash shell, for example open a new terminal window and type the command in there.
Alternatively if you wish to refresh the cache in the terminal session that you are already using, type:
hash -r
It is not necessary to restart your computer (although this would also work).

/dev/ttyUSB1 cannot be changed in SLIP using Contiki OS with MICAz platform

I have a problem when using the SLIP in Contiki. The port only can be changed to /dev/ttyUSB1 in /contiki/tools directory with the command sudo ./tunslip6 -s /dev/ttyUSB1 aaaa::1/64 -v6
However, when I want to make a connection at /contiki/examples/ipv6/rpl-border-router directory, with the command make connect-router, it will then change back to /dev/ttyUSB0
May I know what is the problem?
Thank you.
The command make executes the recipes contained in the file Makefile. If you look within that (in your example folder) you will find the recipe calling tunslip:
connect-router-cooja: $(CONTIKI)/tools/tunslip6
sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 $(PREFIX)
you can change the command there and add -s /dev/ttyUSB1.

I am running tar xzvfredhawk-yum-1.8.4-el6-i686.tar.gz and the terminal freezes.

I am new to CentOS6 as well as Redhawksdr, and I am trying to run the tar xzvfredhawk-yum-1.8.4-el6-i686.tar.gz instruction on page 24, section 2.3 and my terminal freezes. Anyone know what is wrong and how to fix it?
Try checking to see if yum is being locked by something else (though an error should be produced if this were the case):
ps aux | grep yum
If something else is locking yum, try killing it.
Also, take a look at your repositories in /etc/yum.repos.d. Are there any IP addresses in there that might cause a timeout? Try pinging any IPs that are in there: if you can't ping, remove them from /etc/yum.repos.d (do this by saving the file off somewhere else).
If neither of those work, please post the exact syntax you are using. If yum is waiting on an input, it will freeze (e.g., if the answer to David Duncan's question is "no", that would be your problem).
user2062950: I am assuming user2643765 is referring to section 2.3 of the REDHAWK user manual.
Please try this:
go to the location where the tar file is present, then run the following command:
tar xzvf redhawk-yum-1.8.4-el6-i686.tar.gz -C target_location

Having trouble running "mate .rspec"

I'm trying to run mate .rspec in my command prompt in order to open the .rspec configuration file. However, I get the error -bash: mate: command not found. Any ideas?
Though Brandon's answer is correct, there's a far simpler way to set up the mate command through TextMate itself.
In the menu bar, select Help > Terminal Usage..., choose /usr/bin from the dropdown, and it will create the link for you.
You might have to open a new Terminal window for it to take effect, but then you should be all set.
[Update]
T.J.'s answer is much better than mine. :)
[Original Answer]
TextMate installs the mate command to /usr/local/bin/mate. First, I would check to see if the mate command is in that directory:
ls -lah /usr/local/bin/mate
If you get ls: /usr/local/bin/mate: No such file or directory, then you can install the mate command by creating a symbolic link to the binary, which lives in the TextMate.app folder:
sudo ln -s /Applications/TextMate.app/Contents/Resources/mate /usr/local/bin/mate
At this point, you should be able to run mate from the command line.
If you got output other than No such file or directory from the ls command, it means that /usr/local/bin is not on your path.

Resources