No usable package repositories configured

How do i solve this problem please please! “no usable package repositories configured” it appears whenever i try running sudo pacman -Syu or yay -Syu

From terminal:
sudo pacman-mirrors -f && sudo pacman -Syyu

Did you edited the /etc/pacman.conf file by any chance?
Make sure you have this lines in it:

pacman.conf
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
CacheDir = /var/cache/pacman/pkg/
#LogFile     = /var/log/pacman.log
#GPGDir      = /etc/pacman.d/gnupg/
#HookDir     = /etc/pacman.d/hooks/
HoldPkg      = pacman glibc manjaro-system
# If upgrades are available for these packages they will be asked for first
SyncFirst    = manjaro-system archlinux-keyring manjaro-keyring
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta    = 0.7
Architecture = auto

#IgnorePkg   =
#IgnoreGroup =

#NoUpgrade   =
NoExtract = /usr/lib/security/pam_systemd_home.so

# Misc options
#UseSyslog
#Color
#TotalDownload
# We cannot check disk space from within a chroot environment
CheckSpace
#VerbosePkgLists

# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required

# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Manjaro Linux
# packagers with `pacman-key --populate archlinux manjaro`.

#
# REPOSITORIES
#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - local/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#   - URLs will have $repo replaced by the name of the current repo
#   - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.

[core]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

[extra]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

[community]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

[multilib]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

And run the above command.

2 Likes

I have never touch any of my configuration files plus pacman.conf file is missing . And am getting another error ‘pacman command not found’

That is not possible. You just stated this first:

So, what is the error? Both can’t be true.

Well, is a file that doesn’t get lost by itself, but if is missing, then for sure something really wrong happened on your install. What ISO did you used?

To fix the missing file, run this command:
sudo touch /etc/pacman.conf
then edit the file as Admin and append the lines i provided, save it and try again.

I,ve done that how about installing a package manager? I’ve tried installing pacman following the arch wiki but no progress still. This means that i cant install or update a package

How on Earth did you get rid of pacman in the first place?

just uninstalled it out of frustration. But i’ve managed a comeback and am now at this error " failed to initialize alpm library"

Did you delete libalpm as well? What’s in /var/log/pacman.log?

No i did not

By whatever reason you have lost significant files. You cannot provide helpful information to fix it. Backing up valuable data and re-installation is the most time and nerves saving pass forward. :wink:

2 Likes

Ooooh my!! Am completely finished. ok_man: So there is no workaround to this??

You could download pacman-static and use it to (re)install pacman:

$ wget https://pkgbuild.com/~eschwartz/repo/x86_64-extracted/pacman-static
$ chmod +x ./pacman-static
$ sudo ./pacman-static -S pacman
6 Likes

This is the error am getting after updating my file as explained above

sudo: pacman-mirrors: command not found
I hate that error and its quit frustrating because all other package managers are not working (pamac and yay) except for snap . I can’t install a package from the source because of dependency issues error. I feel like am walking on thread now waiting for everything to break so that i can start over. Manjaro is the best distro i’ve ever hoped to though

**warning: config file /etc/pacman.conf, line 20: directive ‘SyncFirst’ in section ‘options’ not recognized.strong text

why there is : after sudo ?
This is the default

/etc/pacman.conf
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
CacheDir = /var/cache/pacman/pkg/
#LogFile     = /var/log/pacman.log
#GPGDir      = /etc/pacman.d/gnupg/
#HookDir     = /etc/pacman.d/hooks/
HoldPkg      = pacman glibc manjaro-system
# If upgrades are available for these packages they will be asked for first
SyncFirst    = manjaro-system archlinux-keyring manjaro-keyring
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta    = 0.7
Architecture = auto

#IgnorePkg   =
#IgnoreGroup =

#NoUpgrade   =
#NoExtract   =

# Misc options
#UseSyslog
#Color
#TotalDownload
# We cannot check disk space from within a chroot environment
CheckSpace
#VerbosePkgLists

# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required

# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Manjaro Linux
# packagers with `pacman-key --populate archlinux manjaro`.

#
# REPOSITORIES
#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - local/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#   - URLs will have $repo replaced by the name of the current repo
#   - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.

[core]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

[extra]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

[community]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

[multilib]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

Please make sure you did not edit it and have a typo in yours.

Just copy pasted everything afresh as it is, there’s no way I could have a typo

Did you follow @freggel.doe instructions? (without $ signs though)

Open terminal and paste:

wget https://pkgbuild.com/~eschwartz/repo/x86_64-extracted/pacman-static
chmod +x ./pacman-static
sudo ./pacman-static -S pacman 

then

sudo pacman -S pacman-mirrors

then

sudo pacman-mirrors -f
sudo pacman -Syyu

please post the output of each command here.

1 Like