On Arch Linux, whenever a kernel upgrade is applied (via pacman -Su), problems occur. For example, iptables can no longer be used:

# iptables -L
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

VMWare can't find the kernel headers:

enter image description here

Now, I want to have kernel upgrades applied, but I'd like to defer them until I can (or want to) restart the system (remind anyone of Windows?). Otherwise, if my work is blocked on iptables or VMWare or some other program, I have no choice but to restart and rebuild a session.

How can I do that? Ideally I'd like to continue using pacman -Su, but have certain upgrades deferred.

I believe Is it normal that a restart is required to mount USB after a kernel upgrade? is caused by the same problem.

  • Running pacman -Su is going to fail often; always use pacman -Syu... – jasonwryan Oct 27 '14 at 16:17
  • @jasonwryan That was the concise version. What I actually run is: alias pacu='pacaur -Syu' – muru Oct 27 '14 at 16:21

If you want to keep pacman from up/down grading some package(s), you put a line in /etc/pacman.conf:

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg   =
#IgnoreGroup =

I think you want to have a line like this in pacman.conf:

IgnorePkg = linux linux-headers linux-api-headers 

As you point out, that just keeps pacman from any upgrading. You could probably write some code like this:

if pacman -Qu | egrep -q -s 'linux|linux-headers|linux-api-headers'
    pacman -S --noconfirm linux
    pacman -S --noconfirm linux-headers
    pacman -S --noconfirm linux-api-headers

It looks like you have to write a "systemd unit file" - that part's a bit beyond what I have confidence in telling you what to do. My thought is that the Before=shutdown.target line in the unit file is what makes it run at shutdown. The only unit file I wrote took me several tries to get correct, so I really don't think you want my advice on that.

  • That would completely stop pacman from upgrading those packages unless I explicitly told it to. So how do I do that automatically before reboot if there's an upgrade available? – muru Oct 27 '14 at 15:53
  • @muru - see updated answer. – Bruce Ediger Oct 27 '14 at 17:18
  • Thanks, I'll look into systemd units. They can't be that much harder than Upstart jobs, hopefully. (Possible typo in the second code block: linx instead of linux.) – muru Oct 27 '14 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.