local repo made from debs extracted from install image

It might seem trivial but I’ve never done it before. Writing it out for reference.

backstory

My laptop was a kind of a mess. It was originally a Linux Mint Debian Edition install, but at some point I started removing some of the Mint stuff. Yesterday I was at PF and updated the laptop. It broke and I could not repair the dependency hell.

The timeshift backups wouldn’t restore (never had it work correctly) so I decided to overlay a fresh debian install over the existing system to see if that would repair the damage. I downloaded the netinstall, which failed when trying to talk to the repos.1

Fine, since I’m on PF’s fast-ish wifi I downloaded the 3.7GB install image for installation when I got to my next spot the next morning. Foreshadowing: the next spot has lovely temperatures but near-nonexistant cell data.

install

The install went fine. I reformatted the partitions except the /home partition where my stuff is. The problem was I wanted to install some stuff that was on the image but couldn’t figure out how to make it usable to apt.

My main connection (Visible, a Verizon MVNO) had zero bars in this location. My 1GB/month backup on my carry phone (H2O Wireless) had 1 bar but could run some DDG searches.

I found a page that described using dpgk-scanpackages to make a Package list: dpkg-scanpackages . | gzip -c9 > Packages.gz It warned that if the binary package wasn’t there it would be provided in dpkg-dev. [sound of foreboding thunder in the distance]

extraction from image

The debs were located in alphabetical subdirs below debian/pool. I used find to collect them into a spot on the laptop’s drive: find debian/pool -name *.deb -exec cp -v {} [dir for local repo] \'

making a repo

Time to run dpkg-scanpackages, but it’s not there. Fine I’ll install dpkg-dev which is visible among the collected debs.

There were several dependencies that I chased down. Luckily they were all present in the collection, just a matter of installing them all as I saw the various dependency errors.

editing sources.list

I added a line:

deb [trusted=yes] file:[path]/debian ./ and ran apt update. It worked, yay!

results

I installed the stuff I wanted that was available locally.

The next day I found a spot that had 1 bar of Verizon, intermittently. During those moments of grace I installed some things that were not available locally: mosh, wmctrl, cpulimit, etc.

The files available locally were used first, then the others were (slowly) collected off the ‘net:

After this operation, 107 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 file:/extra/debian ./ libgslcblas0 2.7.1+dfsg-5 [108 kB]
Get:2 file:/extra/debian ./ libgsl27 2.7.1+dfsg-5 [941 kB]
Get:3 file:/extra/debian ./ libaec0 1.0.6-1+b1 [21.1 kB]
Get:4 file:/extra/debian ./ libsz2 1.0.6-1+b1 [7,804 B]
Get:5 file:/extra/debian ./ libhdf5-103-1 1.10.8+repack1-1 [1,237 kB]
Get:6 file:/extra/debian ./ libpcre2-32-0 10.42-1 [234 kB]
Get:7 file:/extra/debian ./ libarchive-zip-perl 1.68-1 [104 kB]
Get:8 https://ftp.debian.org/debian bookworm/main amd64 libhdf5-hl-100 amd64 1.10.8+repack1-1 [67.8 kB]
Get:9 https://ftp.debian.org/debian bookworm/main amd64 libvigraimpex11 amd64 1.11.1+dfsg-11 [181 kB]
Get:10 https://ftp.debian.org/debian bookworm/main amd64 enblend amd64 4.2-10+b1 [2,045 kB]

Looks like a win to me.

The files in the local repo will be superceded and become useless. When that happens I will delete them and the related entry in sources.list. In the meantime I am grateful for every kB of data that doesn’t have to go over the miserable connection.

  1. as it turns out, the repos were acting weird, perhaps because of an update. They kept saying they did not support bookworm, the current release. 

Updated: