Fixed: PyCharm automatic update fails on Linux due to permissions

Users frequently post that they were unable to update Pycharm via the usual auto-update from within the program on Ubuntu or similar Linux systems.  They start the update process but they get a message showing many permission failures.

I have seen it suggested to simply download and install the full new PyCharm version as a solution, but this creates an unnecessary new program folder and requires export and import of your user settings, and your previous desktop entry (launcher) still points to the old version.

An incorrect solution is to change the program folder from root to user permission (don't do this).  The normal places to place PyCharm on your system are either /usr/local/bin or /opt/, and these are system folders that should keep their root permissions.  PyCharm runs fine (as your ordinary user account) without changing permissions on its folder.

Normally you do not want to run PyCharm as root, even though its folder and subfolders have root permissions.  This is because you want your PyCharm settings to be associated with your ordinary user account, not with the root account.

But there is one exception.  Run PyCharm as root in just the case where you are running it to do an automatic update to a new version.

sudo updatedb && sudo locate pycharm.sh
sudo /path/to/pycharm.sh
Don't do anything else during that session, just apply the update.  Then close PyCharm and reopen normally, and you should find you are running the new version with no need to download or mess with folder permissions.
6
4 comments

Awesome fix, thank you so much.

1
Avatar
Torbjörn Österdahl

I would actually expect a dialogue in this case saying 'hey you need to run the update with elevated privileges, please enter your credentials'. It should then start the update in a new process with the correct authorization. Ideally this process by design do not do anything more than absolutely needed for the update! Starting the IDE using root really feel awkward. It goes against everything we learn about security.

This thing makes me wonder how the update is implemented? It can't be that you need a full IDE with a all plugins for the update, no? So what is the problem exposing exatly this functionality to the user. If you don't want to implement that little UI which need to take care about operating system dependent stuff such as how to get the right authorization, then at least put the update functionality in a script for us to run on our own!

Thx.

1

This worked for me , Thanks for solution. 

0

Did NOT work.. the same error happens!

1

Please sign in to leave a comment.