I've made a deb package which contains binaries of my software. Also I've made a repo and configured it so user can install updates using sudo apt-get update mypackage && sudo apt-get install mypackage. After installation binaries of my application will be extracted to /opt/mypackage and .desktop file will be extracted to /usr/share/applications so user can launch the application without issues.

What I want to know is how can I install updates of my application from code when they are available in the user system as it's done in other applications? I'm asking because it requires root password when running apt-get install or sudo gdebi mypackage.

At the moment when I want to push new updates - I build new .deb package and put it to the repository. Should I do it in the other way? Or maybe I was wrong when decided to put binaries in /opt directory?

Any help will be appreciated. If you know some open-source projects where this part of the functionality is implemented could you please share it? Also, I can create a simple repository which reproduces what I tried to explain here.

  • "how can I install updates of my application from code... as it's done in other applications" ... which other applications?
    – muru
    Jun 20, 2020 at 3:17
  • 1
    @muru for example VS Code. When a new version is available - it shows a popup where I can click on the Update button - updates will be installed. The same for Github Desktop, Firefox, Google Chrome, and many other applications Jun 20, 2020 at 3:21
  • It'd be cool to see the answer. Not because I'm trying to do the same thing, but because browser update attempts always fail for me on apt-based distros and I'd like to see how they're supposed to work. Jun 20, 2020 at 3:27
  • I don't use VSCode or GitHub Desktop, but at least when installed via deb packages, Firefox and Chrome don't update themselves.
    – muru
    Jun 20, 2020 at 4:07
  • @muru, I've downloaded older version of firefox using this command wget sourceforge.net/projects/ubuntuzilla/files/mozilla/apt/pool/main/f/firefox-mozilla-build/firefox-mozilla-build_39.0.3-0ubuntu1_amd64.deb then installed it with sudo dpkg -i firefox-mozilla-build_39.0.3-0ubuntu1_amd64.deb. After first launch it coudn't install update because of permissions. Then I restarted it with sudo firefox - openned Home->About tab. Then application downloaded updates and installed it Jun 20, 2020 at 4:40

1 Answer 1


Providing software as a package (of the .deb or RPM variety) and allowing software to update itself on its own are mutually exclusive. As you noticed, installing or upgrading packaged software can only be done by the administrator, and it’s expected that the system will be kept updated by its administrator. On many systems this is made easier by tools such as GNOME Software which will tell the user about pending updates and take care of applying them without manually running apt update etc.

“Other” programs you mention, which can update themselves, can only do so if the user they’re running as can write to the locations they’re installed in. This is often the case with manually-installed binaries, but many larger programs have moved away from this in recent years — Google Chrome, and VS Code, now install from package repositories and behave as expected.

You worked around the limitations in Firefox’s case but that’s a bad idea. Running software as root when it doesn’t need to be root isn’t recommended, and letting a packaged piece of software update itself means the packaging system is no longer aware of what’s installed.

Another point is that most distribution-packaged software explicitly disables update checks — for one thing, they’re useless because they can’t be acted upon directly, and for another, disabling update checks means the software doesn’t need to “phone home”, which many users care about.

  • Yes, I know that it wasn't a great idea to launch Firefox as sudo but I could modify permissions on the directory where it's installed. As I can see there are two options for me - change permissions on installation directories so that application will be able to modify it or distribute the application via snap. Am I correct at this point? Jun 20, 2020 at 7:23
  • The first isn’t an option, letting a packaged application modify itself behind the package manager’s back is asking for trouble. So I guess that leaves snaps or flatpaks, yes. Jun 20, 2020 at 8:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .