Accidentally deleted /opt, how do I create it again?
Solution 1
On a newly installed Ubuntu system, /opt
exists but is empty. You can just run:
sudo mkdir /opt
And that will recreate it, with the correct permissions.
But if there was software installed inside when it was removed, that won't bring it back.
There probably wasn't, though. You'd likely have remembered installing it there. /opt
is not usually for programs installed automatically through Ubuntu's package manager. Instead, for the most part it's used for programs that install with their own methods, often (but not only) proprietary payware installed from CD.
If you remember how you deleted /opt
, a more specific prediction as to whether or not there was anything in it could be given. For example, if the way you remove it was to run sudo rmdir /opt
, that will only work if the directory is empty. On the other hand, if you used rm -r
, it needn't have been empty.
Solution 2
First of all, check what files may have been deleted with dpkg -S /opt
or grep ^/opt /var/lib/dpkg/info/*.list
. It should give you a list of packages that might need to be reinstalled. If none is, then just recreate the directory with a simple sudo mkdir /opt
. You may also check if you have installed packages manually in those directories, but that's very tricky.
Related videos on Youtube
Alexandra Macedo Lopes
Updated on September 18, 2022Comments
-
Alexandra Macedo Lopes over 1 year
I have my form 1 and when I click in a button it opens my form 2. I want to introduce some information in this second form in order to uptade the first form. I tried this:
Public class Form2 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click ... {some code here} Form1.Refresh() Me.Close() End Sub End Class
But this isn't refreshing my form1. I know I can close the first form and open it again, but i don't pretend that. Is there any other way to do this?
-
Rinzwind over 9 years
drwxr-xr-x 5 root root 4096 sep 28 07:28 opt
;) -
jmcilhinney over 5 yearsWhat exactly do you think that
Refresh
method does? It's not going to magically know to get data from a database or from a file or whatever else. Perhaps you should explain whatForm2
actually does and what exactly you expect to happen inForm1
. My guess is that you have data in a grid inForm1
and you making changes to the database inForm2
and expectingForm1
to reflect those changes. I say that because it's common that beginners do that when it's completely wrong. In that case, you should be making the changes inForm1
first, then saving them to the database from there. -
Alexandra Macedo Lopes over 5 years@jmcilhinney hello. Yap but I pretend that. I want to "run" the code of first form after making somes changes in the second form.
-
Alexandra Macedo Lopes over 5 years@jmcilhinney yes but how can I execute it from another form?
-
jmcilhinney over 5 yearsHow do you usually execute code in an object? You call a method.. It has to be a method that actually contains the code you want executed though. Refresh doesn't contain such code so it won't magically execute such code.
-
-
jazz_razor over 9 yearsthnx. its works ..
-
Rmano over 9 years+1 --- The only well-known and quite popular software I know that install itself on
/opt
is calibre (barring a couple of microcontroller-developing things that I do not think matter here). -
William Brendel over 9 yearsGoogle Chrome also installs itself under /opt/
-
Rinzwind over 9 years@Rmano there are more: teamviewer, jasperserver.
-
jmcilhinney over 5 yearsAn answer MUST contain a solution to the question as asked. If you want to clarify the question then add a comment to the question.
-
Alexandra Macedo Lopes over 5 years@andreas charidemou hello. Yes, some data is being saved. Then, I want to refresh first form so it can check the new information in database.
-
andreas charidemou over 5 yearsDo you call again the method which is responsible for fetching the data from the database? The refresh method / event handler is different that the Form Load method. You need to call again the method / code responsible for fetching the data from the database.
-
andreas charidemou over 5 years@jmcilhinney I don't have yet privilege to add a comment unless I add an answer. I don't know if this is a bug but I tried to add a comment in the first place and did not allowed it to me.
-
video.baba over 5 yearsThis should be a comment, not an answer.
-
jmcilhinney over 5 yearsAn answer MUST contain an answer. If you can't post a comment then don't post anything.
-
jmcilhinney over 5 yearsIf you want to execute some code then you need to execute that code. Calling
Refresh
is not going to do that and you should not simply assume that it will. -
andreas charidemou over 5 yearsJust wanted to help
-
jmcilhinney over 5 yearsHelping is good, but don't break the rules of the site to do so.
-
andreas charidemou over 5 yearsOk my friend. Sorry