TL;DR

1
2
3
4
5
mkdir -p /usr/share/proxmox-ve
touch /usr/share/proxmox-ve/pve-apt-hook
chmod +x /usr/share/proxmox-ve/pve-apt-hook
apt install -f
apt install proxmox-ve

Once proxmox-ve is reinstalled, the real hook replaces the empty one and apt is back to normal.

The error

1
2
/bin/sh: 1: /usr/share/proxmox-ve/pve-apt-hook: not found
E: Failure running script /usr/share/proxmox-ve/pve-apt-hook

It shows up on any apt install, apt upgrade, or apt full-upgrade, and blocks everything, including whatever you try in order to fix it.

Why it happens

The proxmox-ve package installs two things that belong together:

FileWhat it is
/etc/apt/apt.conf.d/10pveapthookTells apt to run the hook before every dpkg operation
/usr/share/proxmox-ve/pve-apt-hookThe hook: protects proxmox-ve and the Proxmox kernel from being removed by mistake

If proxmox-ve went away (a miscalculated apt remove or autoremove, an interrupted dist-upgrade, a half-installed package), the script disappears but the file under /etc/apt/apt.conf.d/ is a conffile and stays. apt keeps trying to run a script that no longer exists and fails before touching anything.

Fix if you want to keep Proxmox

The empty hook only gets apt running; the point is to reinstall proxmox-ve:

1
2
3
4
5
6
mkdir -p /usr/share/proxmox-ve
touch /usr/share/proxmox-ve/pve-apt-hook
chmod +x /usr/share/proxmox-ve/pve-apt-hook

apt install -f            # close broken dependencies first (Proxmox staff recommendation)
apt install proxmox-ve    # brings back the real hook and whatever else is missing

Check that the hook is now the real one and not your empty file:

1
2
dpkg -S /usr/share/proxmox-ve/pve-apt-hook   # proxmox-ve: /usr/share/proxmox-ve/pve-apt-hook
head -1 /usr/share/proxmox-ve/pve-apt-hook   # #!/usr/bin/perl

After that, apt full-upgrade and a reboot to confirm the Proxmox kernel comes up.

Fix if you removed Proxmox on purpose

If the box is going back to plain Debian, the snippet is leftover:

1
2
3
rm /etc/apt/apt.conf.d/10pveapthook
# or, cleaner, purge what is left of the package:
dpkg --purge proxmox-ve

apt remove leaves conffiles behind; purge takes them with it.

Traps

  • Do not leave the empty hook in place. It exists so apt cannot remove proxmox-ve or the proxmox-kernel-* package by accident. With the empty file that protection is gone.
  • Check what left together with proxmox-ve. If apt removed it, it probably took dependencies along; apt install proxmox-ve brings them back, but read the list before accepting.
  • If apt install proxmox-ve cannot find the package, the problem is in the repos: no-subscription repositories.
  • Reference: Proxmox forum thread.