# install lib with deb (lock)

**URL:** <https://discourse.cmake.org/t/install-lib-with-deb-lock/6682>\
**Category:** Code\
**Tags:** os:linux\
**Created:** [October 17, 2022, 3:25pm UTC](https://discourse.cmake.org/t/install-lib-with-deb-lock/6682 "2022-10-17T15:25:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)\
**Post date:** [October 17, 2022, 3:25pm UTC](https://discourse.cmake.org/t/install-lib-with-deb-lock/6682/1 "2022-10-17T15:25:14Z")

</div>

I use the CPACK\_DEBIAN\_PACKAGE\_CONTROL\_EXTRA to install some library with deb.

preinstall script

```auto
apt-get install -y lshw

```

But get the error

```auto
Fetched 1194 kB in 2s (698 kB/s)
Reading package lists...
haha 
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 459749 (dpkg)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
dpkg: error processing archive 123.deb (--install):
 new aims package pre-installation script subprocess returned error exit status 100

```

how can I install some lib with deb?

```auto
sudo dpkg -i 123.deb

```

And then the deb will install other lib (apt install xxx)

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [October 17, 2022, 6:01pm UTC](https://discourse.cmake.org/t/install-lib-with-deb-lock/6682/2 "2022-10-17T18:01:50Z")

</div>

I don’t think you can call `apt-get` from a pre-install script. What you’re looking for is the job of a `Requires` line in the package metadata.

Cc: @kyle.edwards

---

<div class="post-metadata">

**Author:** ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)\
**Post date:** [October 25, 2022, 12:57am UTC](https://discourse.cmake.org/t/install-lib-with-deb-lock/6682/3 "2022-10-25T00:57:16Z")

</div>

Do you have any suggestion ?  
apt install libpq5  
apt install libgoogle-perftools4  
apt install vlc  
…

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [October 25, 2022, 3:52pm UTC](https://discourse.cmake.org/t/install-lib-with-deb-lock/6682/4 "2022-10-25T15:52:14Z")

</div>

Suggestions for what? You cannot use `apt-get install` during the pre-install for a package. It looks like `CPACK_DEBIAN_PACKAGE_DEPENDS` is what you want.

---

<div class="post-metadata">

**Author:** ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)\
**Post date:** [November 12, 2022, 12:11am UTC](https://discourse.cmake.org/t/install-lib-with-deb-lock/6682/5 "2022-11-12T00:11:44Z")

</div>

Thanks.  
Can I make the `CPACK_DEBIAN_PACKAGE_DEPENDS`  
just to check whether the lib install or not.  
if not install, it will show hint to install,right

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [November 12, 2022, 12:38am UTC](https://discourse.cmake.org/t/install-lib-with-deb-lock/6682/6 "2022-11-12T00:38:14Z")

</div>

`dpkg` has “Recommends” and “Suggests” as well. If CPack doesn’t support them, feature requests would be suitable.
