Adding a library file to an already existing debian package file .deb

I have a debian package file (.deb) that's missing a key library. I don't know specifics of creating a debian package. Is it possible to just add this one library file into the debian package?

6

1 Answer

If copying that particular library file in your installed system works, it should work too if you insert the library in your private deb package.

A debian package file is nothing but an archive of some files, with metadata about those files and some (optional) scripts that are executed when the files are copied over the system .i.e /.

Lets say, your system /usr/lib is this without the missing library say, necessary-lib.so

├── usr
│   ├── lib
│ │ ├── lib1.so
│ │ ├── lib2.so
│ │ ├── <missing lib necessary-lib.so>
│ │ ├── lib3.so

and copying the library file in /usr/lib/ worked.

Then you can extract the deb file and put the library file in usr/lib directory of the extracted files and repackage it.

How do you inject the library

First make a folder to extract the deb file

mkdir extracted

Then extract your deb file. I'm assuming its name is mypackage.deb.

dpkg-deb -R mypackage.deb extracted/

This will extract the package in extracted folder. There will be a folder named DEBIAN with some other folders like those ones in /. You should find a usr folder there and in that a lib folder. You'd copy your library file there.

The theory is, you'll copy the library file in the same location of the extracted folder assuming it as the root of your system. So, you'll copy it in extracted/usr/lib

cp necessary-lib.so extracted/usr/lib

Now, re-build the deb package using this command.

dpkg-deb -b extracted

It will create a new extracted.deb file. It's your new deb file. You should be able to install it on multiple systems now without having to copy the library file each time after installation.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like