You are not logged in.

#1 2019-08-08 07:29:19

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 747

Delay package upgrade to shutdown

I'm used to pacman -Syu every morning as the  first thing I do after booting my machine. When the kernel is upgraded this means that I have to reboot the machine. So I was wondering if there is the possibility to tell pacman to download the upgrade files for certain packages but  to defer the actual installation to the shutdown phase, while upgrading all the others immediately. I did some search but I've not found anything. Thanks.

Offline

#2 2019-08-08 09:51:43

amish
Member
Registered: 2014-05-10
Posts: 404

Re: Delay package upgrade to shutdown

I dont have a complete solution. Nor I have tried the solution I am proposing below.

But instead of pacman -Syu.. u can do pacman -Syuw (which will download all the packages but install none)

Then you can write a service file which will run "pacman -Syu --noconfirm" before shutdown, halt, reboot etc. target.

Only thing you need to take care is that systemd does not KILL pacman before installation is complete.

PS:
I have systemd.timer which runs "pacman -Syuw --noconfirm" every 4 hours. But I do installation manually before I shutdown. Because I prefer to check what packages were updated / installed / replaced and also read any post installation notes / warnings.

Last edited by amish (2019-08-08 09:52:53)


Forum signature: I discuss. I put my thoughts strongly. But I definitely respect all developers and time they put in.

Offline

#3 2019-08-08 10:26:07

ayekat
Member
Registered: 2011-01-17
Posts: 1,342
Website

Re: Delay package upgrade to shutdown

amish wrote:

But instead of pacman -Syu.. u can do pacman -Syuw (which will download all the packages but install none)

As far as partial upgrades are concerned, that's the equivalent of doing -Sy, so I wouldn't recommend that to anyone.
Consequently, running -Syuw every 4 hours is the same as running -Sy every 4 hours (except that you also download a bunch of packages unnecessarily).

snack, I would get into the habit of at least using checkupdates from community/pacman-contrib. If you want to avoid rebooting after an upgrade, I'd probably also delay the upgrade to the evening, before you power off the machine.


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#4 2019-08-08 10:34:31

amish
Member
Registered: 2014-05-10
Posts: 404

Re: Delay package upgrade to shutdown

How is it partial update? -Syuw is same as full update just that it just downloads the packages but does not install.

Also doing it every  4 hours.. has hardly ever downloaded additional packages. It happens only if a package had multiple releases on the same day.

Note that I poweroff my machine everyday and upgrade everyday too.

Last edited by amish (2019-08-08 10:36:08)


Forum signature: I discuss. I put my thoughts strongly. But I definitely respect all developers and time they put in.

Offline

#5 2019-08-08 10:34:32

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 747

Re: Delay package upgrade to shutdown

Thanks for the suggestions. So it seems that what I'd like to do is not feasible atm (I mean, without hacking pacman/systemd). I think I'll stick with my current "reboot" workflow since it's not that time consuming nor frequent, or maybe I'll start updating the packages before shutting down as suggested by ayekat.

Offline

#6 2019-08-08 10:57:13

ayekat
Member
Registered: 2011-01-17
Posts: 1,342
Website

Re: Delay package upgrade to shutdown

amish wrote:

How is it partial update? -Syuw is same as full update just that it just downloads the packages but does not install.

It's not a partial upgrade on its own, but it can lead to partial upgrades just the same way as -Sy.
Whether packages are downloaded or not doesn't make any difference there.

Here's how a partial upgrade happens:

  1. The user runs -Sy (or -Syuw), and downloads a new version of the package DB, but does not upgrade the packages on their system.

  2. The upgraded package DB contains an upgrade for "libfoo" with a soname bump (e.g. the installed one has /usr/lib/libfoo.so.1, but the repo version now has /usr/lib/libfoo.so.2).

  3. The user now decides to install a new package "barbaz", that depends on libfoo, and pacman will happily install that package.

  4. Now the user tries to run barbaz, but get a weird error: `error while loading shared libraries: libfoo.so.2: cannot open shared object file: No such file or directory, because it turns out that barbaz was compiled against libfoo.so.2, but the local system has libfoo.so.1.

This is because Arch Linux packages often do not state any versioned dependencies: the packager of "barbaz" there assumes that the system has upgraded "libfoo" to .so.2.

If versioned dependencies are involved, things can go wrong in different ways as well (read this one for an example).


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#7 2019-08-08 11:35:01

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 444
Website

Re: Delay package upgrade to shutdown

@ayekat: #3 is why I have conditioned myself to always install packages via pacman -Syu <package>. The actual problem imho is not that pacman -Syuw can lead to a partial update, but pacman -S <package> can.

Offline

#8 2019-08-08 11:42:59

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 7,071

Re: Delay package upgrade to shutdown

FWIW since what you likely actually have an issue with is the fact that your modules will not be accessible, you could instead opt to install something like https://aur.archlinux.org/packages/kernel-modules-hook which should tide your modules over until the next reboot.

Offline

#9 2019-08-08 11:56:08

amish
Member
Registered: 2014-05-10
Posts: 404

Re: Delay package upgrade to shutdown

ayekat wrote:
amish wrote:

How is it partial update? -Syuw is same as full update just that it just downloads the packages but does not install.

[*]The user now decides to install a new package "barbaz", that depends on libfoo, and pacman will happily install that package.[/*]

I never said this in any of my comments above.

1) timers run "pacman -Syuw"
2) before shutdown I run "pacman -Syu"

No question of partial upgrade here. Question was never about installing individual package.


Forum signature: I discuss. I put my thoughts strongly. But I definitely respect all developers and time they put in.

Offline

#10 2019-08-08 12:32:03

ayekat
Member
Registered: 2011-01-17
Posts: 1,342
Website

Re: Delay package upgrade to shutdown

amish wrote:

Question was never about installing individual package.

Yes, but once OP does install an individual package with `pacman -S {pkg}`, they'll potentially end up with a partial upgrade, and that's why -Sy on Arch Linux is generally not recommended.

The approach given by schard in post #7 will work around that, but IMHO the approach of "I -Syu every package" is rather to avoid 404s on the mirror at all cost (which I find a bit overkill).
Running -Syu to avoid issues with a previous -Sy begs the question of why one would run -Sy at all.


{,META,RE}PKGBUILDSpacman-hacks (includes makemetapkg and remakepkg) │ dotfiles

Offline

#11 2019-08-08 12:39:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 21,929
Website

Re: Delay package upgrade to shutdown

I think we're missing the bigger point: OP, you don't want to upgrade packages first thing in the morning, yet you type `pacman -Syu` into the terminal first thing in the morning.  There is a far simpler solution available here: stop typing the command that you don't want to run.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#12 2019-08-08 12:59:44

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 747

Re: Delay package upgrade to shutdown

@V1del: yes it's exactly my problem. Thanks for pointing me to kernel-modules-hook, I'll give it a try.

@Trilby: you're missing the point too. I actually want to update in the morning, but I'd like to defer the updates for those packages which force me to reboot the machine. As V1del supposed this request stems from the fact that a kernel update will make the modules not usable.

Last edited by snack (2019-08-08 13:03:15)

Offline

Board footer

Powered by FluxBB