Jump to content

Arch Linux: Difference between revisions

From 太極
Brb (talk | contribs)
Brb (talk | contribs)
 
(3 intermediate revisions by the same user not shown)
Line 66: Line 66:


<li>[https://wiki.archlinux.org/title/Creating_packages Creating packages]
<li>[https://wiki.archlinux.org/title/Creating_packages Creating packages]
<li>[https://fileinfo.com/extension/pkg.tar.zst How to open a PKG.TAR.ZST file]
<li>How to install a local package *.pkg.tar.zst or *.pacman file
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo pacman -U YourPackageName.pkg.tar.zst
sudo pacman -U YourPackageName.pkg.tar.zst
sudo pacman -U YourPackageName.pacman
</syntaxhighlight>
</syntaxhighlight>
</ul>
</ul>
Line 103: Line 104:
</pre>
</pre>
</ul>
</ul>
== Update all packages ==
It is recommended to run an update at least once a week.
<syntaxhighlight lang='sh'>
sudo pacman -Syu # Official repo packages
yay -Syu        # AUR packages, it will ask sudo password
</syntaxhighlight>
On Manjaro with Xfce, the package '''pamac-tray''' runs in the background. It automatically checks the Manjaro repos once per day by default. when updates are available, you get a desktop notification and the tray icon changes (usually with a number showing how many updates are pending).
== Check when you ran updates ==
<pre>
grep "starting full system upgrade" /var/log/pacman.log
</pre>
The command lists full system upgrades triggered by both '''pacman -Syu''' and '''yay -Syu'''.
The first line in the output shows the oldest package installation date - usually right after the OS install.


== pacman -Syyu ==
== pacman -Syyu ==
Line 144: Line 162:
<ul>
<ul>
<li>Manjaro linux maintains its own repository where new package pdates are released one or two weeks after they are made available in the official arch repo.  
<li>Manjaro linux maintains its own repository where new package pdates are released one or two weeks after they are made available in the official arch repo.  
* However, the Arch User Repository (AUR) is a separate entity and is not subject to the same delay.  
* However, the [https://aur.archlinux.org/ Arch User Repository (AUR)] is a separate entity and is not subject to the same delay.  
<li>yay is an AUR helper that depends on pacman. It uses pacman to manage and resolve dependencies for packages installed from the AUR. yay also uses the pacman configuration file (/etc/pacman.conf) and shares the local package database with pacman.
<li>yay is an AUR helper that depends on pacman. It uses pacman to manage and resolve dependencies for packages installed from the AUR. yay also uses the pacman '''configuration file (/etc/pacman.conf)''' and shares the local package database with pacman.
<li>htps://aur.archlinux.org/packages/yay, https://github.com/Jguer/yay
<li>htps://aur.archlinux.org/packages/yay, https://github.com/Jguer/yay
<li>[https://wiki.archlinux.org/title/AUR_helpers AUR helpers] which includes yay
<li>[https://wiki.archlinux.org/title/AUR_helpers AUR helpers] which includes yay
Line 152: Line 170:
<li>It reads the '''PKGBUILD''' script. The '''PKGBUILD''' script determines whether the application needs to be compiled from source on your machine or if a pre-compiled binary will be simply repackaged.
<li>It reads the '''PKGBUILD''' script. The '''PKGBUILD''' script determines whether the application needs to be compiled from source on your machine or if a pre-compiled binary will be simply repackaged.
* In the case of "positron", it downloads .deb package and repackage a pre-compiled binary for arch linux.
* In the case of "positron", it downloads .deb package and repackage a pre-compiled binary for arch linux.
<li>Example of install tabby
<li>Example <BR>
<pre>
Install a package (eg [https://aur.archlinux.org/packages?O=0&K=tabby tabby], [https://aur.archlinux.org/packages?O=0&K=termius termius], [https://aur.archlinux.org/packages?O=0&K=positron-ide-devel-bin Positron])
sudo pacman -S yay
<syntaxhighlight lang='r'>
sudo pacman -S --needed base-devel
sudo pacman -S yay # -S stands for *sync*
sudo pacman -S --needed base-devel # only install base-devel if it isn't already installed
yay -S tabby  # install the package. It worked after a while
</syntaxhighlight>


yay -S tabby # install the package. It worked after a while
Remove a package
<syntaxhighlight lang='r'>
yay -Rns package_name # delete a package with its configuration files and dependencies
                      # This is the clean removal most users prefer
                      # Alternative: sudo pacman -Rns package_name
yay -R package_name # remove the package. This is the safer, minimal removal
</syntaxhighlight>
Upgrade all
<syntaxhighlight lang='r'>
yay -Syu  # Upgrade all packages (repo + AUR packages)


yay -R package_name  # remove the package
yay -Rns package_name # delete a package with its dependencies
yay -Sua  # Upgrading (only) the AUR packages
yay -Sua  # Upgrading (only) the AUR packages
yay -Syu  # Upgrade all packages
</syntaxhighlight>
</pre>
</ul>
</ul>



Latest revision as of 09:16, 18 November 2025

Resource

Post installation

Arch Linux Post-Installation Essential Steps

Manjaro Hello

Welcome Screen

Chinese keyboard

  • Fcitx 5 + Rime
    • Ctrl + Space = toggle English and Chinese
    • In Chinese input, F4 然后用上下箭头选择所要使用的输入法
    • 似乎不需要用到 fcitx configuration gui
  • Maybe useful
    sudo pacman -S fcitx5-chinese-addons
    sudo pacman -S rime-bopomofo
    ls /usr/share/rime-data/
    cat /usr/share/rime-data/default.yaml
    
  • Rime. Rime is an input method engine for entering Chinese characters, supporting a wide range of input methods.
  • Manjaro安装fcitx5-rime与美化

Install/remove packages

How to Install and Remove Packages in Arch Linux

Pacman

  • https://wiki.archlinux.org/title/Pacman
  • http://unix.stackexchange.com/questions/6934/package-management-strategy-with-pacman
  • Install openssh: pacman -Sy openssh where "-S" is the same as "--sync", synchronize packages.
    sudo pacman -Sy openssh
    sudo systemctl enable sshd
    sudo systemctl start sshd
    ps -ef | grep sshd
    ip a
  • How to Update Arch Linux
    sudo pacman -Syu
    • "-S": Sync (install packages)
    • "-y": Refresh package database
    • "-u": Upgrade all packages to latest versions

    Note: "sudo pacman -Sy" updates the package database but does not upgrade any packages — this can cause partial upgrades, which Arch specifically warns against.

    # To update a specific package:
    sudo pacman -S package_name
    
    # To delete a package:
    sudo pacman -R package-name
  • The command pacman -Sy synchronizes the package list with the master server. This server/client model also allows the user to download/install packages with a simple command, complete with all required dependencies1. However, it is important to note that when installing packages in Arch, you should avoid refreshing the package list without upgrading the system (for example, when a package is no longer found in the official repositories). In practice, do not run pacman -Sy package_name instead of pacman -Syu package_name, as this could lead to dependency issues. See pacman.
  • Creating packages
  • How to install a local package *.pkg.tar.zst or *.pacman file
    sudo pacman -U YourPackageName.pkg.tar.zst
    sudo pacman -U YourPackageName.pacman

pacman command

  • https://wiki.archlinux.org/title/Pacman
  • https://wiki.archlinux.org/title/Pacman/Tips_and_tricks
  • cheat sheet
  • The Ultimate Guide to Pacman Commands on Arch Linux
  • Do we normally need to add sudo beforec running pacman?
    • Yes, you normally need to use sudo when running pacman commands that modify the system, such as installing, updating, or removing packages. This is because these actions require administrative privileges.
    • For example, to update your system using pacman, you would run the command sudo pacman -Syu. Similarly, to install a package, you would use the command sudo pacman -S package_name.
    • However, some pacman commands do not require administrative privileges and can be run without sudo. For example, you can use the pacman -Q command to view information about installed packages without using sudo.
  • To view a list of all explicitly installed packages (i.e., packages that were not installed as dependencies)
    pacman -Qe
    

    To view a list of all installed packages from the AUR, you can use the command pacman -Qm

  • display information such as the package version, description, dependencies, and more
    pacman -Qi r
    
  • display a list of all files installed by the package
    pacman -Ql r
    
  • How do I update packages installed by pacman?
    pacman -Syu
    

Update all packages

It is recommended to run an update at least once a week.

sudo pacman -Syu # Official repo packages
yay -Syu         # AUR packages, it will ask sudo password

On Manjaro with Xfce, the package pamac-tray runs in the background. It automatically checks the Manjaro repos once per day by default. when updates are available, you get a desktop notification and the tray icon changes (usually with a number showing how many updates are pending).

Check when you ran updates

grep "starting full system upgrade" /var/log/pacman.log

The command lists full system upgrades triggered by both pacman -Syu and yay -Syu.

The first line in the output shows the oldest package installation date - usually right after the OS install.

pacman -Syyu

  • The double yy forces a complete re-download of all package databases, even if they appear to be up-to-date locally. It essentially ignores the timestamps and just fetches fresh copies of everything.
  • When to use pacman -Syyu:
    • After changing your mirrorlist: If you've modified /etc/pacman.d/mirrorlist to use different mirrors, forcing a database refresh (-yy) ensures that pacman is using the package lists from your newly configured mirrors, not cached ones from the old mirrors.
    • When you suspect database corruption: If you're experiencing strange issues with pacman (e.g., packages not found, inconsistent updates), a forced refresh can sometimes resolve underlying database problems.
    • After an extended period without updates: If your system hasn't been updated for a very long time (e.g., several months), using -Syyu can be a safer approach to ensure all database information is completely fresh before a large upgrade.
  • pacman -Syu: The standard and recommended daily/frequent update. It's efficient and only downloads what's new.

error: GPGME error: No data

Package cache

How to Clean the Package Cache in Arch Linux

Install DEB packages

How to Install DEB Packages in Arch Linux

AUR

  • https://aur.archlinux.org/packages
  • Enabling AUR Support in Pamac (GUI):
    1. Open Add/Remove Software (Pamac).
    2. Click the three dots (or the "hamburger" menu) in the top right corner and select Preferences.
    3. Go to the Third Party tab.
    4. Enable AUR Support by toggling the switch.

yay

  • Manjaro linux maintains its own repository where new package pdates are released one or two weeks after they are made available in the official arch repo.
  • yay is an AUR helper that depends on pacman. It uses pacman to manage and resolve dependencies for packages installed from the AUR. yay also uses the pacman configuration file (/etc/pacman.conf) and shares the local package database with pacman.
  • htps://aur.archlinux.org/packages/yay, https://github.com/Jguer/yay
  • AUR helpers which includes yay
  • How to Install and Use yay on Arch Linux
  • yay builds packages as your user (non-root). You shouldn't run yay with sudo.
  • It reads the PKGBUILD script. The PKGBUILD script determines whether the application needs to be compiled from source on your machine or if a pre-compiled binary will be simply repackaged.
    • In the case of "positron", it downloads .deb package and repackage a pre-compiled binary for arch linux.
  • Example
    Install a package (eg tabby, termius, Positron)
    sudo pacman -S yay  # -S stands for *sync*
    sudo pacman -S --needed base-devel # only install base-devel if it isn't already installed
    yay -S tabby  # install the package. It worked after a while

    Remove a package

    yay -Rns package_name # delete a package with its configuration files and dependencies
                          # This is the clean removal most users prefer
                          # Alternative: sudo pacman -Rns package_name
    yay -R package_name  # remove the package. This is the safer, minimal removal

    Upgrade all

    yay -Syu  # Upgrade all packages (repo + AUR packages)
    
    yay -Sua  # Upgrading (only) the AUR packages

System update

$ grep installed /var/log/pacman.log
[2021-03-24T20:50:42-0400] [ALPM] installed xf86-video-vmware (13.3.0-2)
[2021-03-24T20:50:42-0400] [ALPM] installed linux510-virtualbox-guest-modules (6.1.18-18)
[2021-03-24T20:50:42-0400] [ALPM] installed virtualbox-guest-utils (6.1.18-2)
[2021-03-24T20:50:42-0400] [ALPM] installed libdnet (1.12-13)
[2021-03-24T20:50:42-0400] [ALPM] installed libmspack (1:0.10.1alpha-3)
[2021-03-24T20:50:42-0400] [ALPM] installed uriparser (0.9.4-1)
[2021-03-24T20:50:42-0400] [ALPM] installed gdk-pixbuf-xlib (2.40.2-1)
[2021-03-24T20:50:42-0400] [ALPM] installed open-vm-tools (6:11.2.5-2)
[2021-03-24T20:50:42-0400] [ALPM] installed xf86-input-vmmouse (13.1.0-5)
[2021-03-24T20:50:42-0400] [ALPM] installed spice-vdagent (0.21.0-1)
[2021-03-24T21:01:58-0400] [ALPM] installed r (4.0.4-1)
[2021-03-24T21:11:41-0400] [ALPM] installed tk (8.6.11.1-1)
...

# I update the whole system. R has been updated from 4.0.4 to 4.1.0

$ sudo pacman -Syu
$ grep "4.1.0" /var/log/pacman.log
[2021-07-31T11:54:02-0400] [ALPM] upgraded mpfr (4.1.0-1 -> 4.1.0-2)
[2021-07-31T11:55:33-0400] [ALPM] upgraded r (4.0.4-1 -> 4.1.0-1)

Other Arch-based linux distros

I Tested 9 Arch-Based Linux Distros, Here's How I Rank Them

Manjaro

EndeavourOS

Garuda Linux

SteamOS

5 Key Differences Between SteamOS and Arch Linux