0

for example, by use apt install xxx I installed some deb package on my ubuntu xenial system.

grub2-common                       2.02~beta2-9ubuntu1.14

How do I modify this version so that dpkg -s xxx( or just any command output from dpkg utility) will return my customized version number?

here would be an example of modification result from output of dpkg -l | grep grub2-common

grub2-common                       2.02~unicorn<3-9ubuntu1.999
Sajuuk
  • 252
  • 2
  • 11
  • Do you mean changing the version number without actual reinstalling? Why do you need this?! – Melebius Mar 20 '19 at 07:32
  • `dpkg -l | grep xxx` will show details of installed package, `apt-cache policy xxx` too - is that what you mean/need ? – cmak.fr Mar 20 '19 at 07:36
  • @Melebius the use case is pretty niche here, I want to stop specific package to be automatically updated by some sysadmin scripts. – Sajuuk Mar 20 '19 at 07:38
  • @cmak.fr and how is that going to help me modify the version? – Sajuuk Mar 20 '19 at 07:38
  • what you exactly want to do? – cmak.fr Mar 20 '19 at 07:39
  • @cmak.fr to MODIFY the package version, I think I made that clear in the post itself. – Sajuuk Mar 20 '19 at 07:40
  • 1
    In this case, [holding the package](https://askubuntu.com/questions/18654/how-to-prevent-updating-of-a-specific-package) should be preferred. – Melebius Mar 20 '19 at 07:40
  • @Melebius I do want to achieve "Modification" of package version, any other means such as holding the package is not ideal for my case. perhaps I should investigate more on dpkg database itself. – Sajuuk Mar 20 '19 at 07:43
  • @Sajuuk no clear to me, cant help – cmak.fr Mar 20 '19 at 07:46
  • 2
    I’m afraid you are trying to solve an [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Please add details about your “sysadmin scripts”. Perhaps they are not designed well and should be fixed instead of breaking the package system even more… – Melebius Mar 20 '19 at 07:51
  • @Melebius the problem I have is actually more complex and should not be take into the picture here, I'm very certain what I want exactly is the capability to modify package version, rather than just stop my package from getting updated in my oversimplified example. – Sajuuk Mar 20 '19 at 08:08

1 Answers1

2

I managed to discover that by modify status file under /var/lib/dpkg directory (requires root permission), one would be able to get modified package version which reflect in dpkg utility output.

Sajuuk
  • 252
  • 2
  • 11