P a c k a g e M a n a g e m e n t f o r L i n u x
-
When a user installs a Linux distribution - for example (K)Ubuntu -, he does not only get the "naked" Linux Core, but also a bunch of applications that maintainers decided being part of their distribution at a given time, like office applications, or text editors, writers, table calculations. However, there are a lot more applications out there, that a user may need to work with, but are not part of the canonical set. This is where Package Mgt comes into play.
In the "classical" Linux approach, teams maintaining distributions created intermediary platforms to fulfill following expectancies:
- The distribution maintainers collect tools and programs from developers. They check their conformity with guide lines and, if the results are satisfactory, they store them as "packages" in so called repositories of which URL are locally stored in well defined files.
- A big issue is dependencies of a given package, e.g. basic libraries (versions) required to run a program. The associated consistency check is not a trivial task, when thousands of packages are available. The repository maintainers can address this issue much better than single users.
Debian Packaging
Debian Packaging is still the most prominent Package Management System, defining a complete infrastructure - URL, databases, archives - on which common basis, different tools can automatically perform the tasks of finding, downloading, installing (and removing) additional programs at the user's request.- In Ubuntu systems, the data about available repositories, packages and status (whether installed, marked for installation, removal, update etc.) are stored in directory /etc/apt. Especially, file /etc/apt/sources.list lists addresses of canonical repositories.
The users dispose of a number of tools able to activate those resources: command line tools, as well as graphical interfaces.
-
Command line tools:
Some command line tools are reviewed in more details below: dpkg, apt-get, apt-cache, apt.
-
GUI programs
-
discover
On my (K)Unbuntu 20.04 system, discover is pre-installed: type discover in the system/start line to invoke it.
To install it manually, type for example sudo apt install plasma-discover. For more details, see for example following links:- German: https://wiki.ubuntuusers.de/Plasma_Discover/
- English:https://www.omgubuntu.co.uk/2018/01/kde-software-center-discover-improvements
- It does not display package names (only program names)
- It does not disclose the dependent packages installed
- It is assumably (according to link-1 above) not possible to completely remove (purge) a package.
-
muon
On my (K)Unbuntu 20.04 system, muon is also pre-installed: type muon in the system/start line to invoke it.
To install it manually, type for example sudo apt install muon. For more details, see for example following links: Muon does not have the drawbacks mentioned for discover. Also, the comparatively "austere" GUI can be considered either a plus or a minus depending on the user's taste and abilities. -
synaptic
On my (K)Unbuntu 20.04 system, synaptic is not pre-installed - and I did/will not install it.
To install it manually, type for example sudo apt install synaptic. For more details, see for example following links: Synaptic is considered a "lightweight" because it is "just" a graphical interface for apt. This may however be the very reason why users - who refrain from typing commands - install it.
-
discover
Graphical interfaces are self-explanatory: a user needs no specific training to be rapidly able to perform standard tasks. I won't review them in detail. In difficult situations (broken links, incomplete installation, etc.), command line tools may offer more options.
snap Packaging
see chapter snap below.Specific Issues beyond the management of User Packages
At first, the focus was restricted to managing specific user packages that the debian or (K)Ubuntu maintainers may have excluded for their standard distribution: chapters II to VII. In later steps though, issues occurred related to the linux kernel itself and/or dealing with package errors or corruption or specific programs - which led to additional chapters VIII, IX and beyond. Those additional chapters are thematically ordered and, if not, chronologically.
-
Debian packaging: Command line dpkg
-
dpkg stands for debian packag(ing). As the naming indicates, it is used to install, build, remove and manage - in one word maintain - programs (packages) registered with the GNU/Linux debian operating system and wrapped in .deb archives. (k)ubuntu, the operating system I am working with, is debian-based.
dpkg can be used as a front-end to dpkg-deb or dpkg-query. Under circumstances dpkg displays information how to directly enter those last commands to get a more detailed picture.
dpkg is the foundation on which other software management tools, like apt, Synaptic are built on.
No. Title & Description
(Language, if not English)Links
Additional information1-1 Getting Started www.makeuseof.com: getting-started-with-dpkg
The narrative describes a few scenarios naturally embedding a description of useful features.1-2 Getting Started howtoforge.com: linux-dpkg-command/
Simple tutorial explaining most basic options using 8 examples2-1 dpkg manual pages at command line - man dpkg (dpkg manual pages)
- dpkg --help
2-2 dpkg manual pages online -
manpages.ubuntu.com: man1/dpkg.1.html
Exhaustive source with regard to syntax. It includes the actions associated with dpkg-deb and dpkg-query - of which dpkg is a front-end.
3-1 Tutorial (German) -
wiki.ubuntuusers.de: dpkg/
ubuntu Deutschland e.V. maintains high quality documentation on issues associated with ubuntu. Here the contribution about dpkg.
3-2 Overviews, introductions, Guides -
baeldung.com/linux: dpkg-tutorial
Guide to linux dpkg with examples
4-1 Special topic: Package Removal with dpkg linux.org/threads: package-removal-with-dpkg
Good overview about problems and solutions associated with package removal.4-2 Special topic: Package Architecture thelinuxcode.com: dpkg-architecture-list/
Demystifying the DPKG Architecture List in Linux (About the undelying package architecture in dpkg)5-1 Lists of available debian packages debian.org: packages.en.html
Listing and download of packages officially registered by debian. -
dpkg [OPTION] ACTION {Package_Name[...]}
- OPTION determines, if appropriate, "circumstances" of processing. It is like an ADVERB of the command.
- ACTION determines what the user intends to do. This is the VERB of the command. For each action there is a short name (syntax=- shortName) or a long name (syntax=-- longName).
- The last element is the OBJECT of the command. Mostly, it is the name of the package that one intends to manipulate. It may also describe a group of packages, determined extensively (their list) or "intensively" (by a characteristic denoted as an "option" - see for example option --pending in command remove).
-
No. ACTION Description short
Namelong
NameSyntax, Usage, Examples 1-1 INSTALL a package or packages
i
install sudo dpkg -i {Package_Name ...}
sudo dpkg --install {Package_Name ...}2-1 REMOVE a package or packages
Configuration files associated with the package remain in the local dpkg data base (that can be reactivated in case of a reinstallation).
r
remove sudo dpkg -r {Package_Name ...}
sudo dpkg --remove {Package_Name ...}If, instead of extensively listing package names, short option a (sudo dpkg -r -a ) or long option --pending (sudo dpkg --remove --pending ) is input, the command will attempt to remove all packages with status deinstall - see also get-selections.
2-2 PURGE a package or packages
Unlike Action REMOVE, the configuration files are deleted along with the packages themselves.
P
purge sudo dpkg -P {Package_Name ...}
sudo dpkg --purge {Package_Name ...}The same option a or --pending theoretically applies as for the dpkg remove ACTION.
3-1 ACTION LIST installed packages.
It displays one package a line, see also package status information.
l
list
dpkg -l
dpkg-query --list
In combination with grep, it may be used to search for package name (patterns) e.g. dpkg -l | grep -E -i libreoffice lists every package line containing the string 'libreoffice'.
3-2 ACTION LIST installed packages.
It displays one package a line, see also package status information.-
get-selections If only the package status matters, then use command dpkg --get-selections.
This is especially interesting, if one needs to identify all packages marked (by dpkg) to be deinstalled (status=deinstall) (by piping the command with grep -C -i deinstall.
3-3 ACTION UNPACK unpack a package.
It displays content files and directories inside a package as well as the dependencies associated.
-
unpack Note: This command is a preliminary check. The package has been downloaded, but has not been installed yet.
4 SEARCH installed packages for a given (file) name (pattern) .
S
search
-
dpkg -S {Name (Pattern)}
dpkg --search {Name (Pattern)}
5 (GET) STATUS:
Check whether a specific package has been installed.If yes, deliver much information about the package.
s
status
dpkg -s {Package_Name}
dpkg --status {Package_Name}6-1 GET INFO: list-files (after installation)
List installed files pertaining to a specified installed packageL
list-files
dpkg -L {Package_Name}
dpkg --list-files {Package_Name}6-2 GET INFO: print-avail (after installation)
Print Information about a specified installed packages-
print-avail
dpkg --print-avail [{Package_Name} ...] e.g.
dpkg --print-avail vim elvis | less- Without {Package_Name}, the command displays information about all currently available packages (On my system the command displays about 5 000 lines).
- Also, it may be advisable to run sudo dpkg --update-avail beforehand.
6-3 (GET) INFO: info (before installing)
Get information for a file Archive.deb stored locally, but not yet installed.
-
info
dpkg --info {Download_Directory/Archive.deb}
6-4 GET INFO: contents (before installing)
Get information for a file Archive.deb stored locally, but not yet installed.
c
contents
dpkg --contents {Download_Directory/Archive.deb}
7 CHECK CONSISTENCY: audit
Check for broken packages (missing dependencies or otherwise incorrectly installed).It only displays an output, if errors have been detected.
-
audit
dpkg --audit Further remarks related to packages management
-
Command dpkg keeps record of certain actions into logfiles located in directory /var/log.
Logfile, named dpkg.log, tracks what has been processed within the current month. Older Records are kept in files dpkg.log.<i>, with 1 ≤ i ≤ 4: Variable <i> represents months on a time line oriented toward the past. Older months (i ≥2) are stored in compacted format -e.g. dpkg.log.2.gz.-
To see the complete recording, one might type cat /var/log/dpkg.log.
-
To check what has been processed at last, one might type tail /var/log/dpkg.log
- which lists the last 10 lines of the file.
-
More specifically, grep install /var/log/dpkg.log | tail will list
the last ten actions related to the installation alone. Other action related keywords may be
remove, upgrade, etc.
-
To see the complete recording, one might type cat /var/log/dpkg.log.
-
-
-
Search for packages previously to their downloads
There does not seem to be a dpkg action to verify whether package name patterns has been registered. One possibility is to visit the debian official site (https://www.debian.org/distrib/packages.en.html). A search function is available there. -
Useful OPTIONS:
Note: Those options must be set BEFORE the ACTION (if any required).-
dpkg --version
displays the version of the dpkg program in use. -
dpkg --no-pager ACTION
disables the use of pagers when displaying the command outputs. -
dpkg --no-act ACTION
dpkg --simulate ACTION
dpkg --dry-run ACTION
does not actually perform the action - just documents it.
-
-
Package Status Information:
This information is composed of 3 ordered values, one for each categories below.-
category: targeted status of package
- u: unknown
- i: installed
- h: hold
- r: remove (but retain the configuration files)
- p: purge (remove package and configuration files)
-
category: current status of package
- n: not installed
- c: configuration files available
- H: on hold (incomplete installation)
- U: unpacked (archive unpacked, but package not yet installed)
- F: Package not fully configurated
- {Package_Name} W: dpkg has listed further packages into the installation queue, packages that are presumably associated with more than one package installed and will be uploaded at last.
- t: immediately prior status W
- i: installed
-
category: errors
- : (blank) no errors detected
- R: package must be re-installed.
- status [ii ] means "package has been successfully installed"
- status [rc ] means "package has been removes, but the configuration files are still remaining"
- status [un ] means "package has been removed"
In (k)ubuntu systems, dpkg stores status information in file /var/lib/dpkg/status. (On my system, it produces an output of about 50 000 lines).
-
-
REMOVE all deinstall packages:
I tested commands (sudo dpkg --remove --pending ) and (sudo apt-get dselect-upgrade): remove all packages marked for deinstallation. Neither of them did succeed.
Fact is that, in this unsuccessful test, all deinstall packages identified were obsolete linux-image-version-genetic and linux-modules-version-generic. Those same files broke my system a few months ago (probably because the allocated space for the linux images was full). I was forced to completely reinstall linux at that time. I suspect, that those remnants of an older installation are somehow corrupted or otherwise defect. My test is inconclusive.
-
REMOVE old kernel versions
See also following sources:- nixCraft: → remove unused old kernels
- phoenixnap: → remove old kernels on ubuntu
- pontikis: → remove old kernels in debian and ubuntu
linux leaves it to administrators (sudo privilege) to remove old linux kernels, as the system keeps on updating itself. This can especially become a concern, if those files are stored on partitions with limited capacities. On older linux systems, I experienced serious disorders, as the update mechanism became unable to successfully install new kernels due to lack of storage. (At that time, I was not aware that the system did not automatically remove unused versions.)
Overview of the required steps:
- List the old kernels using e.g. the dpkg command
- Check the available space
- Delete unused old kernels
- Check again the available space
- Alternative manual options
-
Listing kernel files is a necessity on older linux versions because each single version must to be removed explicitly. In modern linux versions (> 18.04), this purging may be performed by one command. The listing of kernel file is always recommended for checking and documentation purposes. Here the commands:
-
To list all linux kernels files (whose names contain either linux-image or linux headers):
dpkg --list | grep -E -i 'linux-image|linux-headers' On my current system, there are 44 files. (Since one file per line is displayed, I only need to count the number lines displayed, for example by piping the display into command wc -l). -
To list the successfully installed linux kernels (marked ii):
dpkg --list | grep -E -i 'linux-image|linux-headers' | grep -E '^ii' On my current system, there are 32 files.
-
-
To check the available amount of disk space, one may use following command:
df -H | grep -E -v 'loop'
The option -H stands for human readable. Also, the so-called loop volumes are ignored, since they are irrelevant in this context. -
The central command (actually doing the job) is
sudo apt --purge autoremove or sudo apt-get --purge autoremove
-
To check whether the system actually changed something, one only needs to re-launch the first two steps and compare with the results before and after purging.
On my current system, the automatic purge command performed nothing! There are still rather old linux images e.g. versions 5.4.0-66, 5.4.0-70, 5.4.0-71. -
In this case, one may decide to manually remove single linux versions using following commands:
-
Check the currently activated version of the linux kernel using uname -mrs or uname -a .
On my system, this current linux version is 5.4.0-100-generic -
To list older kernel versions still stored cf. the step 1, for example. dpkg --list | grep -E -i 'linux-image'
-
The actual operation is sudo dpkg --purge [old_kernel_version] - for example (on my current system) sudo dpkg --purge linux-image-5.4.0-66.
Be cautious not to remove the current version!On my current system, I was able to remove manually most of the linux-image files except for 4 (resp. 25 installed packages whose name contains either linux-image or linux-headers.
-
After having removed one or several individual (older) kernel versions it will be necessary to update grub and reboot:
sudo update-grub
systemctl reboot
-
-
-
-
Most of times I use the command apt-get to manage packages in linux. This utility is used to work with the Ubuntu's APT (Advanced Packaging Tool) library.
-
apt-get: Documentation sources
No. Title & Description
(Language, if not English)Links
Additional information1 ubuntuusers (German Wiki) https://wiki.ubuntuusers.de/apt/apt-get/#Optionen
Well structured website very useful, if one can read German.2 Get started with apt-get https://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/
presents 20 basic useful commands3 apt-get Howto https://help.ubuntu.com/community/AptGet/Howto
describes how to handle packages with apt-get.4 apt-get manual pages https://ss64.com/bash/apt-get.html
manpage for apt-get. -
[sudo] apt-get [OPTION...] ACTION {Package_Name[...]}
- OPTION determines, if appropriate, "circumstances" that control the behavior. It is like an ADVERB of the command.
- ACTION determines what the user intends to do. This is the VERB of the command.
- The last element is the OBJECT of the command. Mostly, it is the name of the package that one intends to manipulate or a list of packages. If no "object" is explicit input, some implicit definition is assumed based on the action taken.
-
Options may be added to control the behavior of a command, where it makes sense. Some useful options are listed in a separate table below.
No. ACTION Description Syntax, Usage, Examples 1 update
reads all packages listed in- /etc/apt/sources.list
- /etc/apt/sources.list.d/
and updates the information (metadata) stored about them.
sudo apt-get update
The command displays a list of updated metadata.2 upgrade
all locally installed packages will be set to the newest state (according to the metadata previously collected via action "update").sudo apt-get upgrade
The command displays a information about what has been done.
The command will not add or remove any file, only replace obsolete ones. If appropriate, it will urge the user to remove packages automatically installed - for example via sudo apt autoremove.3 dist-upgrade
does what one probably means when one intends to upgrade all packages. It updates the installed packages to the newest version. Unlike action "upgrade" it will install new files or remove older ones and also resolve conflicts, if any, by establishing a priority: most important packages get more attention than less important ones.Note that the command does not install a higher ubuntu version. To my knowledge the later step can only be achieved by re-installing the system.
sudo apt-get dist-upgrade
The command displays information about what has been done.for example see also https://linuxhint.com/apt_get_upgrade_dist_upgrade/
4 install Package_Name...
Note that the command will not install a higher ubuntu version. To my knowledge the later step can only be achieved by re-installing the system.
sudo apt-get install ddrescueview
The command displays information about what has been done.5 remove Package_Name...
performs the opposite action as install. However, the package configuration files remain (like in dpkg_remove).
sudo apt-get remove ddrescueview
The command displays information about what has been done while remove package ddrescueview.6 purge Package_Name...
performs like apt-get remove but it additionally removes the package configuration files (vgl. dpkg_purge).
sudo apt-get purge ddrescueview
displays information about what has been done while removing package ddrescueview and its configuration files.7 check Package_Name...
is a diagnostic tool. It updates the package and checks for broken dependencies.
sudo apt-get check gddrescue
The command displays information about what has been done.8 clean
removes all downloaded installation files stored in
- /var/cache/apt/archives
- /var/cache/apt/archives/partial
except for the lock file: the main intention is to reclaim storage space.
9 autoclean
does not perform so radically as apt-get clean - only removing downloaded installation files stored in
- /var/cache/apt/archives
- /var/cache/apt/archives/partial
that are not listed anymore in the sources.
sudo apt-get autoclean
As I launched the command a few minutes ago, it deleted 22 out of 109 files - many of them linux- names .10 autoremove [Package_name...]
If a package is named, it will be removed and in a second step all freed dependencies that were uniquely associated to it (them).sudo apt-get autoremove
removes free floating packages (not installed by the user or required for any installed package). and displays a summary of results.
I launched the command a few seconds ago. It responded that nothing has been done (0 update, 0 installation, 0 removal and 0 not updated).No. OPTION (short) Description 1 -- simulate, --dry-run (-s) It does not actually perform the action but rather displays what would be done.
2 --fix-broken (-f) Normally, used to control the behavior of apt-get install or apt-get remove, it does not require a package name. APT will analyze by itself and deduce a likely solution.
3 --show-upgraded (-u) It prints out a list of all packages that are to be upgraded (Used to control the behavior of apt-get install, apt-get update, apt-get upgrade)
4 --version (-v) It shows the program version and supported modules
-
-
Reinstall a linux kernel
It happened a few times that I inadvertently deleted library /lib/modules which contains a sub-directory for each linux kernel installed. If those sub-directories are corrupted or even missing, it won't be possible to correctly manage kernel versions (e.g. delete older ones). The solution is to reinstall first all kernels listed in the system (The list can be retrieved using command dpkg --list | grep -E -i 'linux-image')
-
Display the list of all linux kernel somehow registered with the system using command dpkg --list | grep -E -i 'linux-image'
-
For each linux version create the corresponding subdirectory in /lib/modules/ using command sudo mkdir -v /lib/modules/[Kernel-Version] e.g. sudo mkdir -v /lib/modules/5.4.0-100-generic
-
Reinstall each linux version using command sudo apt-get install --reinstall linux-image-generic [linux-image-Version] e.g. sudo apt-get install --reinstall linux-image-generic linux-image-5.4.0-100-generic
-
sudo update-grub
-
sudo reboot now
-
-
-
-
apt-cache is used for searching apt (Advanced Packaging Tool) software package cache, available packages ready for installation on Debian or Ubuntu based systems.
-
apt-cache: Documentation sources
No. Title & Description
(Language, if not English)Links
Additional information1 Get started with apt-cache https://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/
presents 5 basic useful commands2-1 apt-cache Linux manual page 2-2 apt-cache Ubuntu manual page https://manpages.ubuntu.com/manpages/precise/en/man8/apt-cache.8.html
There are differences in the command syntax between the Linux and the Ubuntu manpages. On my computer the Ubuntu manpage prevails. - see get-apt Syntax
-
Options may be added to control the behavior of a command, where it makes sense. Some useful options are listed in a separate table below.
No. ACTION Description Syntax, Usage, Examples 1 pkgnames
lists all available package namesapt-cache pkgnames
- On my computer there are currently 63651 packages available
-
If I search for pattern ddrescue (apt-cache pkgnames | grep -E -i ddrescue)
2 package names are listed: ddrescueview, gddrescue.
It is possible to type apt-cache pkgnames PackageName, to identify packages of which names start with PackageName. If PackageName is ddrescue, the command will display only one package, namely ddrescueview (More advanced pattern recognition features are not supported).
2 search PackageName
displays packages matching the (regexp (7)) PackageName with a short description thereof.apt-cache search ddrescue
displays following lines
- ddrescueview - graphical viewer for GNU ddrescue map files
- ddrutility - set of data recovery utilities for use with GNU ddrescue
- forensics-extra - Forensics Environment - extra console components (metapackage)
- myrescue - rescue data from damaged disks
- safecopy - data recovery tool for problematic or damaged media
- gddrescue - GNU-Werkzeug zur Datenwiederherstellung
apt-cache search --names-only ddrescue
displays following lines (see table of options below)
- ddrescueview - graphical viewer for GNU ddrescue map files
- gddrescue - GNU-Werkzeug zur Datenwiederherstellung
Remarks
-
As can be deduced from the example above, action search supports regular expressions, more precisely regex.7.gz (POSIX.2). For example apt-cache search --names-only d*rescue would still display the output above, and a couple of additional packages, for example dracut-config-rescue or searchandrescue.
-
One can also use option --full to get extensive data about the packages.
3-1 show PackageName
displays extensive information about package PackageNameapt-cache show gddrescue
displays 62 lines including following characteristics: Architecture, Version, Priority, Section, Origin, Maintainer, Bugs, Installed-size, Suggests, Filename, Homepage, Description.Note that PackageName must exactly match the name of an existing package: no pattern matching supported.
3-2 showpkg PackageName (show package)
displays dependencies associated with package PackageNameapt-cache showpkd gddrescue
displays among other characteristics:-
Reverse Depends
packages that depend on gddrescue: ddrescueview, stressant-meta, forensics-extra, ddrutility. -
Dependencies
packages on which gddrescue depends: like 1.23-2build1, libc6 (2 2.14), libgcc-s1 (2 3.0), libstdc++6 (2 5.2),
Note that PackageName must exactly match the name of an existing package: no pattern matching supported.
3-3 depends PackageName
displays dependencies associated with package PackageNameapt-cache dependsgddrescue
Like apt-cache showpkg gddrescue displays
-
Dependencies
libc6, libgcc-s1, libstdc++6. -
install proposals
ddrescueview (GUI).
Note that PackageName must exactly match the name of an existing package: no pattern matching supported.
3-4 rdepends PackageName (reverse depend)
displays packages that depend on PackageNameapt-cache rdepends gddrescue
It shows analogies to apt-cache showpkg gddrescue as apt-cache depends gddrescue does, but with regard to reverse dependencies. Following output is displayed: ddrescueview, stresasant-meta, forensics-extra, ddrutility.
Note that PackageName must exactly match the name of an existing package: no pattern matching supported.
4 stats
displays overall statistics about the cacheapt-cache stats
displays among other characteristics:Total number of package names 102071 Total number of package structures 99048 Total number of different versions 76807 Total number of different descriptions 169209 No. OPTION (short) Description 1 -- names-only (-n) apt-cache actions "search" will, by default, check package names and (long) descriptions to find matches. Option --name-only restricts the search to the package names.
2 -- full (-f) Option --full will force the command to provide maximum information regarding matching packages.
3 -- recurse Option -- recurse makes actions "depends" or "rdepends" being processed recursively.
4 -- installed Option -- installed limits actions "depends" or "rdepends" to only display installed packages.
5 -- version Option -- version shows the version number of the apt-cache command currently active. My system displays apt 2.0.5 (amd64)
-
-
apt is currently the tool of choice in Debian based Linux systems, recommended for normal users, as an "improved", "modern" version of the previous apt-get, also supporting apt-cache functions. Unsurprisingly, the command syntax is similar. Be cautious though, apt is not "backward compatible": the same option might not exactly behave the same.
-
No. Title & Description
(Language, if not English)Links
Additional information1-1 Getting Started 1-2 Getting Started 2-1 Ubuntu Wiki: Package Management 2-2 Linuxhint Wiki: How to use apt? 2-3 Debian Package Management with apt 3-1 ubuntu (20.04) manpages https://manpages.ubuntu.com/manpages/focal/en/man8/apt.8.html
3-2 ubuntuusers manpages (German) https://wiki.ubuntuusers.de/apt/apt/
includes a comparison between apt and apt-get4 Differences between apt-get and apt -
[sudo] apt [OPTION...] ACTION {Package_Name[...]}
- OPTION determines, if appropriate, "circumstances" that control the behavior. Like an ADVERB.
- ACTION determines what the user intends to do. Like a VERB.
- The third element is the OBJECT (on which the action acts). Mostly, a list of packages. Many ACTIONS bear NO explicit OBJECT, because there are implicitly known.
-
Options may be added to control the behavior of a command, where it makes sense. Some useful options are listed in a separate table below.
No. ACTION Description Syntax, Usage, Examples 1 update
downloads the newest package information (metadata) from all configured sources (stored in /etc/apt/) previous to update the installed packages themselves - which is called upgrade.sudo apt update
The command displays a list of repositories where the metadata was checked.2-1 upgrade see also apt-get update
locally installed packages will be set to a newer state, if the metadata (collected by update) say so.sudo apt upgrade
The command displays a information about what has been done. It will add packages if new dependencies make it necessary, but will not remove any - rather skipping the task, if it implies deleting existing packages. To force upgrading in this case, use command sudo apt full-upgrade.2-2 full-upgrade see also apt-get dist-upgrade
does what one probably means when one intends to upgrade all packages: unlike action "upgrade", it will remove also older packages, if necessary.sudo apt full upgrade
The command displays information about what has been done.3 install Package_Name... see also apt-get-install reinstall Package_Name remove Package_Name... see also apt-get-remove purge Package_Name... see also apt-get-purge performs the named action on one or more packages via regexp (7), glob (7) or exact match.
sudo apt install ddrescueview
The command displays information about what has been done.-
A specific version of a package can be selected for installation by following the package name with the sign = and the package version. Alternatively, the version associated with a specific release with the sign / and a codename or suite name (stable, testing, unstable).
-
Between actions remove and purge the same differences exists as in command get-apt. (purge deletes not only the packages but also associated configuration files).
4 autoremove - see also apt-get autoremove
-
Unlike apt-get autoremove cannot target a specific package. It removes all packages that were installed to match dependencies - i.e. not directly installed by the user -, if there are no longer necessary (because the dependent packages have been removed in the meanwhile).
-
Under circumstances the user may find intermediary packages useful and want to set them out of reach. To do this, he must mark them a posteriori as "manually / directly" installed: apt-mark Package_Name.
5 search Package_Name - see also apt-cache search
search for Package_Name in the repositories. Package_Name is a regexp (7).sudo apt search ddrescue
displays for example following output on my current system (a selection).- ddrescueview/focal 0.4~alpha3-3 amd64
graphica viewer for GNU ddrescue map files -
ddrutility/focal 2.8-1 amd64
set of data recovery utilities for use with GNU ddrescue -
gddrescue/focal,now 1.23-build1 amd64 [installed]
GNU-tool for data recovery
6-1 showPackage_Name- see also apt-cache show
shows detailed information (Version, dependencies, description, etc.) about installed package Package_Name .sudo apt show gddrescue
No pattern matching allowed here: on my current system sudo apt show ddrescue yields no result.6-2 dependsPackage_Name- see also apt-cache depends
shows packages on which package Package_Name (exact match) depends.sudo apt depends gddrescue
On my current system gddrescue depends on 3 libraries: libc6,libgcc-s1,libstdc++6.No pattern matching allowed here: sudo apt depends ddrescue yields no result.
7 list Package_Name... - see also dpkg-query-list
lists packages fulfilling specific conditionsAs for conditions, following features are supported:
- Globbing (7) the Package_Names.
- Further narrowing the output using options: --installed, --upgradeable, all-versions.
sudo apt list
lists all available package at time of execution: 68464 packages for my system.sudo apt list --installed
lists all installed packages at time of execution: 2049 on my system.sudo apt list --upgradeable
lists all packages ready for upgrade at time of execution: On my system, 1 package, distro-info-data (marked as such in 3 repositories known to my system). I resolve the issue by typing sudo apt upgrade.8 edit-sources
allows the user to edit the file containing the list of the repositories known to the system.The source repositories are listed in file sources.list (that is located in /etc/apt on my kubuntu system).
What if I type apt edit-sources on my system?
The command requires that the parser tool pt be installed (which is not). In order to install this tool, I need to install package "standard tcl library (apt install tcllib). I will rather wait until the command allows to select the treatment program.9 apt dist-upgrade appears to be the same apt-get dist-upgrade
Remarks:
-
Breaking the installation process:
It is possible to break the install process in 2 steps: download, install.- Command apt download Package_Name will download the .deb archive associated with Package_Name into the directory from which it was run.
- Command apt install /path/to/file/archive.deb will install the package and automatically fetch package dependencies, if necessary.
-
Upgrading one package at a time:
Command sudo apt upgrade will upgrade the whole set of upgradeable packages at once.
Command apt install --only-upgrade Package_Name focusses only on a particular package.
No. OPTION (short) Description 1 --version (-v) apt --version
shows the program version. Currently: apt 2.0.5 (amd64)2 --help (-h) apt --help
provides helpful information about apt and how to start.3 -t=target_release apt -t=My_Target_Release install My_Package_Name
see also apt install4 -a = architecture apt -a=My_Architecture install My_Package_Name
see also apt install.Quite honestly, I do not think I will ever have to determine this parameter when installing a package.
-
-
-
The APT framework sets guide lines in order to register packages with a given distribution. The main intention is to protect users against error prone tools (updates). The downside is that package versions available with a given Linux distribution may be well behind the current last stable version. This may become annoying, if new package versions solve critical bugs or support valuable new features. One example that comes to my mind is libreoffice: As I write those words, the last stable version is 7.1.2.2, but the official version registered with Ubuntu 20.04 is 6.4.7.
Fortunately, one can to force the installation of the latest stable version of a package, if a corresponding ppa repository (Personal Package Archive) is available. The procedure is well explained in https://itsfoss.com/ppa-guide/. Mutatis mutandis:
-
To list the packages that are already under ppa control, type following command:
apt policy.
As theses lines are being written, there is only one ppa content. The command displays following output.
500 https://ppa.launchpadcontent.net/mozillacorp/mozillavpn/ubuntu jammy/main amd64 Packages
release v=22.04,o=LP-PPA-mozillacorp-mozillavpn,a=jammy,n=jammy,l=Mozilla VPN,c=main,b=amd64
origin ppa.launchpadcontent.net
Note that ppa managed packages should appear first. To make sure that all ppa entries are detected, one might filter them with the grep command: apt policy | grep -E -i ppa
-
-
Backup the current local list of repositories, in case troubles should occur e.g.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup -
Add ppa repository into the local list. It will be stored in /etc/apd/sources.list.d/.
sudo app-apt-repository ppa:libreoffice/ppa -
Synchronize local repositories with their sources
sudo apt-get update -
Install ppa package. It will overwrite the corresponding default package, if installed e.g.
sudo apt-get install libreoffice -
Synchronize the newly added ppa repository with its sources
sudo apt-get update -
Update the contents of the installed packages
sudo apt-get upgrade
-
-
-
To remove a ppa repository type
sudo app-apt-repository --remove ppa:repository_name/subdirectory resp.
sudo app-apt-repository -r ppa:repository_name/subdirectory
e.g. sudo app-apt-repository -r ppa:libreoffice/ppa.
Note: No ppa updates anymore, but installed (ppa) packages remain untouched.
-
To downgrade packages installed from a ppa repository, one must additionally type
sudo ppa-purge ppa:repository_name/subdirectory
e.g. sudo ppa-purge ppa:libreoffice/ppa.
Note: Mostly, ppa-purge is not part of the Linux distribution. To install it, type sudo apt install ppa-purge.
-
-
To list the packages that are already under ppa control, type following command:
apt policy.
-
The snap packaging system is more recent and seems to gain momentum. Unlike the tools present above, snap does not base on the debian format (APT), but developed an alternative pathway. Actually, snap was specifically developed to manage applications independently from guide lines set by Linux-distributions - which for example set up which versions of a registered application will be distributed / downloaded (most probably not the latest one). Consequently a snap bundle, the equivalent to a .deb archive, installs its dependencies free from the distribution. Other properties are:
- snaps do not only run on desktops, but also on IoT devices, servers and clouds.
- snaps can bundle both proprietary applications and open source. For example, on my system, the web browser opera is maintained via snap.
Terms and definitions
snap Both the command line interface and the application package format.
-
The command line interface supports several commands to manage the packages - as for example dpkg, apt-get, apt do for debian packages. See below for examples of snap commands.
-
snap packages (files) are images based on the SquashFS, a read-only file system commonly used by portable Linux systems, from where the installed snap (program) is invoked. As a consequence, snap files (i.e. file systems) will be mounted as (pseudo) block devices of type loop. One may list those loop devices on Ubuntu 20.04 using for example following commands:
lsblk snap devices are listed as loop. Their major device number is 7 sudo fdisk -l As for lsblk, each snap is listed as /dev/loopnumber snap keeps, by default, the latest two revisions of a package (allowing a quick reversion to the previous version, if need be). For example, my current system maintains revisions 121 and 120 of a snap named opera - mounted on /snap/opera/121 and /snap/opera/120.
The terms version and revision may be used indistinctly when uniquely identifying "states". They do not mean the same though:
- Version numbers are attributed by the developers to uniquely identify a (program) release on their product lines. Each project may defined its own rules to name (number) a state.
- A revision number is (automatically) attributed by the snap store to uniquely identify a snap file.
It is possible to increase the number of (snap archive) versions (revision) kept. For example sudo snap set system refresh.retain=3 will force the system to retain the current version plus the next two older ones. However, it is arguably not possible to force the system to automatically keep only one single version of a package. In other words, sudo snap set system refresh.retain=1 is illegal (I did not test this command though).
To know the current configuration values, type sudo snap get system refresh[.retain]:
- key refresh (alone) displays all key-value pairs associated with the command.
- key refresh.retain displays the value associated with key refresh.retain.
Note: Currently, on my system, no configuration value is shown for command refresh at all (probably because none has been explicitly set).
snap supports a fine tuning of snap installations, based on the ideas of tracks and channels. Using this terminology, one can rephrase the distribution policy as follows.
- The developers decide whether they would distribute alternative tracks. The standard track is latest. Others can be hold ready by developers, if they wish.
- Within a track, channels are always defined the same way: stable,candidate,beta,edge - their meaning is self-explaining.
Bottom line: version latest/stable (track/channel) is available and selected by default.
snapd background service (demon) managing and maintaining snaps. To check the demon status on a Linux distribution supporting systemd (like my own), type systemctl status snapd
From ubuntu 16.04 on, snapd is installed by default. Otherwise, do it manually: sudo apt install snapd
snapcraft command and framework available to the developers for building own span bundles to be distributed via the snap infrastruture.
snapstore - for users download site
- for developers upload site
snaps are stored in /var/lib/snapd/snaps/NameOfsnaps_VersionNumber.snap (always compressed). This also includes snap packages labeled core: the runtime environment for snaps. On my system, following cores - mount points, (loop devices number) - are currently listed: /snap/core/10908 (/dev/loop1), /snap/core/10958 (/dev/loop3), /snap/core18/1988 (/dev/loop2), /snap/core18/1997 (/dev/loop10).
As all snaps run in the core runtime environment, they contain all dependencies on their own, except for libraries of the desktop environment, used by all packages: on my system currently gnome-3-28-1804/145.
To display how much storage (compressed) snaps use, one can for example type following commands:
Command Displays du -hc /var/lib/snapd/snaps/NameOfSnap_VersionNumber.snap size of a specific package version du -hc /var/lib/snapd/snaps/NameOfSnap_*.snap size of all stored versions of a specific package du -hc /var/lib/snapd/snaps/*.snap size of all stored snaps To display how much memory a (decompressed) snaps use one can type following commands:
Command Displays du -hc /snap/NameOfSnap size used for a specific snap du -hc /snap/* size used for all snaps Rem: Since the snap archives are always compressed, values in tab. 1 are expectedly much smaller than in tab. 2. On my system, the current overall value is ca. 1 GB (storage) versus ca. 3 GB (memory).
-
No. Title & Description
(Language, if not English)Links
Additional information1 Wiki ubuntuusers (German) https://wiki.ubuntuusers.de/snap/
For German readers, I strongly recommend the site: the documentation is well structured and extensive. There does not seem to be translations in any other language though.2 Official snap developers site Main page, downloads https://snapcraft.io/ Documentation https://snapcraft.io/docs Getting started https://snapcraft.io/docs/getting-started If one needs information about a given package, one can visit web page https://snapcraft.io/NameDesSnaps.
As an example, type https://snapcraft.io/libreoffice to get information about LibreOffice.-
Alternative way to get the latest stable version of a package
The currently downloadable snap version is 7.1.2.2 - compared to version 6.4.7 officially registered on my Ubuntu 20.04 system. For those who may need new features supported by libreoffice 7.x, to activate the libreoffice snap may be an alternative. (The classical way though would be to install the dedicated debian ppa package.) -
Package availability
Packages may well be available exclusively as debian or snap archives.
3 Manpages Ubuntu 20.04 https://manpages.ubuntu.com/manpages/bionic/en/man1/snap.1.html manpages.org http://manpages.org/snap manpages debian https://manpages.debian.org/buster/snapd/snap.8.en.html -
-
- [sudo] snap OPTIONS
- [sudo] snap COMMAND [COMMAND-OPTIONS]
OPTIONS are not associated with a particular command and will therefore be used without. There are 2 options
- --version print the version numbers of the snap tool.
-
--help (-h) print information about the snap command (how to use it). Note that --help can also be a COMMAND-OPTION: in this case, the output specifically relates to the given command. In fact, the help function is syntactically polymorphic, to inform users without much of formal restrictions. Especially, help can also be understand as a command see in basic examples below.
-
snap: Basic commands (examples)
No. ACTION Description Syntax, Usage, Examples 1 find alias search
snap find SEARCH_PATTERN or snap search SEARCH_PATTERN, with SEARCH_PATTERN containing at least one non-regular character will search the snap store for conforming packages.
As an example, snap find libreoffice will list, following names (as I write those words):
- libreoffice 7.1.2.2
- projectlibre 1.9.1
2 list
snap list [list-OPTIONS],
lists the installed packagesAs an example snap list will list, all snaps already installed. Currently, my system hosts following snap packages (a selection):
- core 16-2.49.2, latest/stable, canonical
- gnome-3-28-1804,latest/stable, canonical
- snapd 2.49.2, canonical
If list-OPTION --all is added, all revisions are shown: normally, as the next to last version is deactivated but not removed, it will be displayed.
Note:
Action list does not provide time stamps of installation. To retrieve those pieces of information one must list installation files directly.Here are two (2) possibilities on my Ubuntu system.
-
ls -l /snap/bin
On my system this command provides a link to binary file /usr/bin/snap. Nothing that can be directly exploited on this path. -
ls -l /var/lib/snapd/snaps
contains a list of regular files - that can only be read by a superuser.
Each file corresponds to a particular release version of one (snap installed) program. As an example, firefox_3600.snap corresponds to release version 3600 of firefox (that is snap controlled on my computer).The time stamp of this file indicates the date, when this particular version has been installed.
3 info
snap info [info-OPTIONS],
shows detailed information about a snap.As an example, snap info rapunzel yields following pieces of information (a selection)
-
name: rapunzel
summary: Code editor for numerical computing with Python and R
publisher. Sebastiann Mathot (smathot)
store-url: https://snapcraft.io/rapunzel
contact: https://www.cogsci.nl/smathot
License: GPL-3.0+
-
description:
... -
snap-id: ...
Channels:
latest/stable 0.5.23-snap1 2021-05-02 (9) 188MB
latest/candidate 0.5.23-snap1 2021-05-02 (9) 188MB
latest/beta
latest/edge
4 install
snap install [install-OPTIONS],
installs one snap packageAs an example snap install rapunzel [--channel=latest/stable] will install, the code editor for numerical computing with Python and R, named Rapunzel.
I selected this example because, currently, on my system, this package is snap-only: It cannot be installed via the APT infrastructure (i.e. apt search rapunzel will bear no results). Also, rapunzel may help me in one of my future projects.
As mentioned in the snap definition, it is possible to install specific snaps other than the default one, coined latest/stable (track/channel). This is where the install-options intervene:
-
Select channel:
Among others, following channels are specified: --edge, --beta, --candidate, --stable. Examples are snap install rapunzel --stable (snap install rapunzel --channel=stable) or snap install rapunzel --candidate (snap install rapunzel --channel=candidate). As a matter of fact, snap info rapunzel shows that both channels exist but refer to the same version (of track latest) -
Select track:
If vendors define additional tracks (beside latest), install-option --channel=track/channel may identify them (I did not test this option though, since the rapunzel vendor did not define alternative ones.
Note: More channels are available - mostly to meet developers needs. They are bound to additional conditions (a.o. a snap-login). See table of sources above for details.
5 refresh
snap refresh [Package_Name] [refresh-OPTIONS],
sudo snap refresh updates all installed snaps. sudo snap refresh rapunzel updates snap rapunzel.
sudo snap refresh --channel=candidate rapunzel If several channels have been simultaneously installed (for example channel latest and channel candidate), option --channel=candidate will switch to the named channel (candidate) and refresh the associated snap.
snap refresh --time Using refresh-option time informs about the last and the next automatic refreshment, scheduled by the snap demon (snapd). For example, as I wrote those words, the system informs me that the last refreshment took place today (15 h 19 min) and the next will take place today too (23 h 38 min). The timer is set to value 00:00~24:00/4 (four times a day).
Note: It is possible to control the refreshment frequency, see https://snapcraft.io/docs/keeping-snaps-up-to-date for details.
6 help
-
snap help
provides general information about snap. -
snap help list
provides information about the list command and its options. -
snap help --man | xargs man -t 2>dev/null | ps2pdf - > ~/Downloads/CMD_snap.pdf
generates a manpage (CMD_snap.pdf in the /Downloads subdirectory of the user's home directory) of snap by piping the output of snap help into several transformation steps.Digression (about manpages):
There is a much more general way to generate and display manpages: adding a function (named for example pdfman) in the ~/.bashrc file (the user specific bash configuration file).Coding:
pdfman() {
man -t $1 2>/dev/null | ps2pdf - > "~/cmd/CMD_$1.pdf" && \
okular "~/cmd/CMD_$1.pdf"
}Explanation:
pdfman will execute following steps:
(1: function man -t) General a manpage file data in ps format.
(2: function ps2pdf) Convert the data into pdf format, name and store.
(3: function okular) open the newly created pdf file with a viewer (named okular).
$1 is an (the) argument of pdfman - which happens to be the name of the command to display.Usage:
As an example, the user will type pdfman ls to create a file ~/cmd/CMD_ls.pdf, that is a manpage for command ls (list files/directories).
7 remove
snap remove [remove-OPTIONS],
completely remove a snap from the system (incl. the configuration data)As an example, snap remove vlc will remove all vlc installed revisions of the vlc snap.
To remove a specific revision of the snap, one must specify the revision number as an option: --revision=<revision-number>. The revision numbers of snap NameOfSnap, can be checked using snap list --all NameOfSnap.
Prior to removal, a snap's internal user, system and configuration data is saved as a "snapshot" and retained 31 days. To skip this backup use remove-OPTION --purge
To deinstall snap use command apt purge snapd. Unlike sudo apt remove snapd, it will also remove all installed snap packages and their revisions. The last step would be to check subdirectory ~/snap (in the home directory) and manually delete the remaining contents. 8 revert
snap revert [revert-OPTIONS] snapName,
reactivates the previously used version of snapName.Suppose that snap has installed revisions 121 and 122 of opera on a system (like it is the case on mine). Revision 122 (the latest) is activated. Revision 121 is a backup. snap revert opera will reactivate revision 121 and disable (not remove) revision 122. snap displays what it did.
A subsequent snap refresh command (without snap name) will not overwrite a revert action, unless another latest revision has been published since reversion. However, if the refresh command explicitly targets a reverted snap (for example snap refresh opera), then opera will be updated to revision 122, or later if existing.
9 disable / enable
As an example, snap disable opera will disable opera making it temporarily unavoidable. However, to revert the status it suffices to type snap enable opera.
It is possible to deactivate (not deinstall) the snapd service itself completely via systemctl commands. - sudo systemctl disable snapd.service
- sudo systemctl disable snapd.socket
- sudo systemctl disable snapd.seeded.service
Those changes will take place automatically when the system reboots. However, at this stage, a manual start is always possible:
sudo systemctl start snapd.serviceTo restore the automatic activation, when the system boots, one must replace disable with enable in the previous three commands.
- sudo systemctl enable snapd.service
- sudo systemctl enable snapd.socket
- sudo systemctl enable snapd.seeded.service
-
-
Previous chapters focused on updating and upgrading specific application packages, not the system core. No matter whether (automatically) the process was triggered by the distribution maintainers or (manually) by users themself to suit their needs. In this chapter however, we will deal with the distribution itself (the core). As time goes by, developers and maintainers publish improved versions and associated "reliability".
- Long Term System (LTS) versions have been thoroughly tested. They are supported for a long period (up to 10 years). LTS are recommended to be deployed in big institutions.
- Intermediary versions are for the daring ones who stay on the edge. Every 6 months midterm upgrades are released that are more or less stable.
I myself only install LTS core versions on my personal devices.
As mentioned before, I have been working on Kubuntu - not the naked ubuntu versions - since I transitioned to linux. My investigations are focused on my needs and may be partially applicable to other ubuntu flavors. I will not discuss those issues in depth.
General Documentation:
Available Ubuntu Releases ubuntu.com: Releases
Stable Ubuntu Releases Updates ubuntu.com: StableReleaseUpdates
Kubuntu download site kubuntu.org: getkubuntu/
-
Upgrade from previous (LTS) version
Documentation sources: Ubuntu:
How to Update A general overview in German about upgrading Ubuntu versions. (Note: ubuntuusers: updates (English) seems to host a dangerous file according to my security guide).
⇒ ubuntuusers: Aktualisierungen
Upgrade notes Treat only the transitions from version 15.04 (LTS) to 18.04 (LTS), and 19.04 to 19.10
⇒ UpgradeNotes
Upgrade Docs Describes 2 upgrade methods:
-1- Command Line method according the so called "Ubuntu way"
-2- GUI method (available for (naked) Ubuntu, but not for KUbuntu)
⇒ howtogeek.com: how-to-upgrade-to-the-latest-version-of-ubuntu/
Describes 3 upgrade methods:
-1- the Ubuntu ways (1.1 Command Line, 1.2 GUI)
-2- the Debian way (Command Line).
⇒ ubuntu.com: Upgrades
Upgrade Ubuntu to 20.04
The article describes how to get to version 20.04 LTS from versions 18.04 LTS or 19.10 (last before 20.04), but can be easily transposed to later versions. The author focuses on the afore mentioned 2 command lines methods available (the Ubuntu way, the Debian way)
⇒ linuxconfig.org: how-to-upgrade-ubuntu-to-20-04-lts-focal-fossa
Documentation sources: How to upgrade kubuntu:
Noble Kubuntu Upgrade The advantage of the straightforward Upgrading Path is that the current configuration state of all user's packages remains unchanged. Still, it is highly recommended to backup those current data before starting the process.
Upgrading Ubuntu, using the command line, requires 3 processing steps.
-
[Step 1] update ubuntu:
- sudo apt update
- sudo apt upgrade
- sudo apt dist-upgrade
-
[Step 2] can be done according to 2 alternative methods.
-
[2-1] upgrade the ubuntu way (requires to install an additional package)
- sudo apt install update-manager-core
- sudo do-release-upgrade
Command do-release-upgrade behaves according to the Prompt value set in configuration file /etc/update-manager/release-upgrades
-
Prompt=lts (default value):
upgrade to the next Long Term System version, if available: -
Prompt=normal:
upgrade to the next following version, if available.
-
[2-2] ugrade the debian way
File /etc/apt/sources.list must be manually changed. The name of the current ubuntu version shall be overwritten by the name of the next following one. Upgrading can only "jump" to the next following version. If there are several intermediary versions between the current and the targeted version, the upgrade must be repeated for each intermediary version!
-
-
[Step 3] = [Step 1]
It must be noted that "naked" Ubuntu (not Kubuntu) provides a GUI updater called Software & Updates - which supposedly is a kind of front end for the "ubuntu way" described afore in [Step 2-1].
-
-
Installing a version "from the scratch" is neater and may be unavoidable, if the upgrade program fails. This was the case on my computer for the transition between LTS 22.04.01 and LTS 24.04.01 (August 2024). (One package does not download properly due to some obscure signature mismatch. Whether this package has been compromised? The installer will interrupt the upgrade process as long as I cannot solve the signature problem - which may be a tedious undertaking.)
Documentation sources: How to install (k)ubuntu (from the scratch):
Kubuntu download sites ⇒ kubuntu.org: Download iso + release notes
⇒ kubuntu.org: getkubuntu files incl. checksums
⇒ computer base: kubuntu Download
⇒ chip.de: kubuntu Download
Verify downloaded iso image General information applies for any downloaded files associated with checksum data
⇒ ubuntu tutorial: Verify iso file
Install steps Tutorial explaining in detail the steps toward installtion with a iso file for ubuntu (It also applies for kubuntu iso file.)
⇒ ubuntu tutorial: Install iso file
-
Download the ISO file of the targeted version
-
Dump it into a USB data stick using for example command lines dd or ddrescue.
(See for example linuxconfig.org: use dd to make a bootable usb stick.)As an example I wrote following commands to prepare a USB installation stick for LTS 24.04.01:
- lsblk -e7 (make sure the USB stick is plugged in and check with which /dev/sdX it is associated)
- sudo dd bs=4M if=/path/to/file.iso of=/dev/sdX status=progress oflag=sync
-
Connect the USB stick to the computer and restart. The boot process should activate the ISO version stored into the data stick and trigger the installation process.
-
Follow the instructions and answer the questions to properly configure the system.
Again, all previous user specific data - manually installed programs, configurations, user data - are lost after installing from the scratch!
-
-
-
Checking Installed Linux Kernels
- and removing selected old ones.Linux distributions do not automatically delete old Linux Kernels when new ones are installed and activated. This is the responsibility of the user (system maintainer) to remove obsolete versions - lest the /boot folder run out of space - which may eventually lead to a new kernel installation failing - with unpredictable consequences. There are different methods available, depending on the installed Linux distribution. I will only discuss those that I deem relevant on my system - currently K(Ubuntu).
Sources: More pieces of information can be for example gathered from following sites:
-
OSTECHNIX: How To List Or Check Installed Linux Kernels
-
OSTECHNIX: Remove unused Linux kernels
-
Wiki Ubuntu: Kernel
-
Ubuntu: Kernel
-
List kernel files, which are (most probably) stored in the /boot folder:
ls -l /boot/vmli*
As I write those lines, my system displays following answer:
/boot/vmlinuz
/boot/vmlinuz-6.8.0-55-generic
/boot/vmlinuz-6.8.0-56-generic
/boot/vmlinuz.old
In this case, two (2) kernels, 6.8.0-55 (old) and 6.8.0-56 (current) are installed - and respective links - which amounts to four (4) files.As an alternative to the "list" command ls, one can also use the "find" command
find /boot/vmli* or
find /boot -name "vmlinuz"
To get an even more reliable information, one can type find /boot -name "vmlinuz"-exec file {} /;
Command file applied to each entry matching pattern "vmlinuz" make sure that the identified pattern matching files are indeed kernel files. -
List the kernel packages managed by the dpkg command: dpkg --list | grep linux-image
Interestingly enough, my identical system displays now following output:
rc linux-image-6.8.0-54-generic 6.8.0-54.56 amd64 Signed kernel image generic
ii linux-image-6.8.0-55-generic 6.8.0-55.57 amd64 Signed kernel image generic
ii linux-image-6.8.0-56-generic 6.8.0-56.58+1 amd64 Signed kernel image generic
ii linux-image-generic 6.8.0-56.58 amd64 Generic Linux kernel image
images 6.8.0-55 and 6.8.0.56 have status ii: first i = desired state-installed-, second i = current state-installed-.
Image 6.8.0.54 has status rc: r= desired state-removed-, c=current state-configuration files still around. -
To view the current kernel only, type following command line: uname -mrs
My system displays the expected output:
Linux 6.8.0-56-generic x86_64
Option s: the OS system = Linux
Option m: the Hardware Architecture = x86_64
Option r: the Kernel Version = 6.8.0-56. The latest kernel version is the currently active one.
To completely remove linux-image-6.8.0-54-generic - including the configuration files -, one may type following command:
sudo apt-get purge linux-image-6.8.0-54-generic
Listing again the Linux kernels with command dpkg, my system displays the following output:
ii linux-image-6.8.0-55-generic 6.8.0-55.57 amd64 Signed kernel image generic
ii linux-image-6.8.0-56-generic 6.8.0-56.58+1 amd64 Signed kernel image generic
ii linux-image-generic 6.8.0-56.58 amd64 Generic Linux kernel image
-
OSTECHNIX: How To List Or Check Installed Linux Kernels
-
-
Description of the problem
Date: January 2024
Keywords: failed installation of the Linux kernel version 6.5.0.14-generic on Ubuntu 22.04
Status: work around, solution postponed.I ran several times into similar problems: A new linux kernel has been installed. Afterwards, the system cannot boot anymore!
After some trials - including successfully booting from a recovery stick - I figured out that the culprit is the broken installation of 6.5.0.14-generic: Booting with the previous installed version, 6.2.0.39-generic, works fine.
Analysis toward a solution
Linux kernel files are stored into a relatively small disk storage space (dir /boot) that can only encompass a given number of kernel versions. However, the system does not seem to check against storage shortage: If the superuser does not manually remove older kernel versions, the system will invariably end up running out of space. If this happens, the latest installed kernel may be incomplete. The steps to accomplish are following:
- Remove older versions of the linux kernel to secure more space - see also OSTECHNIX: How to remove old unused Linux kernels
- Reinstall the latest Kernel version
Here are commands that perform associated tasks, showcased in the situation described above.
Command line Explanation dkms status lists some installed Linux kernel versions.
Rem.: I do not exactly know what this command is supposed to show. It will require more time to figure it out. For the time being, I will defer using the dkms utility line of actions for a later study.
dpkg --list | grep linux-image outputs the list of all installed kernels. In the first column of output data -
ii stands for "installed, and successfully installed/configured"
-
rc indicates that "the package has been removed, but its configuration files are still present" - meaning that the package has been "removed but not purged, enabling a potential future reinstallation".
apt autoremove --purge This command line should always be the first attempt: it removes all installed packages that were installed as dependencies but are no longer needed.
However, this does not achieve much because "rc" packages are not considered "dependencies" and consequently do not fall into the categories "auto" or "orphans".
uname -r checks the correct Linux kernel version. In the current case: 6.2.0.39-generic. sudo apt-get purge linux-image-x1.x2.x3-x4-generic removes unnecessary images linux-image-x1.x2.x3-x4-generic (x1.x2.x3-x4 is its version number).
In the current situation, I removed a lot of obsolete configurations.
Some examples are linux-image-5.11.0-27-generic, linux-image-5.13.0-30-generic, linux-image-5.13.0-35-generic,...; linux-image-5.15.0-41-generic, linux-image-5.15.0-43-generic, linux-image-5.15.0-46-generic,..., linux-image-5.19.0-32-generic, linux-image-5.19.0-35-generic, linux-image-5.19.0-38-generic,..., linux-image-6.2.0-26-generic,..., linux-image-6.2.0-35-generic,I checked the result using command line dpkg -l | grep linux-image again.
In the current case, the final list still includes linux-image-6.5.0-14-generic that is presumably corrupted - and must therefore be reinstalled.sudo apt-get install --reinstall linux-image-x1.x2.x3-x4-generic reinstalls linux kernel version x1-x2.x3-x4. In our current case 6.5.0-14.
Unfortunately, this version cannot be reinstalled without throwing errors, even though enough storage has now been freed . (Use command line df -H to verify that enough space is available in /boot).
A short look online shows that there are multiple issues regarding the installation of 6.5.0-14 on ubuntu 22.04. Therefore, I uninstalled the faulty version for now and reinstalled 6.2.0-39 instead, to ensure that it has not been impaired in the process.
sudo update-grub The boot loader must be informed about the changes: 6.2.0-39 will be selected in the booting process. Summary:
The naked fact was that the newest Linux kernel does not work. The assumption was that directory /root does not provide enough space for additional files. However, freeing space did not provide a valid solution. Independent reports online confirm failed installations of Linux kernel version 6.5.0-14 on the same ubuntu system. Instead of re-installing the malfunctioning Linux kernel, I had to drop it. Temporarily? -
Install VLC
Date: January 2024
Focus: install VLC version 3.0.20
Status: solution postponed.Installation of updates of the video program tool VLC is a bit complicated. On my system, there are three (3) ways to achieve the task. Each one proposing a different "latest available version".
- According to the debian concept, one can use at least command line apt-get or command line dpkg to update "debian" registered packages. Currently, the newest version is 3.0.16.
- Use the snap packaging system. Currently, the newest version is 3.0.19.
- Download the "actual" latest version of the software directly from the (German) download website Download VLC: a tgz-archive. Because I am registered for the VLC Newsletters, I receive an e-mail notification, when the newest available version is ready (in this case 3.0.20.
The first two (2) install procedures are also linked to the GUI Discover, available in Ubuntu, that aims at simplifying package management for those users who refrain from tipping into the command line.
Unfortunately, I cannot directly install vlc from the downloaded tgz archive. There does not seem to be a vlc directory on my system of which contents would fit the directory of the downloaded archive vlc-3.0.20 - like it is for example the case with FileZilla client.
Summary:
I will have to wait until the latest version becomes also available on the snap platform.
-