Tag: BlackArch / Arch Linux

Swap file and swap partition in Arch Linux (BlackArch): what to choose and how to add Swap

RAM, along with the central processor, is a determining factor in the performance of a computer. Moreover, the speed (frequency) of RAM is not so important, how important is its quantity – the amount of RAM.

The computer starts to work much slower if it does not have enough RAM. Moreover, if it has a swap partition, then it can copy some information from RAM to it and then read it – this reduces performance, but at least does not lead to a reset of running tasks and a computer freeze.

So, if the performance of your computer drops due to a lack of RAM, then I would recommend upgrading the hardware first, that is, buying more RAM sticks. But this is not always possible. Or, in addition to buying hardware RAM, you can add another swap partition.

What is Swap

Swap is a place in permanent storage (hard disk, SSD, USB storage) to which part of the RAM is temporarily dumped, which:

a) not currently used in calculations

b) does not fit in physical RAM.

What is the difference between swap partition and swap file

So, we have decided that the swap partition and swap file in Linux is called Swap.

Now let's look at the two available options: partition and swap file.

Swap partition

A swap partition is a dedicated disk space, a separate volume that is created when partitioning a disk during installation of an operating system.

If you want to create a swap partition after installing the operating system, for example, as follows: reduce the volume of one of the partitions, and create a Swap partition on the freed space, then most likely you will not be able to do this “hot”, that is, during operation this same operating system. You will have to boot from a USB stick or optical disc and perform the necessary operations from it.

Swap file

A swap file performs the same functions as a partition, but is more convenient to use.

The convenience of using the swap file is expressed as follows:

a) the swap file is created as a regular file, that is, there is no need to partition the disk

b) to connect the swap file, you do not need to restart the operating system

c) to change the size of the swap file, you do not need to restart the operating system

d) to disable and delete the swap file, you do not need to restart the computer

That is, the situation is quite real when you need a swap file for a short time – for example, for an hour. You can create it, connect it, perform a task that requires a significant amount of RAM, and disable and delete it after. This is especially true if you have, for example, a fast, but not large SSD drive – and you don't want to constantly keep the swap file, especially if it is not particularly needed most of the time.

Another option with a paging file is convenient on VPS hosting, when unnecessary server downtime due to maintenance is not needed, and the impossibility of physical access requires contacting the support service.

How to display information about the swap file in Linux

To check if the swap file is present, what size it is and how much it is being used, run the command:

swapon --show

Either the command:

free -h

How to create a swap file in Arch Linux

All subsequent commands must be run with root user privileges.

To create a sSwap file, run the fallocate command, along with which you need to specify the size of the swap file to be created. You can use abbreviations (M = megabytes, G = gigabytes). For example, to create a 16 GB swap file located at the /swapfile path, you need to run the command:

sudo fallocate -l 16G /swapfile

The fallocate command can cause problems with some file systems such as F2FS or XFS. A more reliable, though slower, alternative is to use the dd command (this example will create a 512 megabyte file):

dd if=/dev/zero of=/swapfile bs=1M count=512 status=progress

Set file permissions (readable swap is a huge local vulnerability):

sudo chmod 600 /swapfile

Format the file in swap:

sudo mkswap /swapfile

Activate the swap file:

sudo swapon /swapfile

Please note that already at this stage the swap file starts to be used – no system reboot is required!

To ensure that the swap file is used after each reboot, open the /etc/fstab file.

In GUI:

sudo gedit /etc/fstab

In the command line interface:

sudo vim /etc/fstab

And add this line to this file:

/swapfile none swap defaults 0 0

Note: The swap file must be specified by its location in the file system, not by its UUID or LABEL.

Removing the Swap file

To remove the swap file, you must first disable it, and then it can be deleted:

sudo swapoff -a
sudo rm -f /swapfile

Finally remove the relevant line from /etc/fstab.

How to check Swap File usage in Linux

Stress testing the system in a out of RAM Scenario: How to check Swap file usage in Linux

How to download a package without installation in Arch Linux and Manjaro. How to download the AUR package source code

How to download a package with pacman (from standard repositories)

To download a package without installing it, use the -w option:

sudo pacman -Sw PACKAGE

By default, the package will be downloaded to pacman's package cache directory, with the --cachedir option you can specify any other directory to save the package to:

sudo pacman -Sw --cachedir DIRECTORY PACKAGE

For example, the following command will download the iw package installation file to the current directory (--cachedir .):

sudo pacman -Sw --cachedir . iw

How to download an installation package and source code from the AUR

See also:

Packages from the Arch User Repository (AUR) are not so simple, since there are no ready-made installation packages in the AUR. Instead of installation packages, the AUR necessarily contains PKGBUILD files, which contain commands for building the package to be installed. In addition to the PKGBUILD file, other necessary files may also be present, such as patches for modifying the source code. Source code files and binaries are usually absent from the AUR repositories, instead, links and commands for downloading all necessary files and source code are written in the PKGBUILD file.

Therefore, there may be several options for downloading AUR packages:

  • package repository (PKGBUILD file and other related files)
  • all files needed to build the package (source code files and other files downloaded in PKGBUILD)
  • a ready-to-install package that is not available elsewhere and is built directly on the user's computer

Let's consider all these situations.

How to download the AUR repository

To download (clone) a repository from the AUR, you need to know its URL. The repository address can be viewed with a command like:

pikaur-Si PACKAGE

For example:

pikaur -Si deadbeef-git

In the output of the previous command, notice the line “AUR Git URL”:

AUR Git URL     : https://aur.archlinux.org/deadbeef-git.git

To download (clone) use the following command:

git clone AUR_GIT_URL

For example:

git clone https://aur.archlinux.org/deadbeef-git.git

How to download AUR source code

Consider the following problem:

I need to change the source code in the program (meaning not the PKGBUILD file). How to download source files and unzip them?

To download the source code, you need to start by cloning the AUR repository, for this you need to know its URL. The repository address can be viewed with a command like:

pikaur-Si PACKAGE

For example:

pikaur -Si deadbeef-git

In the output of the previous command, notice the line “AUR Git URL”:

AUR Git URL     : https://aur.archlinux.org/deadbeef-git.git

To download (clone) use the following command:

git clone AUR_GIT_URL

For example:

git clone https://aur.archlinux.org/deadbeef-git.git

Go to the folder with the downloaded repository

cd deadbeef-git/

To download and extract files, use the following command:

makepkg -o

If you want to skip dependency checking, then add the -d option:

makepkg -od

The result of the previous commands will be to download the source code files needed to build the setup file from the AUR.

You can edit the files to suit your needs, and then build the installation file and install the package from it with the following command:

makepkg -si

If, as a result of your actions, the package cannot be built due to a checksum mismatch, then use the following options:

  --nocheck        Do not run the check() function in the PKGBUILD
  --skipchecksums  Do not verify checksums of the source files
  --skipinteg      Do not perform any verification checks on source files
  --skippgpcheck   Do not verify source files with PGP signatures

How to download the installation file from the AUR

As mentioned above, this is a slightly incorrect formulation of the problem, since the installation files are missing in the AUR.

To get the installation file, use the following set of commands:

git clone AUR_GIT_URL
cd PACKAGE_DIRECTORY
makepkg -s

For example, downloading the source code, compiling the program, and building the installation package for deadbeef-git:

git clone https://aur.archlinux.org/deadbeef-git.git
cd deadbeef-git/
makepkg -s

The command completed without errors:

As a result of the command, a file with the *.pkg.tar.zst extension was created (in this case, it is deadbeef-git-r10944.4469d86c7-1-x86_64.pkg.tar.zst):

How to update the systemd-boot loader in /boot

Update /boot

During the installation of Arch Linux on modern computers with UEFI (BIOS replacement), we create a small partition on the disk with a mount point in /boot into which we install the boot loader using bootctl. This bootloader is systemd-boot, which is part of systemd. Over time, systemd can be updated like any other Arch Linux package. This does not automatically update the loader in /boot. For this reason, if you have been using the same Arch Linux installation for a long time, then your boot loader in /boot may be out of date.

This article will show you how to view version and supported features, and how to update systemd-boot in /boot on Arch Linux (as well as BlackArch and Manjaro).

What is systemd-boot

systemd-boot (short for sd-boot) is a simple UEFI boot manager. It provides a graphical menu for selecting an entry to boot and a kernel command line editor. Systemd-boot only supports systems with UEFI firmware.

systemd-boot loads boot record information from the EFI system partition (ESP), usually mounted in /efi/, /boot/, or /boot/efi/ during OS startup, and from an extended bootloader partition if it exists (usually mounted in /boot/). Fragments of the configuration file, kernels, initrds, and other EFI images to boot should usually reside on an ESP or extended boot loader partition. Linux kernels must be built with CONFIG_EFI_STUB so that they can be directly run as an EFI image. At boot time, systemd-boot automatically collects a list of boot records from the following sources:

  • Boot entries defined using the loader specification descriptor files located in /loader/entries/ on ESP and in the advanced loader section. They usually describe Linux kernel images with associated initrd images, but can also describe arbitrary other EFI binaries.
  • Unified kernel images as per bootloader specification as EFI executable binaries in /EFI/Linux/ on ESP and in the extended bootloader section.
  • Microsoft Windows EFI Boot Manager, if installed.
  • Apple MacOS X Boot Manager, if installed.
  • EFI Shell binary, if installed
  • Reboot to the option UEFI Firmware Configuration, if supported.

systemd-boot supports the following features:

  • Major changes to the boot manager configuration (such as setting a timeout, choosing a default boot record, etc.) can be made directly from the boot loader UI at boot time as well as at run time with EFI variables.
  • The boot manager integrates with the systemctl command to implement features such as systemctl reboot --boot-loader-entry=… (to reboot to a specific boot menu item, eg “reboot to Windows”) and systemctl reboot --boot-loader-menu=… (to reboot in the bootloader menu) by implementing the bootloader interface.
  • The EFI variable, set by the bootloader, tells the OS about the ESP used at boot time. It is then used to automatically mount the correct ESP partition in /efi/ or /boot/ while the OS is running.
  • The Boot Manager provides information about the boot time taken by the UEFI firmware using the Boot Loader Interface. This information can be displayed using systemd-analyze
  • Boot Manager implements load counting and automatic rollback to older workload records in case of failure.
  • The boot manager additionally reads a random seed from the ESP, concatenates it with the “system token” stored in the constant EFI variable, and extracts a random seed for the OS to use as an initialization of the entropy pool, providing a full pool of entropy during early boot.

How to update the bootloader in /boot

The bootctl program can check EFI firmware and bootloader status, list and manage available bootloaders and bootloader entries, and install, update, or remove systemd-boot on the current system.

To check if your system uses systemd-boot, run the command:

bootctl is-installed

To check the current version of the bootloader and see other information about it, run the following command:

bootctl

You will see something like the following:

Pay attention to the Product line - it contains the version, in the screenshot it is 249.5-3.

Also look at the Features list - if you installed your system a long time ago, then some features may be disabled - an update will fix this.

For example, the Features list in the screenshot:

               ✓ Boot counting
               ✓ Menu timeout control
               ✓ One-shot menu timeout control
               ✓ Default entry control
               ✓ One-shot entry control
               ✓ Support for XBOOTLDR partition
               ✓ Support for passing random seed to OS
               ✗ Load drop-in drivers
               ✓ Boot loader sets ESP information

Most of the list is marked with green checkmarks (), but one item (in your case, these may be other items) is marked with a red cross (). This means that systemd supports all of the listed functions, including those marked with a cross, but the currently installed bootloader does not support what is marked with a cross. In order for the bootloader to start supporting the entire list, it needs to be updated.

Using the command

pacman -Ss systemd

you can see the current version of the systemd package. In the screenshot, it is 250-1. That is, you can upgrade to a newer version.

To check the current version of systemd, you may prefer the following command:

pacman -Si systemd

Updating the systemd-boot loader in /boot is performed with the following command:

sudo bootctl update

You need to restart your computer for the changes to take effect.

Chromium will no longer sync passwords - what should Linux users do?

Chrome and Chromium on Linux

Everyone knows the Google Chrome web browser. Chromium is at its core. That is, Chromium is the open source web browser that Google builds on the Chrome web browser, adding proprietary (i.e. closed) code to it.

The Chrome browser is distributed by Google itself as compiled files. The Chromium browser is available as open source. For this reason, Chrome is popular among Windows users - most Windows users install binaries compiled by the authors on their system and do not see anything strange in this.

It's a little different on Linux. Linux users also download and install compiled packages, but compilation is done by the distribution maintainers using the source code of the programs. This is in line with the spirit of Linux and its licenses. Closed source packages are placed in separate repositories (package sources for installation).

For this reason, it is Chromium that is prevalent among Linux users, and Chrome is often absent from the repositories. But until recently, browsers were almost identical, so you could use Chromium just like Chrome.

The Chrome/Chromium web browser makes extensive use of Google's APIs. These APIs include, for example, password and bookmark synchronization. But Google announced that from March 2021, some APIs will be available only in the Chrome web browser, but will be disabled in Chromium, as well as in all third-party browsers that use Chromium as their basis. Disabled APIs include password synchronization.

I don't mind third-party web browsers - just imagine that if you log into your Google account on a third-party browser, thanks to the password synchronization function, it gets access to all (!) your passwords on all (!) websites. Many untrustworthy Chromium-based web browsers have sprung up about the creators of which cannot be found and whose source code is not published (sometimes despite their assurances).

But what's really annoying is that important functions will no longer work in Chromium too. From a full-fledged alternative to Chrome, Chromium has now become a web browser with limited functions.

If you don't use password sync, then you have nothing to worry about

Despite the anger of the maintainers of some distributions and threats to stop supporting or even kick the web browser out of the repositories, apparently no one will do it. Therefore, if you do not need the function of synchronizing passwords and bookmarks, then you can safely continue using Chromium on Linux.

But what about Linux users who use Chromium and need password sync and other features? Let's consider several options.

1. Stop using the password sync feature in web browsers

Yes, the fact that all your passwords are stored by strangers is bad, to put it mildly. But it's super convenient if you have more than one device (computer, phone, tablet, second computer, more virtual computers…). But if you think about it, it's like giving the keys to your apartment to an outsider, so that when you appear, he opens and closes the door to your apartment, and you don't have to climb into your pockets for keys. Conveniently. But you have no idea what happens to your keys while you are away.

Therefore, one option is to continue using Chromium, but stop using the password sync feature.

2. Switch to Firefox

Firefox is open source and also has a password sync feature. If you want to show Google that you are not satisfied with this change, you can switch to Firefox. Just in case - if your passwords are synchronized using Firefox, then it is no better or worse than if they are stored by Google.

3. Install Chrome on Linux

In fact, installing Chrome from Google itself on Linux is trivial. So you can go the same route that most Windows users do - just install a web browser with proprietary code.

In Debian, Linux Mint, Ubuntu, Kali Linux and their derivatives, to install Google Chrome, just run the commands:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i ./google-chrome-stable_current_amd64.deb
sudo apt install -f

That's all! At the same time, during the installation of the web browser, the Google repository will be added to the list of repositories and Chrome will be updated along with the rest of the packages in the system.

In Arch Linux, Manjaro, BlackArch and their derivatives, to install Google Chrome, just run the command:

pikaur -S google-chrome

If you have not yet installed pikaur, then install it according to the instructions “Automatic installation and update of AUR packages”.

To update a web browser package, you will need to run a system update using pikaur - this command is to update both packages from the system repositories and from the AUR:

pikaur -Syu

4. Extensions for synchronization with encryption (Bitwarden)

You can install an extension like Bitwarden and continue using Chromium.

Bitwarden uses end-to-end encryption, meaning passwords are synchronized encrypted. Moreover, the source code is open even for the server, that is, you can synchronize without any third-party participants at all.

Bitwarden works with almost any device and browser you can think of: Windows, Mac, Linux; iOS and Android; Chrome, Firefox, Safari, Edge and many other niche browsers. This gives you freedom of movement, unlike browser password managers.

Conclusion

Which option did you choose or, perhaps, made some other decision?

pacman error “warning: failed to retrieve some files” (SOLVED)

This article focuses on errors that occur due to problems with the mirror list.

pacman error “The requested URL returned error: 404”

There is a cache for the package manager to work - this cache contains information about existing packages for installation, their versions and download links. To update (or download for the first time) this cache, you need to run the command:

sudo pacman -Sy

Then you can perform a system update or package update.

If the cache is out of date and you are trying to install a package whose version has been updated and for which there is an old link in your local cache, you may receive an error similar to the following:

error: failed retrieving file 'goaccess-1.4.5-1-x86_64.pkg.tar.zst' from mirrors.evowise.com : The requested URL returned error: 404

To fix it, you need to run the above command, and then repeat the installation.

But a similar problem can occur when starting a system update - this is strange, since the following command starts with updating the cache, therefore, the cache is the newest and the “file not found” error should not occur:

sudo pacman -Syu

This command resulted in an error:

error: failed retrieving file 'goaccess-1.4.5-1-x86_64.pkg.tar.zst' from mirrors.evowise.com : The requested URL returned error: 404
error: failed retrieving file 'goaccess-1.4.5-1-x86_64.pkg.tar.zst' from mirror.rackspace.com : The requested URL returned error: 404
error: failed retrieving file 'goaccess-1.4.5-1-x86_64.pkg.tar.zst' from mirror.rackspace.com : The requested URL returned error: 404
error: failed retrieving file 'goaccess-1.4.5-1-x86_64.pkg.tar.zst' from mirror.dkm.cz : The requested URL returned error: 404
error: failed retrieving file 'goaccess-1.4.5-1-x86_64.pkg.tar.zst' from mirror.dkm.cz : The requested URL returned error: 404
error: failed retrieving file 'goaccess-1.4.5-1-x86_64.pkg.tar.zst' from europe.mirror.pkgbuild.com : The requested URL returned error: 404
....................................................................
....................................................................
....................................................................
warning: failed to retrieve some files
error: failed to commit transaction (failed to retrieve some files)
Errors occurred, no packages were upgraded.

Repeating the command many times does not change anything.

The reason is this: pacman is downloading the cache from a bad mirror that contains incorrect information. To fix it, you need to select another mirror, or move another mirror to the top of the list if you are using multiple mirrors.

Let's start by switching to a new list of mirrors. The fact is that when installing the pacman-mirrorlist package (this package contains a list of mirrors), the new /etc/pacman.d/mirrorlist file does not replace the existing one, but is saved under the name /etc/pacman.d/mirrorlist.pacnew. That is, even if you have the latest version of the pacman-mirrorlist package, this does not mean that you have an up-to-date version of the /etc/pacman.d/mirrorlist file. Check if the /etc/pacman.d/mirrorlist.pacnew file exists:

ls -l /etc/pacman.d/mirrorlist.pacnew

If the file exists, then run the following two commands (otherwise, skip them):

sudo mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.back
sudo mv /etc/pacman.d/mirrorlist.pacnew /etc/pacman.d/mirrorlist

This is not all - the point is that in the /etc/pacman.d/mirrorlist file, by default, all mirrors are commented out, that is, disabled. To fix this, open this file:

sudo gedit /etc/pacman.d/mirrorlist

and uncomment, that is, remove the # character at the beginning of the line. Choose those mirrors and countries that are closer to you.

In my case, the problematic mirror that caused the error described above was the following (do not use it):

#Server = http://mirrors.evowise.com/archlinux/$repo/os/$arch

Arch Linux has stopped updating

If you run the command “sudo pacman -Syu” every day, you may have noticed that on rare days there are no updates. If your system suddenly stopped receiving updates for several days, this may mean that the package cache is being downloaded from a low-quality mirror.

To fix - follow exactly the same steps as described for the previous error. That is, you need to switch to another mirror.

error: failed to update core (no servers configured for repository)

Another possible error after you have done any work with the list of installation package mirrors:

:: Synchronizing package databases...
error: failed to update core (no servers configured for repository)
error: failed to update extra (no servers configured for repository)
error: failed to update community (no servers configured for repository)
error: failed to update multilib (no servers configured for repository)
error: failed to synchronize all databases

The reason for this is that all lines in the /etc/pacman.d/mirrorlist file are commented out. Open this file:

sudo gedit /etc/pacman.d/mirrorlist

and uncomment, that is, remove the # symbol at the beginning of the line for those mirrors and countries that are closer to you.

Error “Cannot load modules/libphp7.so” (SOLVED)

Some Linux distributions have already started migrating to PHP 8. In some distributions the new version of PHP removes the old one, as a result of which the web server may stop working due to the fact that the files specified in the web server configuration are missing or renamed.

Examples of errors you may encounter:

httpd: Syntax error on line 504 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf/mods-enabled/php.conf: Cannot load modules/libphp7.so into server: /etc/httpd/modules/libphp7.so: cannot open shared object file: No such file or directory

It says the file /etc/httpd/modules/libphp7.so was not found.

Another error that says the /etc/httpd/conf/extra/php7_module.conf file was not found:

httpd: Syntax error on line 504 of /etc/httpd/conf/httpd.conf: Syntax error on line 2 of /etc/httpd/conf/mods-enabled/php.conf: Could not open configuration file /etc/httpd/conf/extra/php7_module.conf: No such file or directory

On some distributions, the Apache web server service is called apache2, and on some httpd. Therefore, this guide will consider both options.

Fix “Cannot load modules/libphp7.so” when webserver service is named httpd (Arch Linux, CentOS and their derivatives)

To view the status of the service and the errors that led to its inoperability, run the command:

systemctl status httpd.service

Open the config file /etc/httpd/conf/mods-enabled/php.conf:

sudo vim /etc/httpd/conf/mods-enabled/php.conf

Find the line in it

LoadModule php7_module modules/libphp7.so

and replace it with:

LoadModule php_module modules/libphp.so

Then find the line

Include conf/extra/php7_module.conf

and replace with:

Include conf/extra/php_module.conf

Restart the web server service:

sudo systemctl restart httpd.service

and check its status:

systemctl status httpd.service

Fix “Cannot load modules/libphp7.so” when webserver service is named apache2 (Debian, Ubuntu, Linux Mint, Kali Linux and their derivatives)

To view the status of the service and the errors that led to its inoperability, run the command:

systemctl status apache2.service

Disable PHP 7.* module:

a2dismod php7.4

Maybe you have a different version of PHP, start typing “a2dismod php” and use the TAB key for autocompletion:

To enable PHP 8 use a command like (use the TAB key for auto-completion):

a2enmod php8

Restart the web server service:

sudo systemctl restart apache2.service

and check its status:

systemctl status apache2.service

How to choose the default Java version in Arch Linux

Several versions of the JDK and OpenJDK are available in the standard Arch Linux repositories (and derivative distributions). You can install one or more of them. Even if you have the latest version installed, some programs may install a different version of the JDK as their dependency - multiple versions are allowed, they do not cause conflicts.

After that, you can see which of these versions is used by default, and also change it using the archlinux-java program.

Usage:

archlinux-java <COMMAND>

As a COMMAND it can be:

	status		List installed Java environments and enabled one
	get		Return the short name of the Java environment set as default
	set <JAVA_ENV>	Force <JAVA_ENV> as default
	unset		Unset current default Java environment
	fix		Fix an invalid/broken default Java environment configuration

Start by viewing the status:

archlinux-java status

As you can see, I have two Java environments available

  • java-11-openjdk
  • java-14-openjdk

And no Java environment is selected as the default.

I set java-14-openjdk as my default environment:

sudo archlinux-java set java-14-openjdk

I check again:

archlinux-java status

As you can see, java-14-openjdk is now used - the word (default) indicates this.

Errors: command java, javac or javap not found

When trying to start one of the following programs, you may encounter errors:

java
bash: java: command not found
# OR
bash: /usr/bin/java: No such file or directory

javac
bash: javac: command not found
# OR
bash: /usr/bin/javac: No such file or directory

javap
bash: javap: command not found
# OR
bash: /usr/bin/javap: No such file or directory

If you have already installed the JDK, then you need to select the version that will be used by default. This can be done using archlinux-java as shown above. After that, the error will disappear.

How to find out which package contains a file

How to find out which package a file is in

Sometimes the name of the required utility does not coincide with the name of the package - this is especially the case when one package contains several programs. As a result, a problem arises - to find a package in which the required executable file or header file is present (if you received an error during compilation due to the absence of a specific file).

This article will help you by showing you how to search packages by filename. Moreover, for all packages at once - regardless of whether they are installed or not.

The pkgfile utility looks in the .files metadata generated by repo-add to get information about the files in the packages. By default, the specified target is assumed to be the filename and pkgfile will return packages containing that file. The repositories that pkgfile looks for are determined by those included in /etc/pacman.conf.

To install the program, run the command:

sudo pacman -S pkgfile

Update the saved metadata files.

sudo pkgfile --update

For example, I need to find out which package contains the file finger. Then I run the following command:

pkgfile finger

As you can see, pkgfile did a great job - the finger executable is in the netkit-bsd-finger package in the blackarch repository.

Using the -l, --list option, you can view the contents of any package:

pkgfile -l netkit-bsd-finger

The target is the package name, not the file name, and the contents of the specified package are returned. This allows the use of repo/package style syntax (eg, “core/pacman”) to limit the search range, but only when --list is used without the --glob or --regex options.

Matching heuristic

In --search mode and without the --regex or --glob option, pkgfile will try to match the supplied target as the exact filename. If the target contains a '/' character, then an attempt will be made to match the full path. With --regex and --glob search enabled, pkgfile will always match the full path.

In --list mode and without the --regex or --glob option, pkgfile will try to match the supplied target as the exact package name. If the target contains a '/' character, the text before the forward slash will be considered a repository and searches will be limited to that repository only.

All pkgfile options

Usage:

pkgfile [options] target

Options:

 Operations:
  -l, --list              list contents of a package
  -s, --search            search for packages containing the target (default)
  -u, --update            update repo files lists

 Matching:
  -b, --binaries          return only files contained in a bin dir
  -d, --directories       match directories in searches
  -g, --glob              enable matching with glob characters
  -i, --ignorecase        use case insensitive matching
  -R, --repo <repo>       search a singular repo
  -r, --regex             enable matching with regular expressions

 Output:
  -q, --quiet             output less when listing
  -v, --verbose           output more
  -w, --raw               disable output justification
  -0, --null              null terminate output

 Downloading:
  -z, --compress[=type]   compress downloaded repos

 General:
  -C, --config <file>     use an alternate config (default: /etc/pacman.conf)
  -D, --cachedir <dir>    use an alternate cachedir (default: /var/cache/pkgfile)
  -h, --help              display this help and exit
  -V, --version           display the version and exit

See also How to view package information in Arch Linux (BlackArch, Manjaro).

How to view package information in Arch Linux (BlackArch, Manjaro)

For each package in the system, you can find out such information as: version number, description, developer site, dependencies, recommended dependencies, packages with which there is a conflict, size, etc.

The commands described in this post work the same in Arch Linux, as well as all distributions based on it, such as BlackArch, Manjaro and others.

If you are interested in very brief information about the package - description, version number, and whether the package is installed, then you can use a command like this:

pacman -Ss PACKAGE-NAME

To display all available information about a package, use a command like:

pacman -Si PACKAGE_NAME

To view information about a package installed from the AUR, use a command like:

pikaur -Si PACKAGE NAME

For pikaur see the detailed article “Automatic installation and update of AUR packages”.

In addition to the usual information such as version, description, site address, dependencies, and more, the pikaur command will also show information typical of the AUR: ratings, popularity, when it was first presented, and so on.

So, using the -Si option and pacman or pikaur commands, you can display information about any package.

How to downgrade to a previous kernel in Arch Linux

New Linux kernels bring support for new hardware and new features. But sometimes the kernel causes problems: it is completely or partially incompatible with existing software, especially video drivers often suffer from this, but this can also apply to any other software.

A very recent example: NVIDIA drivers are partially incompatible with linux >= 5.9 at the time of writing. Although the graphics card works, CUDA, OpenCL and probably other functions are broken. Of course, someday this will be fixed, but what about those who need CUDA and OpenCL or other programs incompatible with the latest version of the Linux kernel?

One of the options is to roll back to the previous version by installing it from the downloaded package cache. The method is not the most pleasant, since you will need to prohibit updating the package, the version of which was rolled back, or even refuse to update the entire system.

This method is especially annoying when it comes to the linux kernel - you also need to do something with dependencies.

One of the easier options is to switch to the linux-lts kernel.

LTS - stands for Long Time Support. Simply put, it is the kernel and modules of Linux from one of the previous versions, which is rarely updated.

This kernel can be installed as a regular package, replacing the existing kernel. Depending on the configuration of your computer, you may need to install other *-lts packages, such as the nvidia-lts package, the NVIDIA video driver for the linux-lts kernel.

Also install linux-lts-headers.

After finalizing the kernel and fixing the problems that bother you, you can return to the latest version of the Linux kernel.

Loading...
X