1

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
    Which package it is? which library it misses
    – Anwar
    Sep 15 '16 at 15:54
  • It's a private debian package
    – simplename
    Sep 15 '16 at 23:59
  • 1
    Please be more specific in what you want to do exactly. How was the Deb package built originally? Can you give us a rough outline of it and where you want to add which files? Can the library dependency satisfied by a library from a different package? Sep 16 '16 at 15:53
  • Unless the library can be added by creating another package, the private .deb needs to be rebuilt from the source package with the missing library added into the package and set up correctly to create the links, etc. in the system.
    – Thomas Ward
    Sep 17 '16 at 15:03
  • @DavidFoerster I mentioned I don't know specifics of creating deb packages. So I don't know how it was built originally. Yes, the library that's required I already have with me and simply copying that into my system works. It's just not a part of the .deb file.
    – simplename
    Sep 18 '16 at 20:43
4

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
  • 1
    Yes, copying that library file to the system works. This is exactly what I was looking for!
    – simplename
    Sep 18 '16 at 20:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.