You are not logged in.

#1 2022-03-23 14:13:48

Pgi
Member
Registered: 2022-03-23
Posts: 3

[Closed]Pacman cannot synchronize package database...

Hi to all,

I modified the reflector.service in order to add a package database sync after reflector upgrade the mirrorlist. However, package database sync fails every time.

Here is the modified reflector.service, with the ExecStart=/usr/bin/pacman -Syy being the added code.

Description=Refresh Pacman mirrorlist with Reflector.
Documentation=https://wiki.archlinux.org/index.php/Reflector
Wants=network-online.target
After=network-online.target nss-lookup.target

[Service]
Type=oneshot
ExecStart=/usr/bin/reflector @/etc/xdg/reflector/reflector.conf
ExecStart=/usr/bin/pacman -Syy
CacheDirectory=reflector
# CapabilityBoundingSet=~CAP_SETUID CAP_SETGID CAP_SETPCAP CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_CHOWN CAP_FSETID CAP_SETFCAP CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_IPC_OWNER CAP_NET_ADMIN CAP_SYS_TIME CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE CAP_KILL CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_RESOURCE CAP_MAC_ADMIN CAP_MAC_OVERRIDE CAP_SYS_BOOT CAP_LINUX_IMMUTABLE CAP_IPC_LOCK CAP_SYS_CHROOT CAP_BLOCK_SUSPEND CAP_LEASE CAP_SYS_PACCT CAP_SYS_TTY_CONFIG CAP_WAKE_ALARM
CapabilityBoundingSet=
Environment=XDG_CACHE_HOME=/var/cache/reflector
LockPersonality=true
MemoryDenyWriteExecute=true
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
PrivateUsers=true
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelTunables=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectSystem=strict
ReadOnlyPaths=/etc/xdg/reflector/reflector.conf
ReadWritePaths=/etc/pacman.d/mirrorlist
RemoveIPC=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@resources @privileged
UMask=177

[Install]
WantedBy=multi-user.target

Here is the result of systemctl status

× reflector-custom.service - Refresh Pacman mirrorlist with Reflector.
     Loaded: loaded (/usr/lib/systemd/system/reflector-custom.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Wed 2022-03-23 11:38:58 CET; 3h 32min ago
       Docs: https://wiki.archlinux.org/index.php/Reflector
   Main PID: 1061 (code=exited, status=1/FAILURE)
        CPU: 620ms

mars 23 11:37:37 Framework systemd[1]: Starting Refresh Pacman mirrorlist with Reflector....
mars 23 11:37:40 Framework reflector[1047]: [2022-03-23 11:37:40] WARNING: failed to rate http(s) download (https://archm>
mars 23 11:37:50 Framework reflector[1047]: [2022-03-23 11:37:50] WARNING: failed to rate http(s) download (https://asia.>
mars 23 11:37:56 Framework reflector[1047]: [2022-03-23 11:37:56] WARNING: failed to rate http(s) download (https://mirro>
mars 23 11:38:58 Framework pacman[1061]: :: Synchronizing package databases...
mars 23 11:38:58 Framework pacman[1061]: error: failed to synchronize all databases (unable to lock database)
mars 23 11:38:58 Framework systemd[1]: reflector-custom.service: Main process exited, code=exited, status=1/FAILURE
mars 23 11:38:58 Framework systemd[1]: reflector-custom.service: Failed with result 'exit-code'.
mars 23 11:38:58 Framework systemd[1]: Failed to start Refresh Pacman mirrorlist with Reflector..

I tried to add a delay between the refreshing of mirrorlist by reflector and the database sync by pacman, but it did not work...

Any idea on what may be wrong and how to solve this?

Thank you

Last edited by Pgi (2022-03-23 18:44:03)

Offline

#2 2022-03-23 14:23:02

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,694

Re: [Closed]Pacman cannot synchronize package database...

That's a terrible idea to start with. Updating the databases without updating the rest of the system leads directly to partial updates, and will end up screwing up your system at some point.

Online

#3 2022-03-23 16:30:19

Pgi
Member
Registered: 2022-03-23
Posts: 3

Re: [Closed]Pacman cannot synchronize package database...

Thanks for your reply @Scimmia

I do not see how updating database without updating the rest of the system could lead to partial updates. Can you explain more?

Thanks.

Offline

#4 2022-03-23 16:47:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Closed]Pacman cannot synchronize package database...

As soon as you install anything after that, you have - by definition - done a partial upgrade:
https://wiki.archlinux.org/title/System … nsupported

Further, you should also not use two 'y' flags.  It will do no harm to you, but it is pointless and uses mirror server bandwidth for no purpose.

The actual problem though is due to the database lock.  I don't believe that reflector locks the database, so that would imply that you have yet some other process running pacman commands at the same time (either that or a previous transaction was intrupted and the lock file not removed).
https://wiki.archlinux.org/title/Pacman … )%22_error

Last edited by Trilby (2022-03-23 16:50:04)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-03-23 18:42:52

Pgi
Member
Registered: 2022-03-23
Posts: 3

Re: [Closed]Pacman cannot synchronize package database...

Ok, I did not get that concerning partial upgrade. Thanks for the info.

Concerning the database lock, it is strange because when I manually starts a database sync, it works correctly...

Anyway, I understand it is a bad idea, so I give up this idea...

Offline

#6 2022-03-23 21:04:28

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [Closed]Pacman cannot synchronize package database...

Please edit your title and remove [Closed]...
https://wiki.archlinux.org/title/Genera … ow_to_post


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#7 2022-03-23 21:23:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Closed]Pacman cannot synchronize package database...

Pgi wrote:

Concerning the database lock, it is strange because when I manually starts a database sync, it works correctly...

But when you manually sync the databases you are not doing that from a service file with "ProtectSystem=strict" which explicitly prevents writing to any files that are not specified by other variables in the service file (which it seems pacman is interpreting as a lock file existing if / when it cannot create one).

In otherwords, don't try to hijack complicated service files without reviewing and understanding what's in them.

Last edited by Trilby (2022-03-23 21:35:35)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB