FS#20165 - Add mkinitcpio to SyncFirst in pacman.conf

Attached to Project: Pacman
Opened by Tomas Mudrunka (harvie) - Tuesday, 13 July 2010, 16:53 GMT
Last edited by Thomas Bächler (brain0) - Wednesday, 18 August 2010, 08:54 GMT
Task Type Bug Report
Category Backend/Core
Status Closed
Assigned To Thomas Bächler (brain0)
Dan McGee (toofishes)
Architecture All
Severity Medium
Priority Normal
Reported Version 3.3.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Summary and Info:
-SyncFirst = pacman
+SyncFirst = pacman mkinitcpio

When mkinitcpio and kernel26 are updated at the same time, it seems to be good idea to sync mkinitcpio first before using it to update kernel26. If i will have old mkinitcpio it CAN make some unexpected troubles a make both kernel26 and kernel26 fallback unbootable...

This task depends upon

Closed by  Thomas Bächler (brain0)
Wednesday, 18 August 2010, 08:54 GMT
Reason for closing:  Won't implement
Additional comments about closing:  Wait for pacman hooks support.
Comment by Thomas Bächler (brain0) - Tuesday, 13 July 2010, 18:41 GMT
That is a problem I have been thinking about for some time. However, SyncFirst is IMO the wrong place to do this, for me SyncFirst is a feature supposed to be used by the package management system. Of course, you may configure this on your systems however you wish.

A proper solution would be to make it possible to delay certain post_install tasks to the end of the install process, after all packages have been upgraded - however, no work has been done in that direction.
Comment by Allan McRae (Allan) - Tuesday, 13 July 2010, 23:48 GMT
> pacman -Si kernel26
Repository : core
Name : kernel26
...
Depends On : coreutils linux-firmware module-init-tools
mkinitcpio>=0.5.20


mkinitcpio should always install first if both that and kernel26 are in the same transaction.


> pacman -S kernel26 mkinitcpio
warning: kernel26-2.6.34.1-1 is up to date -- reinstalling
warning: mkinitcpio-0.6.7-1 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets (2): mkinitcpio-0.6.7-1 kernel26-2.6.34.1-1

Total Download Size: 0.00 MB
Total Installed Size: 109.44 MB

Proceed with installation? [Y/n] n


So this appears to be working as it should...
Comment by Thomas Bächler (brain0) - Wednesday, 14 July 2010, 08:29 GMT
It is more subtle than that. Packages used by mkinitcpio that are not depends of it might be updated afterwards. Example: You have 'mkinitcpio kernel26 lvm2' in your list, but the new lvm2 has a hook change that is required for lvm2 to work properly inside mkinitcpio.

In the past with klibc this was even worse ... I have actually not seen any of these problems since mkinitcpio 0.6, but I still like my proposal. On critical machines, I still run mkinitcpio manually after -Syu has finished, just to be safe.

harvie, have you actually had such a problem recently?
Comment by Tomas Mudrunka (harvie) - Wednesday, 14 July 2010, 09:18 GMT
brain0: no, but i've experienced similar problem... mkinitcpio brought some new configuration files (*.pacnew) and immediately it started to update initrd as kernel26 have been updated in the same transaction, it was showing lot of errors during mkinitcpio execution... if it was in syncfirst, i will be able to fix configuration of mkinitcpio before rebuilding initrd. anyway. i have rebuilded initrd again when mkinitcpio was correctly configured to be sure that system will boot.
Comment by Thomas Bächler (brain0) - Wednesday, 14 July 2010, 09:21 GMT
Can you remember what kind of errors exactly there were? I think they should be in pacman.conf.
Comment by Tomas Mudrunka (harvie) - Wednesday, 14 July 2010, 09:27 GMT
brain0: and yes. there should be some directory for some after-transaction hooks. it shouldn't be hard to do... just something like classic *.d directories:

if test -d "$dir"; then
for script in "$dir"/*; do
test -x "$script" && "$script"
done
fi


imho there should be also some prototypes for frequently hooked operations... simplest eg.:

restart_service() {
/etc/rc.d/"$1" restart;
}

and some deduplication, so one service will not be restarted twice.
most hated feature is reloading icon database each time some desktop app is installed (several times during one transaction).
this can be done using three methods:
1.)
echo update-desktop-database >> hooks/dedup;
echo update-desktop-database >> hooks/dedup;
echo update-desktop-database >> hooks/dedup;
cat hooks/dedup | sort -u | bash
rm hooks/dedup

2.)
echo update-desktop-database > hooks/update-desktop-database
echo update-desktop-database > hooks/update-desktop-database
echo update-desktop-database > hooks/update-desktop-database
run-hooks
rm hooks/*

3.) using some hash array...
Comment by Tomas Mudrunka (harvie) - Wednesday, 14 July 2010, 09:33 GMT
brain0: it was something with unproper *.pacnew files in *.d directories of mkinitcpio configuration and few minor errors than i cannot remember.
what means to add error into pacman.conf? there is some error message detection system? i have anything similar in my pacman.conf...
Comment by Tomas Mudrunka (harvie) - Wednesday, 14 July 2010, 09:35 GMT
i think that better idea than adding error messages is adding mkinitcpio to syncfirst ;)
(if you are now familiar with solving this in pacman.conf)
Comment by Thomas Bächler (brain0) - Wednesday, 14 July 2010, 09:41 GMT
Sorry, I meant to say the error should be in /var/log/pacman.log, not pacman.conf.
Comment by Allan McRae (Allan) - Wednesday, 14 July 2010, 10:05 GMT
Ah... that is much more subtle.

The only way this can be fixed is when we implement hooks. It only has a rough design document so far... (http://wiki.archlinux.org/index.php/User:Allan/Pacman_Hooks)
Comment by Anonymous Submitter - Wednesday, 18 August 2010, 08:38 GMT
Even kernel26-headers should be syncfirst as some GPU modules are recompiled while running mkinitcpio.
Comment by Thomas Bächler (brain0) - Wednesday, 18 August 2010, 08:54 GMT
No, they are not.
Comment by Tomas Mudrunka (harvie) - Wednesday, 13 April 2011, 11:44 GMT
UPDATE: This actually happend few months ago to me. I've updated computer that wasn't updated for a long time and after reboot i ended in broken mkinitcpio. i had to boot from archlinux CD, chroot to the system and reinstall kernel package one more time (with new mkinitcpio). I wasn't able to fix it for two weeks because i had to burn the CD at home and bring it to my client (which have office far away from me). This is an issue!
Comment by Tomas Mudrunka (harvie) - Sunday, 17 April 2011, 18:09 GMT
> A Project Manager has denied the request pending for the following task:
>
>  FS#20165  - Add mkinitcpio to SyncFirst in pacman.conf
> User who did this - Allan McRae (Allan)
>
> Reason for denial:
> kernel26 depends on mkinitcpio so a new mkinitcpio is always installed before kernel26.

Well. so why initrd wasn't build properly at the first try (but second performed well)? maybe some of mkinitcpio hooks wasn't ready during the upgrade... how can we handle this?

Maybe mkinitcpio should not be in SyncFirst, but kernel26 should be in "SyncLast" (which is currently nonexistent feature :-)

Loading...