I wrote a program in Go and I am trying to add a launcher to the program in my taskbar. I can start the program without a problem from the terminal, regardless of if I am in the actual folder or in any other folder. If I instead try to start it using a Cinnamon launcher, the program does not start. I have tried Launch in terminal but that does not help.
There are no obvious clues in journalctl or xsession-errors. I am sure this is simple thing that I have still not understood about Linux, and I know that I have had this problem before, but I don’t see why. Any ideas?
When I click browse, it starts in my home folder, instead of in the /opt/softdark/bin folder. I don’t know if that matters, but I browsed the file, the correct path was entered, and when I clicked browse again I was back in the home folder. So it does not seem to recognize the folder, if that is what you meant…
Yes by default it starts to your home folder.
I tried a launcher linked to a /opt/… program, it’s not launching, and in the terminal, the same command asks for root privileges.
If you copy your program on your home or desktop, does the launcher work by any chance?
What actually did help in the end was to not just take ownership of the individual files, but also to take ownership of the entire folder. The last step I did not do last night when testing…that was my bad, because I kind of knew that was needed already…
I am still wondering though, how am I allowed to run anything in the bin folder (owned by root also), but not files that I put in the opt folder? There is something still, that I don’t understand about Linux permissions. In my mind, I should not need to set the owner of the folder and files to my account, since I can run any executable in the bin folder owned by root.
There are also other executables in the opt folder, like balenaEtcher, my VPN-program, GitKraken, BitWarden etc. How can I execute those programs, that are also owned by root?
Anyway, I think I am done with putting my own programs in the opt folder, and I will start putting them in my home folder instead. I am the only user on my machines anyway, so it doesn’t really matter.
Wild guess but the other programs you mentioned maybe set the opt/… as accessible by all users, not only root, as a feature during their install.
But yes, if you don’t need specifically to put your own programs there, use your home instead.
How do you set a folder as accessible by all users?
I will use my home folder in the future, but I still want to understand why I have to take ownership of both the folder and files to get it to work in opt, and why it works for other programs that are owned by root:root. It just feels like something I need to know…
Historically, 3d party programs should be installed there (even it’s not always respected nowadays, these rules are 30-40 years old as if it comes from UNIX).
You install a program with root privileges, it creates an /opt/program folder, with some subfolders. One of this subfolder with the executable will have rights for every users, or maybe only the executable. The other files/folders of this /opt/… will be kept their rights to root only.
TLDR, it’s a Linux/UNIX relic of how to make a program right.
For your own scripts/programs, keep it simple with a home subfolder.
Aah, ok, the reason I started to put programs in /opt is that I saw a YouTube video where someone said the he put all his programs in /opt. And since then I have done so, without even thinking about it more.
It makes a little bit more sense now, I brought this onto myself, since I took advice from some guy on YouTube on how to do things
I am going home now, to the home directory that is…