0

I'm using Ubuntu 20.04.03 - server and I would like to hold upgrades for specific ubuntu packages, it means that apt update & upgrade commands would not affect the specific packages that I would like to preserve. I have used those commands for maintaining the desired packages - Kernel-related packages.

apt-mark hold $(uname -r)
apt-mark hold linux-image-generic-hwe-20.04
apt-mark hold linux-headers-generic-hwe-20.04

commands & kernel version

apt upgrade attempt ended with ignoring the hold that I made:

apt upgrade

tried using aptitude also did not work. enter image description here

enter image description here

Is there another way from blocking a package from being upgraded from the "apt upgrade command?

1
  • 1
    Please, don't post images of text. Consider replacing the images with text. It's difficult to see what the text in the pictures says on a small screen.
    – Kusalananda
    Commented Nov 30, 2022 at 11:26

1 Answer 1

0

Found out that using an apt-cache preferences file - /etc/apt/preferences solves the issue. Create the file with the desired package name, then use "apt update" for having it applied

user@user:/etc/apt$ cat preferences
Package: linux-image-*
Pin: release *
Pin-Priority: -1

Package: linux-headers-*
Pin: release *
Pin-Priority: -1
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .