Similar problems to https://unix.stackexchange.com/questions/235795/use-dpkg-in-busybox

Hi! I was excited to find that dpkg came with newer versions of busybox, so I set to work installing a package. I collected all the dependencies for apt, and ran:
dpkg -i *.deb Unfortunately, there was an error!
dpkg: Unable to open /var/lib/dpkg/status: no such file or directory
Ok, I dealt with that, creating directories /var/lib/dpkg, then making empty file /var/lib/dpkg/status. Then I tried again:
dpkg -i *.deb dpkg: package libtasn1-6 pre-depends on multiarch-support, which is not installed or flagged to be installed
So I tried to install multiarch-support, but it depends on libc6, which depends on libgcc, which depends on multiarch-support. I also tried to install them all on the same line, but same dependency error happened.
So I tried to install libgcc with --force-depends , but now it complains about not having /var/lib/dpkg/info/libgcc1.md5sums, so I create info directory, it gets a little farther, but then:
sh: /var/lib/dpkg/info/libgcc1.postinst: No such file or directory dpkg: postinst failed, error code 256

What am I missing? Is there some way to set up busybox's dpkg so that it can actually install packages?

  • How did you get dpkg running on Android? What device, android version and ROM?
    – ddnomad
    Mar 31, 2017 at 18:57
  • dpkg and rpm are included with busybox, but device is Samsung Galaxy Tab 2, Unlegacy Android 6.01(Marshmallow) Mar 31, 2017 at 18:59
  • Is your device rooted? Most of the time you won't be able to setup something far then bundled with busybox packages on Android. The reason is mostly because android is heavily modified version of Linux and most of the packages won't work properly.
    – ddnomad
    Mar 31, 2017 at 19:04
  • Device is rooted. Are you saying it's pointless to try to install packages with busybox's dpkg? Anyway, from what I can see the installation problem seems to be from a dpkg missing a bunch of files, right? Mar 31, 2017 at 19:09
  • Well, I would go with an installation of a full-blown Linux distro using dedicated apps from Play Store (i.e. play.google.com/store/apps/details?id=ru.meefik.linuxdeploy) and won't bother trying to force dpkg to behave correctly. It misses some libs which probably means that it was either broken installation or the structure of directories of Android simply is not compatible with it.
    – ddnomad
    Mar 31, 2017 at 19:13

1 Answer 1


Running the dpkg utility is one thing, installing a distribution is another. To get a distribution running, you need to install a bunch of packages, and to work around the fact that with the most fundamental utilities, pretty much everything depends on everything else working. It's a bootstrapping problem.

Fortunately, there's an app for that! Debootstrap is designed for exactly this purpose. I think you can get Deboostrap to run on a system with BusyBox, but it's probably simpler to use its two-phase mode:

  1. Get debootstrap (available as a package in Debian, of course, but also in several other distributions) and run it on a Linux PC to prepare a directory tree.

    debootstrap --arch=armhf --foreign jessie debian
  2. Copy the directory tree to your device with BusyBox, making sure to preserve file attributes. Use tar to archive the directory and unpack it on the target device.

  3. On the target device, chroot to where you've unpacked the archive, and run

    /debootstrap/debootstrap --second-stage
  • "chroot to where you've unpacked the archive". Don't you mean "cd to where you've unpacked the archive"? If I chroot there there's no shell to run commands yet there. May 23 at 3:29
  • And I found debootstrap/debootstrap.log debootstrap/debpaths debootstrap/deburis but no debootstrap/debootstrap. Sorry! May 23 at 3:42
  • 1
    @DanJacobson No, you need to chroot. The archive contains /debootstrap/deboostrap as well as /bin/sh and all the libraries and other files needed to run it. Make sure you're targeting the correct directory and not a parent or child of it. May 23 at 7:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .