FS#54239 - Post Update Hook not called after errors

Attached to Project: Pacman
Opened by Florijan Hamzic (cin) - Wednesday, 31 May 2017, 11:53 GMT
Last edited by Doug Newgard (Scimmia) - Wednesday, 31 May 2017, 15:15 GMT
Task Type Bug Report
Category System
Status Unconfirmed
Assigned To No-one
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

Description:
I always run into the same issue on my server. I am doing a system update "pacman -Syu". kernel and other packages are updated but the package mantisbt will throw some "existing file errors".
Ok so then i solve this existing file problem and reinstall mantisbt, everything looks fine for me and i am going to reboot the server but it will not came up because the post install hook of linux package is not executed due to the errors.

Not sure if this is a bug but it is a problem because linux or other packages which are installed correctly should complete or rollback their installation when other packages thrown errors otherwise it can lead to very strange problems
This task depends upon

Comment by Dave Reisner (falconindy) - Wednesday, 31 May 2017, 12:05 GMT
Something seems off about this. If 'pacman -Syu' aborts due to file errors, then no packages were upgraded. If you later fix this and then re-run 'pacman -Syu', then the kernel will be updated and hooks will run.
Comment by Florijan Hamzic (cin) - Wednesday, 31 May 2017, 12:11 GMT
sorry i use yaourt is it possible that yaourt behaves differently?
Comment by Dave Reisner (falconindy) - Wednesday, 31 May 2017, 13:06 GMT
I don't know what yaourt does or doesn't do, but you're reporting a bug against pacman without actually using it directly.

My guess is this is a bug in yaourt or esle you wouldn't have been the first to run into this.
Comment by Florijan Hamzic (cin) - Wednesday, 31 May 2017, 13:17 GMT
for some reason i just think about pacman, sorry i will close this
Comment by Florijan Hamzic (cin) - Wednesday, 31 May 2017, 13:24 GMT
I wonder how the rollback works, if 150 packages are installed and the 151th failed will all packages which has been installed previously rolled back?
Comment by Florijan Hamzic (cin) - Wednesday, 31 May 2017, 13:27 GMT
the kernel package was successfully installed but the post hook has not been executed because another package failed afterwards, sure that this will be handled correctly in pacman?
Comment by Doug Newgard (Scimmia) - Wednesday, 31 May 2017, 13:28 GMT
There is no rollback, file conflicts are checked before anything gets updated at all.
Comment by Florijan Hamzic (cin) - Wednesday, 31 May 2017, 13:31 GMT
okay thanks
Comment by Dave Reisner (falconindy) - Wednesday, 31 May 2017, 13:33 GMT
Showing your pacman.log would be useful.
Comment by Florijan Hamzic (cin) - Wednesday, 31 May 2017, 13:42 GMT
[2017-05-30 14:59] [ALPM] upgraded python2-zope-interface (4.3.3-3 -> 4.4.1-1)
[2017-05-30 14:59] [ALPM] error: problem occurred while upgrading roundcubemail
[2017-05-30 14:59] [ALPM] upgraded roundcubemail (1.2.4-1 -> 1.2.5-1)
[2017-05-30 14:59] [ALPM] transaction failed
[2017-05-30 15:00] [PACMAN] Running 'pacman --color auto -Sy'
[2017-05-30 15:00] [PACMAN] synchronizing package lists
[2017-05-30 15:00] [PACMAN] Running 'pacman --color auto -S -u'
[2017-05-30 15:00] [PACMAN] starting full system upgrade

sorry it was not mantisbt it was the package roundcube. It said some directories already exist (skin and program)

you can see in the log what happened. After the initial update i fixed the roundcube directory problem and triggered another update, i also wondered that the packages already have been installed and it showed so less packages this time, as normaly they not installed in case of an error

somewhere later you can see that i installed the linux package explicitley to get it work again
Comment by Doug Newgard (Scimmia) - Wednesday, 31 May 2017, 13:50 GMT
And you still haven't given us exact errors.
Comment by Florijan Hamzic (cin) - Wednesday, 31 May 2017, 13:53 GMT
sorry i don't have it anymore or is it logged somewhere?

But it said there is an existing directory 3 times (skins, program and plugins)

from my bash history:

cd /usr/share/webapps/roundcubemail/public_html/skins
ll
..
ll
cd skins/
ll
..
ll
mv skins/ _skins
sudo mv skins/ _skins
ll
mv plugins/ _plugins
sudo mv plugins/ _plugins
sudo mv program/ _program
Comment by Andrew Gregory (andrewgregory) - Wednesday, 31 May 2017, 16:27 GMT
Had you previously replaced the /usr/share/webapps/roundcubemail/public_html/skins symlink with a directory?
Comment by Florijan Hamzic (cin) - Thursday, 01 June 2017, 09:23 GMT
it looks like i did replaced it

1839082 drwxr-xr-x 37 http http 4.0K Aug 29 2016 _plugins
2097164 drwxr-xr-x 2 root root 4.0K Apr 28 08:03 program
1840971 drwxr-xr-x 4 http http 4.0K Aug 29 2016 _program
1838795 drwxr-xr-x 5 http http 4.0K Aug 29 2016 _skins
1838523 lrwxrwxrwx 1 root root 12 Apr 28 08:03 .htaccess -> ../.htaccess
1838522 -rw-r--r-- 1 root root 1.5K Apr 28 08:03 index.php
1838525 lrwxrwxrwx 1 root root 10 Apr 28 08:03 plugins -> ../plugins
1838526 lrwxrwxrwx 1 root root 13 Apr 28 08:03 robots.txt -> ../robots.txt
1838524 lrwxrwxrwx 1 root root 8 Apr 28 08:03 skins -> ../skins
Comment by Andrew Gregory (andrewgregory) - Thursday, 01 June 2017, 12:01 GMT
pacman does not support manually replacing files with directories; don't do that.
Comment by Florijan Hamzic (cin) - Thursday, 01 June 2017, 12:57 GMT
ok, thanks for tracking the root cause of this issue
Comment by Kevin (kjslag) - Saturday, 17 June 2017, 22:52 GMT
Hi guys, I came here to post about this exact same issue: "Post Update Hook not called after errors", but found that it's already been reported.
In my case, I ran pacman -Syu and got the following error (as written in /var/log/pacman.log):
...
[2017-06-17 00:31] [ALPM] upgraded linux (4.11.3-1 -> 4.11.5-1)
[2017-06-17 00:31] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
...
[2017-06-17 00:33] [ALPM] error: cannot remove /var/cache/pacman/pkg/ (Not a directory)
[2017-06-17 00:33] [ALPM] upgraded pacman (5.0.1-5 -> 5.0.2-1)
[2017-06-17 00:33] [ALPM] transaction failed
This occurred because I made /var/cache/pacman/pkg/ a symlink to another partition with more disk space. (Maybe there's a better way for me to do this?)
Anyways, I got pacman updated and ran pacman -Syu again to finish my system update, and then I rebooted. But of course, the hooks for linux (and many other packages) weren't run, so the boot failed. Of course, Arch is awesome so fixing this wasn't difficult once I figured out what had happened. However, I think the following suggestion would have prevented the premature reboot:

--------- SUGGESTION: ---------
I think it would be very very helpful if pacman would warn the user that the hooks for certain packages weren't run. This warning should be written out to the terminal and to /var/log/pacman.log and it should list the packages with hooks that still need to be run. This way, the user can run the hooks by just reinstalling these packages.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Here is another user who seems to have had the same issue:
https://www.soimort.org/notes/170407/
He proposed a more complicated solution. However, I think a warning message should be simple and sufficient.

thanks!

Loading...