M
M
mouLL2022-02-22 15:02:00
linux
mouLL, 2022-02-22 15:02:00

Do I need to run sudo apt update before installing programs?

Good afternoon! I just installed ubuntu in a virtual machine. I want to put some programs through apt.
I started with telegram, the instructions from the losst site said to first check if I have the required repository connected (connected), then run sudo apt update, then sudo apt install telegram-desktop.

Here's what I noticed:
1) If you install TG without sudo apt update, then everything is in order.
2) If you first execute sudo apt update, then the TG is not installed, it gives the error "Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend". The command ps aux | grep -i aptoutputs the following:

root        3049  0.0  0.0   2616   544 ?        Ss   14:53   0:00 /bin/sh /usr/lib/apt/apt.systemd.daily update
root        3056  0.0  0.0   2616  1852 ?        S    14:53   0:00 /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held update
root        3713  0.0  0.1  20560  4472 pts/0    T    14:54   0:00 sudo apt install telegram-desktop
root        3714  0.0  0.2  27336  8432 pts/0    T    14:54   0:00 apt install telegram-desktop
anastas+    4971  0.0  0.0   1084   296 pts/0    D+   14:58   0:00 grep --color=auto -i apt


In this regard, the questions:
1) Do I need to run sudo apt update before installing programs? Should this be done before installing each program?
2) sudo apt update itself does not update programs, but only writes packages available for updating? What to do next to update
3) What to do in this situation (when Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend occurs).

I really googled, but I understood little

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2022-02-22
@mouLL

1. No, not in front of everyone. It is enough to do this periodically (as far as I understand, apt systemd daily does this as well).
2. Yes, it only updates the database. sudo apt upgrade updates the installed programs themselves (according to the database, that is, after sudo apt update)
3. Wait. Disable or configure apt systemd daily. https://andreyex.ru/linux/chto-takoe-apt-systemd-daily/

A
AlexVWill, 2022-02-23
@AlexVWill

In addition to the previous answers, I will give advice: if you want a more intuitive and visually advanced version of the installer, I recommend installing Synaptic.
It just allows you to do the same thing as apt, but in a graphical environment.
sudo apt install synaptic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question