Skip to content

Instantly share code, notes, and snippets.

@halmartin
Created August 25, 2022 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halmartin/30abb47946ace58fb44c2d1b02b43be7 to your computer and use it in GitHub Desktop.
Save halmartin/30abb47946ace58fb44c2d1b02b43be7 to your computer and use it in GitHub Desktop.
debootstrap Ubuntu from Debian

Problem

You want to install a recent version of Ubuntu from Debian using debootstrap (say, from the Hetzner recovery OS) but you keep getting the following error:

base-files
E: Tried to extract package, but file already exists. Exit...

After consulting the debootstrap.log in the target, you find an error that looks similar to the following:

dpkg-deb: error: archive './/var/cache/apt/archives/base-files_12ubuntu4_arm64.deb' uses unknown compression for member 'control.tar.zst', giving up

Well, that's because dpkg in Debian doesn't support zstd compression, despite Debian bug #892664 being open since 2018 to add support.

Solution

Install dpkg from Ubuntu. zstd compression is supported and debootstrap will work. In this case, I used dpkg_1.19.7ubuntu3_arm64.deb because the latest version of dpkg from Ubuntu required a newer libc than was available in Debian:

root@rescue /tmp # dpkg -i dpkg_1.21.1ubuntu2_arm64.deb
dpkg: regarding dpkg_1.21.1ubuntu2_arm64.deb containing dpkg, pre-dependency problem:
 dpkg pre-depends on libc6 (>= 2.34)
  libc6:arm64 is installed, but is version 2.31-13+deb11u3.

Run debootstrap again and it should complete successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment