[FAILED] failed to start pkgfile database update

I believe that I found the solution to this problem.
I realized through this forum question that pkgfile-update.service was not running on my computer, although pkgfile-update.timer seems to be active.

These files are located in /lib/systemd/system/

I started researching the configuration of systemd service files, which led me to a question on an Arch Linux forum (unfortunately, as a newly registered member, I cannot link to it here). There I found that every .service file has a [Install] section, where the service execution targets are defined. And that section was missing from my pkgfile-update.service file. In addition, in the [Unit] section, at the end of the After and Wants lines, I added systemd-user-sessions.service , so that all user processes logged on the system are closed without generating new errors.

So, for me, the solution was to include the following content at the end of the file:

nano /lib/systemd/system/pkgfile-update.service

[Install]
WantedBy = poweroff.target reboot.target

With these lines, the service runs every time the system is shut down or restarted. So far, the error message has stopped appearing before the system shutdown.

This is the complete file, with the changes made:

nano /lib/systemd/system/pkgfile-update.service 

[Unit]
Description=pkgfile database update
RequiresMountsFor="/var/cache/pkgfile"
After=network-online.target systemd-user-sessions.service
Wants=network-online.target systemd-user-sessions.service

[Service]
Type=oneshot
ExecStart=/usr/bin/pkgfile -u
Nice=19
StandardOutput=null
StandardError=journal
PrivateTmp=yes
PrivateDevices=yes
CapabilityBoundingSet=
NoNewPrivileges=yes

[Install]
WantedBy=poweroff.target reboot.target

I hope this helps everyone who uses the zsh shell and is experiencing this problem.
And I’m sorry for any typos. I am Brazilian and do not have much knowledge of English.

8 Likes

I’ve got the same problem with Manjaro 20.2-rc1 Kde version. Thanks to ThalesMarcel, I will try his solution. :wink:

It seems that this does not work either.

The message appears again this morning.

It works but now I’ve got another message error: “Failed to start Apply Kernel Variables” on Manjaro KDE 20.2-rc1.

Note: Ok, I see the error on the net. I must check Cache parameter line in sysctl.conf file. It must be commented. Or perhaps another element in this file. I will check it later.

sudo systemctl status pkgfile-update.timer
sudo systemctl status pkgfile-update.service

sudo systemctl enable pkgfile-update.timer
sudo systemctl enable pkgfile-update.service

2 Likes

I have had this problem too for a while, on a recent KDE install.

For me it was a mirror problem, switching mirror solved it for me.

[patrik@xps ~]$ sudo systemctl status pkgfile-update.service
● pkgfile-update.service - pkgfile database update
     Loaded: loaded (/usr/lib/systemd/system/pkgfile-update.service; static)
     Active: failed (Result: exit-code) since Sat 2020-12-19 15:32:11 CET; 10min ago
TriggeredBy: ● pkgfile-update.timer
    Process: 1137 ExecStart=/usr/bin/pkgfile -u (code=exited, status=1/FAILURE)
   Main PID: 1137 (code=exited, status=1/FAILURE)

dec 19 15:32:11 xps pkgfile[1137]: error: failed to update repo: community
dec 19 15:32:11 xps pkgfile[1137]: warning: download failed: https://ftp.lysator.liu.se/pub/manjaro/stable/core/x86_64/core.files: Could not resolve host: ftp.lysator.liu.se
dec 19 15:32:11 xps pkgfile[1137]: error: failed to update repo: core
dec 19 15:32:11 xps pkgfile[1137]: warning: download failed: https://ftp.lysator.liu.se/pub/manjaro/stable/extra/x86_64/extra.files: Could not resolve host: ftp.lysator.liu.se
dec 19 15:32:11 xps pkgfile[1137]: error: failed to update repo: extra
dec 19 15:32:11 xps pkgfile[1137]: warning: download failed: https://ftp.lysator.liu.se/pub/manjaro/stable/multilib/x86_64/multilib.files: Could not resolve host: ftp.lysator.liu.se
dec 19 15:32:11 xps pkgfile[1137]: error: failed to update repo: multilib
dec 19 15:32:11 xps systemd[1]: pkgfile-update.service: Main process exited, code=exited, status=1/FAILURE
dec 19 15:32:11 xps systemd[1]: pkgfile-update.service: Failed with result 'exit-code'.
dec 19 15:32:11 xps systemd[1]: Failed to start pkgfile database update.
[patrik@xps ~]$ sudo systemctl start pkgfile-update.service
[patrik@xps ~]$ sudo systemctl status pkgfile-update.service
● pkgfile-update.service - pkgfile database update
     Loaded: loaded (/usr/lib/systemd/system/pkgfile-update.service; static)
     Active: inactive (dead) since Sat 2020-12-19 15:43:22 CET; 2s ago
TriggeredBy: ● pkgfile-update.timer
    Process: 3760 ExecStart=/usr/bin/pkgfile -u (code=exited, status=0/SUCCESS)
   Main PID: 3760 (code=exited, status=0/SUCCESS)

dec 19 15:43:10 xps systemd[1]: Starting pkgfile database update...
dec 19 15:43:22 xps systemd[1]: pkgfile-update.service: Succeeded.
dec 19 15:43:22 xps systemd[1]: Finished pkgfile database update.

I’ll tag along and say that pkgfile seems to be installed out of the box. That, or maybe it’s installed by another program as a dependency - because I have the same issue and I’m too much of a newbie to even know what pkgfile is, nevermind actually installing it intentionally.

老哥问题解决了吗

没有,今天开机还会这样。

No, it still happens when I open my computer today.

I’ll reread the topic to understand what the issue is

i got this error also at boot and then again at shutdown and not anymore on the next boot.
i will update if it appears again.

EDIT:
if it helps then,i got an update on pamac which i installed,then removed the power cord from my laptop for the first time since i’m on linux,then shut down.
on boot i got the error.
then went to pamac and refreshed the database and a few more updates appeared which i also installed,the restarted the pc;i got and error at shutdown but no error on startup.
this time sudo systemctl --failed didn’t report any errors and same goes for

sudo systemctl status pkgfile-update.timer 
sudo systemctl status pkgfile-update.service,

unlike the first time i ran those.

Currently having the same issue.

I remember getting it previously and solving it temporarily but I can’t remember what I did to fix it.

1 Like

@blackbeam32: Well, that’s not helpful :smile:

I also experienced that problem since the last update. The solution from @ThalesMarcel solved it for me.
Thank you!

As I don’t use zsh, I uninstalled zsh and pkgfile to fix the problem. Pkgfile was just installed because of the zsh depedency.

i managed this (not nicely) by modifying

/usr/lib/systemd/system/pkgfile-update.timer

[Unit]
Description=pkgfile database update timer

[Timer]
OnCalendar=daily
AccuracySec=6h
Persistent=yes
RandomizedDelaySec=600 # <-- add this

[Install]
WantedBy=timers.target

to add a delayed startup.

2 Likes

I have quiet option when boot but it always show a lot of messages.

Can pkgfile be replaced by pacman or something? Or can it auto-update without showing messages?

Yes and no. Pacman has similar functionality built in, but pkgfile performs so much faster that it is the only reasonable option command-not-found hook. If try to run a command that is not installed, you don’t want your shell to freeze for several seconds to find out if some some unistalled app has that command.

Yes if you edit the systemd service. You probably want to disable the service and make your own and enable that instead.

1 Like

A brute-force solution is to remove manjaro-zsh-config and use bash instead (although bash is much more inconvenient).

You can also just disable the pkgfile service. No need to uninstall zsh for that

1 Like

How to disable it? I reinstalled only zsh and oh-my-zsh and I think these are enough.