Jump to content

Blocking a package from installation (WireGuard in my case)


Dantes

Recommended Posts

Hi,

 

I had some issues regarding WireGuard that are solved now. Since my armbian release already contains wireguard I have no need to install it. However I wanted to prevent any future mistake rendering my installation unbootable. So after some searching and experimenting I did the following:

 

In order to block a package a file must be created in /etc/apt/preferences.d/ , in my case I called it wireguard

$ sudo tee /etc/apt/preferences.d/wireguard &>/dev/null <<EOF
Package: wireguard
Pin: release *
Pin-Priority: -1
EOF

 

This is what it looks like now when trying to install the package:

$ sudo apt install wireguard
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package wireguard is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'wireguard' has no installation candidate

 

Unfortunately this still gave me the option to autoremove wireguard-tools

sudo apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  wireguard-tools
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 366 kB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.

 

So I marked the wireguard-tools package as manual because I still need it:
 

$ sudo apt-mark manual wireguard-tools
wireguard-tools set to manually installed.

 

And now it does not bother me with "unneeded" packages warning when using apt :

$ sudo apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

 

Yay!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines