You are not logged in.

#1 2020-11-25 04:25:58

nikonmsn
Member
Registered: 2018-01-18
Posts: 18

how to manually run hooks [SOLVED]

So I did pacman -Syu and upgrade failed to run some hooks:

error: hook /usr/share/libalpm/hooks/fontconfig.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/glib-compile-schemas.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/30-systemd-daemon-reload.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/30-systemd-update.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/gio-querymodules-32.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/fontconfig-32.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/detect-old-perl-modules.hook line 4: invalid value Path
error: hook /usr/share/libalpm/hooks/gtk-update-icon-cache.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/dconf-update.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/30-systemd-binfmt.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/30-systemd-sysctl.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/gio-querymodules.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/60-mkinitcpio-remove.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/30-systemd-udev-reload.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/update-mime-database.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/30-systemd-catalog.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/dbus-reload.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/gtk-query-immodules-2.0.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/40-update-ca-trust.hook line 5: invalid value Path
error: hook /usr/share/libalpm/hooks/texinfo-install.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/60-depmod.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/xorg-mkfontscale.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/update-desktop-database.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/gtk-query-immodules-3.0.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/update-vlc-plugin-cache.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/20-systemd-sysusers.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/vimdoc.hook line 5: invalid value Path
error: hook /usr/share/libalpm/hooks/90-mkinitcpio-install.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/texinfo-remove.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/30-systemd-tmpfiles.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/gdk-pixbuf-query-loaders.hook line 2: invalid value Path
error: hook /usr/share/libalpm/hooks/30-systemd-hwdb.hook line 2: invalid value Path

I couldn't even boot back into arch, had to boot off the usb dongle, chroot in and do pacman -S linux , which at least let the bootloader see the image after upgrade.

So now I see that there are indeed a bunch of hooks unrun in /usr/share/libalpm/hooks

How can I run these manually? I try `hook` from bash but get command not found: hook

So just wondering how to fix this upgrade now that I can get into my system ? I'm scared to run pacman -S mkinitcpio because i don't know what it does and i don't want to mess up my boot setup, i dual boot into windows for work and i need that available

I wiped out boot partition after upgrade before, so i would like to avoid doing that if possible

Last edited by nikonmsn (2020-11-26 04:04:19)

Offline

#2 2020-11-25 05:30:07

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: how to manually run hooks [SOLVED]

I'm scared to run pacman -S mkinitcpio because i don't know what it does

That will install mkinitcpio. Upon installation, mkinitcpio will trigger at least the hook that runs /usr/share/libalpm/scripts/mkinitcpio-install (see the hooks it installs itself, and when/what they trigger).

There shouldn't be anything breaking here. Mkinitcpio will go through the preset files in /etc/mkinitcpio.d (those files describe how an initramfs shall be built), and rebuilds the configured initramfs files. Note that this is required after each kernel upgrade (an initramfs can only be used with specific kernel versions, to avoid kernel module version mismatches).

About your problem in particular, it appears that during the upgrade, pacman was too old to recognise the new hook file syntax and therefore failed.

One way to solve this is to read through your pacman logs, see which packages were upgraded/installed during that transaction, and then `pacman -S {affected packages}`, to trigger a reinstallation of those packages (and a re-run of the corresponding hooks).
Since the situation indicates that you haven't upgraded your system in a looooooooong time, there are likely many packages involved, and you may want to perhaps semi-automate the generation of that list of affected packages.

(a more brute-force approach would be simply `pacman -S $(pacman -Qq)`, to force a reinstall of all packages (and thus trigger all hooks), but that is more of a "worked on my machine", and less of a recommendation from my side—someone else might chime in and give more input on whether this is a good idea at all)

--edit

How can I run these manually? I try `hook` from bash but get command not found: hook

What did you expect that to do? smile

Please don't run random commands without understanding what is going on, that's a recipe for disaster, and I'm not particularly surprised you have previously managed to break your system.
Read the Wiki, the manpages, and think twice before you type.

Last edited by ayekat (2020-11-25 05:35:12)


pkgshackscfgblag

Offline

#3 2020-11-25 05:47:41

nikonmsn
Member
Registered: 2018-01-18
Posts: 18

Re: how to manually run hooks [SOLVED]

Yea i gathered that much and i did run mkinitcpio after reading more literature on the subject. Yea i have not upgraded in over a year, maybe almost 2.

Anyway I'm not running random commands here, the line of thought was that `hook $path` was a way to run these "hook" files that error out and get left behind in   /usr/share/libalpm/hooks/

The expectation was that whoever developed pacman, was intelligent enough to foresee such a use case and at least provide SOME kind of work around.

This is exactly why i asked this question. I can `cat` the .hook files and read the contents... I can see the command in there that was supposed to run, the problem is i don't know if there is any kind of order of precedence.

Clearly I'm not familiar with specific requirements under which this software was developed.

The "have not updated in looooong time LOL" doesn't seem like a constructive argument against not having a fall back for not updating your system in FOREVER

Offline

#4 2020-11-25 06:50:33

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: how to manually run hooks [SOLVED]

The "have not updated in looooong time LOL" doesn't seem like a constructive argument against not having a fall back for not updating your system in FOREVER

Please do not overreact and/or put words in my mouth. I did not put a "LOL" in there, and the (full) phrase there wasn't about arguments for (or against) how pacman does things at all.
I merely pointed out that because many packages might be affected (yes, in an admittedly slightly over-the-top way), simply going through the list of affected packages in the pacman logs manually may not be practical, so I recommended automating it somewhat.

I gave you the steps required for solving your issue, with some background explanation. I will let someone else reply to your complaints about pacman.

Though… a note about not updating Arch forever: Arch is a rolling release distro, which means things will occasionally change, and developers will not focus on keeping compatibility with years-old systems (or keeping around mechanisms for updating such systems). See General recommendations and in particular System maintenance. When upgrading for the first time in months or years, a bumpy ride is to be expected.


pkgshackscfgblag

Offline

#5 2020-11-25 14:23:59

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,922

Re: how to manually run hooks [SOLVED]

nikonmsn, you could have checked pacman hooks documentation before posting.

see https://wiki.archlinux.org/index.php/Pacman#Hooks and https://jlk.fjfi.cvut.cz/arch/manpages/man/alpm-hooks.5


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#6 2020-11-25 22:49:22

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: how to manually run hooks [SOLVED]

  • The hooks are documented to run in alphabetical order by filename component, and typically use "50-" style numeric prefixes to ensure ordering.

  • You could have used https://aur.archlinux.org/packages/pacman-static to perform the update from an up to date pacman binary which understands "Path".


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2020-11-26 03:58:39

nikonmsn
Member
Registered: 2018-01-18
Posts: 18

Re: how to manually run hooks [SOLVED]

OK, read the pacman docs , did some string processing.

Some hooks did not run, not sure what they need ? Some arguments maybe ? Anyway, not exactly clear from the docs what i need to provide to run all of the hook files manually. Some of them just hang. So here's what i ended up doing to fix my system:

`pacman -S $(pacman -Qq)`

As suggested by ayekat. More or less everything is back to normal.

One comment:

It really isn't that uncommon to not upgrade linux systems... Stability, lack of necessity, etc. I wouldn't have even bothered if i did not need a more recent version of a library

At work, we use linux servers at least a decade old, if not more, so this approach to 'you should always do X' is kind of childish... While you're at it , when driving you should stop at all stop signs for 2-3 seconds flat, especially when in a rush to get somewhere

See how that works?

You shouldn't have a broken system just because you failed to upgrade it for a while.

Last edited by nikonmsn (2020-11-26 04:17:36)

Offline

#8 2020-11-26 08:00:37

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: how to manually run hooks [SOLVED]

It really isn't that uncommon to not upgrade linux systems... Stability, lack of necessity, etc. I wouldn't have even bothered if i did not need a more recent version of a library

At work, we use linux servers at least a decade old, if not more, so this approach to 'you should always do X' is kind of childish...

At work, you are (hopefully) using a version of Linux that is designed to be used like that.
A version of RHEL/Centos can be used for up to over a decade (though you might still need occasional security patching), but that is because the OS vendors there actually support doing that, and they put a lot of effort and work into backporting patches and making sure things keep working for that long.

Arch is not a distro designed for that. Rolling release distros in general are not designed for that.

Last edited by ayekat (2020-11-26 08:01:32)


pkgshackscfgblag

Offline

Board footer

Powered by FluxBB