Update - error: failed retrieving file 'community.db'

Long time ago the community packages was moved to the extra repo and the community was informed.

forum announcements for “The community repository has been merged into extra”

2023-05-21T15:55:00Z
gitlab - pacman.conf - generating pacman.conf.pacnew

The community repo was kept but with an empty database - thus you may have forgotten all about it. But now the community repo has been removed from the mirror pool.

Arch Linux - News: Cleaning up old repositories

If you did not update pacman.conf back then, when the community repo was merged into extra, you will see a message like this

 $ sudo pacman -Syu
:: Synchronizing package databases...
 core                  140,0 KiB   875 KiB/s 00:00 [------------] 100%
 extra                   8,3 MiB  12,7 MiB/s 00:01 [------------] 100%
 community.db failed to download
 multilib              141,0 KiB   940 KiB/s 00:00 [------------] 100%
error: failed retrieving file 'community.db' from <mirror url> : The requested URL returned error: 404
error: failed to synchronize all databases (failed to retrieve some files)

Using a text editor

You can use your preferred text editor, but - as this is a protected system file - make sure it can save using elevated privileges.

Remove the following lines - describing the repo (very old installations have an extra line) as described

  • old configuration
    [community]
    Include = /etc/pacman.d/mirrorlist
    
  • older configuration
    [community]
    SigLevel = PackageRequired
    Include = /etc/pacman.d/mirrorlist
    

using nano to edit

The nano editor is default available, so we use nano in the example

  1. Open a terminal and execute

    sudo nano /etc/pacman.conf
    
  2. Navigate to the line [Community] using PgDn and

    Screenshot

    image

  3. Press Ctrlk to delete the line

  4. Press Ctrlk again (very old pacman.conf has three (3) lines)

  5. Press Ctrlo to write out the changes

    Screenshot

    image

  6. Press Enter to confirm write

  7. Press Ctrlx to close the editor.

You are done - no restarts required - you can now sync your system.

Alternative method

Using sed requires listing /etc/pacman.conf beforehand to verify how many lines the community entry covers.

When you know the format of your pacman.conf you can invoke the corresponding command

cat /etc/pacman.conf

Or you can use awk to show only the interesting part

awk '/\[community\]/{p=3} p > 0 {print $0; p--}' /etc/pacman.conf
IF two (2) lines
[community]
Include = /etc/pacman.d/mirrorlist
sed -i '/\[community\]/,+2d' "/etc/pacman.conf"
IF three (3) lines
[community]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist
sed -i '/\[community\]/,+3' "/etc/pacman.conf"
37 Likes

For those who are not comfortable using nano (or other terminal-based text editors), Plasma users can edit the file using kate. Just run the following command (do not use sudo):

kate /etc/pacman.conf

That will open the file in Kate’s GUI where you can make the changes. When you hit the save button, Kate will prompt you for your password to elevate privileges so that it can be saved.

For those who are happy with using nano, but maybe a little unsure of all the shortcuts, this article just happened to be highlighted in today’s FOSS Weekly #25.10: Skype is Dead, GNOME 48 Features, Ubuntu Versions, Nano Guide and More Linux Stuff:

Essential Nano keyboard shortcuts

Shortcut Description
nano filename Open file for editing in Nano
Arrow keys Move cursor up, down, left and right
Ctrl+A, Ctrl+E Move cursor to start and end of the line
Ctrl+Y/Ctrl+V Move page up and down
Ctrl+_ Move cursor to a certain location
Alt+A and then use arrow key Set a marker and select text
Alt+6 Copy the selected text
Ctrl+K Cut the selected text
Ctrl+U Paste the selected text
Ctrl+6 Cancel the selection
Ctrl+K Cut/delete entire line
Alt+U Undo last action
Alt+E Redo last action
Ctrl+W, Alt+W Search for text, move to next match
Ctrl+\ Search and replace
Ctrl+O Save the modification
Ctrl+X Exit the editor
7 Likes

Sidenote, for more advanced users… If you don’t understand sudo and privileges, please skip this message.

Assuming you have a properly configured editor (using at least one of the SUDO_EDITOR, VISUAL or EDITOR environment variables), it is preferred to use sudoedit (or sudo -e) instead of invoking the editor directly with sudo. That’s because sudoedit copies the original file to a temporary location, then launches the editor with normal user privileges, which is safer than having the editor running as root. This is specially relevant for heavier editors with many plugins or features, but also safer in general as it will be impossible to accidentally overwrite any other system file.

# Good! Launches your preferred editor with normal user privileges:
sudoedit /etc/pacman.conf

# Good! Launches nano with normal user privileges:
SUDO_EDITOR=nano sudoedit /etc/pacman.conf

# Avoid doing this:
sudo nano /etc/pacman.conf
# Danger! It launches the editor with super-user privileges.

I know this isn’t directly related to the community repository, but I feel it is important to spread “best practices”. (As for myself, it took me a long time between knowing about sudo and later discovering sudoedit. I wish I had known about it earlier.)

8 Likes

kate is great at editing config file, then [CTRL]+[S] launch saving file and if it doesn’t have correct permissions, it ask for password to elevate it right.
But of course, I’m not a console maniac and it’s enough for many cases. Example: compare file.conf and file.conf.pacnew :slight_smile:

1 Like

Thank you @linux-aarhus for informing the users. In my opinion it’s a big problem that this hits people on the stable branch too!

  • Why couldn’t this issue be first detected by users on unstable branch?
  • Can we fix this for users on stable branch?
3 Likes

It is only a problem for anyone who has not been tending to the .pacnew files,
thus ending up with a /etc/pacman.conf file with a repo in it that, as of yesterday, no longer exists.

This has nothing to do with the branch (stable or unstable …) but only with neglecting the maintenance.

It’s not some flaw or error in the system that could have been found and fixed.

The people who use the unstable or testing branch are perhaps more on top of this than … others.

6 Likes

You did a good and right thing, writing these instructions. But… A lot of users ignore the announcements threads in first instance…

2 Likes

Spectacular, thanks to all for these infos! Yesterday this noob finally learned what “comment out” means/looks like. Today this thread is exactly what I was hoping to find all in one place for the community.db cleanup situation. Looks like I’ll be editing my first config file before updating!

2 Likes

Thank you for this! I saw the error as of last night and it messed with the update process on one of the machines. Thought it’s a temporary outage or error with one of the servers, was about to make a thread asking what’s happening then this popped up thanks to Matray.

2 Likes

And people don’t like using vim because of the weird key combinations?

2 Likes

Most, esp. newbies, get stuck in edit mode or can’t get into it
and there is no “user manual” at the bottom … :wink:

4 Likes

My pacman.conf doesn’t have the section [Community]
Y me da el siguiente error:

error: no se pudo obtener el archivo «multilib.db» desde mirror1.sox.rs: The requested URL returned error: 403
error: no se pudo obtener el archivo «core.db» desde mirror1.sox.rs: The requested URL returned error: 403
error: no se pudo obtener el archivo «extra.db» desde mirror1.sox.rs: The requested URL returned error: 403
advertencia: demasiados errores al descargar de mirror1.sox.rs, pasando al siguiente servidor de la lista
:: Iniciando actualización completa del sistema...
advertencia: rebornos-keyring: la versión instalada (20240525-1) es más nueva que arcolinux_repo_3party (20231128-1)
advertencia: rebornos-mirrorlist: la versión instalada (20241017-1) es más nueva que arcolinux_repo_3party (20241016-1)

Have you tried refreshing your list of mirrors?
This one is giving you 403 Forbidden

403 Forbidden - HTTP | MDN

sudo pacman-mirrors -f (for example)

1 Like

Thanks
:people_hugging: :argentina:

I’m glad y’all posted this (Thankfully I found a thread on a generic Arch Linux thread last night about this issue while I was trying to update and was getting these errors).

That being said; I don’t exactly ignore the memos, but I don’t view them as neccessary reading either. I would politely suggest that before issues like this become a thing (yes I realize there was something written when the comm source was dumped, but there wasn’t just before this update) that there be a note saying “urgent - read”.

Thank you for the awesome work, this has been my daily driver for a year now and I love it!

Of which 1% of Manjaro’s users would bother reading…

Users just have to get into the habit of reading EVERY update announcement before they update. Every update is important.

Taking time to maintain one’s Manjaro installation really is essential, especially when it comes to Arch-based distros, which require regular maintenance and do not hold their users hands. That maintenance includes reading update announcements to see if any manual steps are required or if any other users have encountered issues with the update.

First time using nano. On my 3 xfce systems, after deleting the 3 lines, “Ctrl o” didn’t seem to do anything, and “Ctrl x” did not exit. I looked at the pacman.conf file in a text editor and community was still there. I used “Ctrl o” again then pressed “enter”. That successfully modified the file, but I did not get any prompt asking if I wanted to. Ctrl x then performed the exit from nano.

I was then able to update all 3 systems.

I really thought the Enter was implied by the message printed by nano.

But for anyone coming later - I added the Enter keypress to the sentence.

1 Like

ah! OK, thanks for explanation. I’m new to this, literally first time both using nano and editing a config file. I was actually severely stumped at first as I didn’t even realize I had to use the down arrow to get to the lines that needed deleting! thanks again…

1 Like

Thank you :+1:

Based on your feedback I clarified the instructions.