I cannot update repository

Hi, I'm using ubuntu mate 18.04 lts
When I try to update with the command:

sudo apt-get update

what come out is

How can I fix this problem?

The command is sudo apt-get update
(not apt-get update as a normal user, shown on the image)

Try sudo apt-get update or simpler, sudo apt update

1 Like

:sweat_smile:
thank you very much.
When I read your post I thought I wrote wrong on the request but in the end I wrote wrong command for a day, as I never use it before. Thank you for the help
and sorry for my stupidity

massi

On a further note, anything which requires modification of directories held outside of ~ requires root or sudoer permissions. As anything directly modifying files involving apt (or apt-get) requires modification of files outside your ownership, you need permission to modify such files, so becoming a superuser and doing as root does is required.

Even to execute anything new and foreign to the system such as a basic shell script or installation utility not using apt / dpkg, you need to use sudo with chmod to change permissions of the file so it can execute.

Ok, I’ll remember your suggestion.
thank you

Massi

I believe the correct sequence is something like this (always in this order):
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

And optionally, sometimes:
sudo apt autoremove
sudo apt clean

In case somebody wonders…

upgrade
   upgrade is used to install the newest versions of all packages
   currently installed on the system from the sources enumerated in
   /etc/apt/sources.list. Packages currently installed with new
   versions available are retrieved and upgraded; under no
   circumstances are currently installed packages removed, or packages
   not already installed retrieved and installed. New versions of
   currently installed packages that cannot be upgraded without
   changing the install status of another package will be left at
   their current version. An update must be performed first so that
   apt-get knows that new versions of packages are available.

dist-upgrade
   dist-upgrade in addition to performing the function of upgrade,
   also intelligently handles changing dependencies with new versions
   of packages; apt-get has a "smart" conflict resolution system, and
   it will attempt to upgrade the most important packages at the
   expense of less important ones if necessary. So, dist-upgrade
   command may remove some packages. The /etc/apt/sources.list file
   contains a list of locations from which to retrieve desired package
   files. See also apt_preferences(5) for a mechanism for overriding
   the general settings for individual packages.

But honestly just use update-manager and you’ll be fine. Unless you’re SSH’d into a headless Ubuntu server there is zero reason why anyone needs to run terminal commands when software-properties-gtk and update-manager handles everything just fine. Installation of Synaptic is also a good idea IMO.

1 Like

If you manage headless servers, the command line is the only way to manage your upgrades. If you also happen to run Linux as your desktop operating system of choice, there is no harm in using the same commands there as well. As command line tools go, apt is one of the easier ones to get comfortable with.

And you are absolutely right. For the majority of cases, the Mate desktop tools take care of it for you.

I regret not appending this onto my previous statement; for persons who need a specific version of a software in the same repository which isn't available for the current distribution, once a PPA is added I generally nano into whatever .list file at /etc/apt/sources.list.d which represents the repository information I want to append onto for the sake of neatness, which I believe is one thing that MATE tools don't do for the end-user in software-properties-gtk.

Just wanted to toss my two pence in about needing to use command line tools occasionally (though nano isn't strictly necessary with pluma unless you're headless), as I have to use an outdated version of pulseaudio-equalizer just because it works and on Xubuntu systems, an outdated version of thunar for split pane features since there hasn't been another later version I know of pre-patched with that, and I am too lazy to patch and make a new copy.

If you have to hold back packages, do it with apt-mark hold rather than using Synaptic's hold feature as for what it's worth, it kind of sucks.