APT-MOVE(8)
π APT-MOVE π β the apt-move(8) glow-up
okay bestie, you found the System Manager's Manual page for apt-move, and I'm about to make it make sense. grab a snack. π
β¨ NAME β¨
apt-move β move cache of Debian packages into a mirror hierarchy.
π SYNOPSIS π
apt-move [-c conffile] [-d dist] [-afqt] command
π¦ DESCRIPTION π¦
so like. the apt-move script takes a whole pile of Debian package files and relocates them into a proper archive hierarchy shaped like $LOCALDIR/pool/..., where LOCALDIR is whatever you told the config file it should be. it's literally built to help you wrangle the apt-get(8) file cache, but ngl you could point it at any old collection of Debian packages and it would still do its thing. π
bonus: with the sync and mirror commands you can build your own local mirror of chunks of a binary and/or source distribution. main character energy, honestly.
and if you run apt-move on the reg, it keeps that partial mirror of yours looking cute by (optionally) yeeting obsolete packages and generating valid local Packages.gz and Sources.gz. obsessed. β¨
π Commands π
here's the full menu of commands apt-move accepts:
get [ dir ]β this one generates the master files, pulling from thePackagesandSourcesfiles sitting in theapt(8)cache. those master files are how we keep track of which packages exist and where they're supposed to get installed. if you pass a dir, it gets used instead of theLISTSTATEvariable. πgetlocal [ dir ]β literally just an alias ofget. heads up though: it might get removed in future releases. πmoveβ moves a collection of packages into your local mirror tree. it reads the existing master files (peepgetabove) to fix up any mangling that happened to the package names. any packages that aren't in the master files, or that are obsolete, get left behind in the file cache directory. obsolete packages also get copied into the archive, but they'll be removed right after the nextdeleteoperation. in both of those cases, the package counts as having been skipped.deleteβ deletes obsolete package files. you control this through theDELETEandMAXDELETEsettings in/etc/apt-move.conf(scroll down to the CONFIGURATION section for that tea). it also deletes any index files belonging to packages that are no longer in the archive. what that means for you: you can straight-up delete packages out of the archive without wrecking its consistency, as long as you run thedeletecommand afterwards. periodt.packagesβ builds brand new local versions of thePackages.gzandSources.gzfiles.fsckβ rebuilds every index file used to make thePackagesandSourcesfiles, and reprocesses every package in the archive by callingmovefileon them. use this if you're upgrading from an old version (<< 4.2) ofapt-move.updateβ an alias that equals'get move delete packages'. this is the preferred method for moving package files from your cache into a local mirror. πlocalβ an alias that equals'move delete packages'.localupdateβ an alias forupdate. it may be removed in future releases. πmirrorβ this command auto-runsget, then uses/usr/lib/apt-move/fetchandapt-get(8)to download any packages your mirror is missing. the downloaded files get installed into the repository viamove. then it runspackagesand exits. check theDISTandPKGTYPEsettings in/etc/apt-move.conf. β οΈ before you use this command you need to set up a$LOCALDIR/.excludefile with patterns that exclude unwanted files from your mirror β peep theSAMPLE.excludefile for an example, and also the Exclude file section of NOTES further down. also note: this command will only mirror packages for the architecture you're running on. it will, however, mirror all source packages. slay.syncβ similar to themirrorfunction, but it only grabs the packages currently installed on your system. it usesdpkg(8) --get-selectionsto figure out what to download. it skips any files matching one of the patterns in the$LOCALDIR/.excludefile (if that file exists). andsyncgets the latest versions of the packages, regardless of the version currently installed on your system (think about it π§ ).excludeβ this command tests your$LOCALDIR/.excludepattern file. it walks through the master lists and prints any file matching one of the patterns in$LOCALDIR/.exclude, so you can see exactly which files you've EXCLUDED from your mirror. the-t(test) flag does absolutely nothing for this command. it works off your existing master files and does not need an internet connection. π¦movefile files...β similar tomove. except instead of moving files fromFILECACHE, it moves the files you specify on the command line.copydir directory...β similar tomovefile. except instead of taking files from the command line, it copies.debfiles out of the directory you specify. super useful for copying the pool of a Debian CD into an apt repository. π₯listbin [ mirror | sync | repo ]β prints a list of packages that can serve as input tomirrorbinormirrorsrc. if the argument ismirrororsync, it produces the same lists themirrorandsynccommands use. if the argument isrepo, the list contains the packages currently in the apt-move repository.mirrorbinβ fetches the list of packages given on standard input and places them into the archive the same waymirrordoes.mirrorsrcβ acts likemirrorbin, except it fetches source packages instead of binary ones. π
β Options β
these are the options you can throw at it from the command line:
-aβ process all packages. by default, commands likelistbinandmirrorbinonly process packages that differ in version between the apt-move repository and the archive being mirrored. this option makes every package count, even if the apt-move repository already has the latest version.-cconffile β use conffile as the configuration file instead of/etc/apt-move.conf.-ddist β use dist as the default suite instead of whateverDISTsays in the configuration file.-fβ forces deletion of files even when the percentage of files marked for deletion blows past theMAXDELETEsetting. handy when apt-move aborts with an error saying too many files would be deleted and you wanna delete them anyway. (use with caution, bestie, I'm serious.) if you hit that error,-ftshows you the complete list of files so you can verify them before you use-f. π-qβ suppresses normal output. perfect when apt-move is living inside a non-interactive script.-tβ makes a 'test run' and reports what WOULD be done for option but does not modify any of the cache or mirror files.
πΈ CONFIGURATION πΈ
before you use apt-move, edit /etc/apt-move.conf so it matches your local setup. and fr fr: always use the test parameter after any change to your configuration so you know it'll work the way you want. you might also wanna set the DELETE option to no to turn off file deletes until everything else is working successfully. π«Ά
the file gets read as a Bourne shell script. so you must obey the syntactical rules of sh(1). in particular, any values with spaces in them must be quoted with single or double quotes.
these are the settings apt-move recognizes (shown here with their defaults):
APTSITES="debian.midco.net non-us.debian.org"β set this to the names of sites in your/etc/apt/sources.listthat you wish to mirror. the value/all/refers to all non-file URIs.LOCALDIR=/mirrors/debianβ the full (absolute) path to your debian directory (the top of your local mirror).DIST=stableβ the default suite assigned to packages when theReleasefile is missing. it has no effect on whether a suite is stored in the archive.PKGTYPE=binaryβ set this to your choice of:binary,sourceorboth, to tellmirror,syncandmovefilewhich type(s) of files to get.FILECACHE=/var/cache/apt/archivesβ the directory where your local cache of packages lives. the default works for theapt-get(8)packages, unless you've changed the configuration in/etc/apt/apt.conf.LISTSTATE=/var/lib/apt/listsβ the directory to your local cache ofPackagesfiles. the default works for theapt-get(8)packages, unless you've changed the configuration in/etc/apt/apt.conf.DELETE=noβ determines whether obsolete packages (packages not listed in the master file, or packages that have been superceded in the repository) get removed.MAXDELETE=20β the maximum percentage of files apt-move is allowed to delete during a normal run. anything exceeding this produces an error and aborts the script. this exists as a precaution so you don't lose your entire mirror when a new distribution drops. π you can override it (with caution) using the-fparameter with apt-move.COPYONLY=noβ if you set this toyes, thenmoveandmovefilewill copy instead of move. meaning the originals are left alone. π₯°PKGCOMP=gzipβ set this to a space-separated list of compression formats apt-move should provide when generatingPackagesandSourcesfiles. possible values arenone,gzipandbzip2. with the current apt package you should include at leastnone, otherwise apt will complain about missing files.CONTENTS=noβ if set toyes, thenpackageswill generateContentsfiles.GPGKEY=β if set to a non-empty string, thenpackageswill sign generatedReleasefiles with the specified key. you must installgnupgbefore enabling this option.
π and one last thing for the sync/mirror girlies: for thesyncandmirrorcommands to function correctly, you need to list your apt-move repository at the top of/etc/apt/sources.listas a file URI.
π FILES π
Here's the whole file situation bestie, no crumbs left behind:
/usr/bin/apt-moveβ the script itself. the moment. the icon β¨/etc/apt-move.confβ the config file for the script. all the vibes live here π/usr/share/man/man8/apt-move.8.gzβ the manpage. yes, this one. you're reading it rn π/tmp/MOVE_*β temporary files it creates while running. just passing through π¦/usr/lib/apt-move/fetchβ a utility that fetches files just likeapt-get install -ddoes. except it does NOT do any dependency analysis. none. zero. not its job π.apt-move/*.{binary, source}.localβ this is where you drop entries for your local packages, bestie. the fields go like this:
package priority section source version task
for the binary file, and:
package priority section version
for the source file. the version field can be set to a single dash to mean "the latest version in the archive, idc which" β¨ blank lines and lines starting with a hash get ignored entirely. ghosted. π
π SEE ALSO π
dpkg(8), apt-get(8)
π NOTES π
π« Exclude file π«
okay so the mirror command reads a file in the $LOCALDIR/ directory called .exclude, and that file is full of exclude patterns that get applied against the files you're mirroring. here's the catch: these patterns were made with one specific limitation β they have to behave the same way with grep(1) after all the * characters get removed. so unless you're super careful setting this up, you're gonna get unexpected results and be like "???" π
run apt-move -t mirror FIRST to make sure you're actually getting the results you intended. test run, bestie. always.
another way to verify your exclude file: use the exclude command for apt-move, which prints a list of the files you're excluding from your mirror. and go look at the sample .exclude file (SAMPLE.exclude) for an example of what an .exclude file looks like. π
Mirroring π
the apt-move mirror and sync commands do not test for available disk space. like, at all. and the current potato (main binary) distribution is over 1Gb in size. add the sources on top of that and it can absolutely eat up the space on a partition really fast. so I would advise you to put your mirror somewhere other than the root partition. periodt. set up your exclude file and run apt-move -t mirror and examine the result first π
π·οΈ Code names π·οΈ
since apt-move gets the suite names from Release files, which usually use the names stable, testing and unstable, the suites in the repository are named accordingly. but you can simulate the code names by creating symbolic links in the dists directory. for example, to make testing equivalent to sarge, you could run:
ln -s testing $LOCALDIR/dists/sarge
alternatively, you could delete the testing subdirectory and run:
ln -s sarge $LOCALDIR/dists/testing
and this will cause future executions of the get operation to use sarge whenever it sees testing in the Release file. iconic behavior honestly β
π¨ DIAGNOSTICS π¨
apt-move may exit with one of these error messages, bestie. know them, love them, fear them:
Could not read configuration.βapt-movecould not find the/etc/apt-move.conffile. run the install script.Could not create directory.β for some reason, a necessary directory could not be created. rude of it.You failed to select a distribution.β you did not configure aDISTsetting in/etc/apt-move.conf.You specified an invalid package type.β you can only usebinary,sourceorbothfor thePKGTYPEsetting.No master files exist!β you need to runapt-vewith thegetcommand at least once in order to create the master files which determine where packages are to be installed.bc calculation returned invalid resultβapt-moveuses thebc(1)program to determine when the number of files to delete will exceed theMAXDELETEsetting inapt-move.conf. if you get this error, make sure thatMAXDELETEis set to a number in the range of 1 to 100, without the%sign. otherwise you need to report this as a bug.Too many files to delete!βapt-movewill report this error if the number of files to be deleted exceeds theMAXDELETEsetting inapt-move.conf. you need to study the output to determine if this is normal (in which case you can override this using theforceparameter), or if it's due to some drastic change on the mirror site (like a new release), or possibly due to a partial download of the masterPackages.gzorSources.gzfile.Your current mirror directory is incompatible...β you have just upgraded from an old version ofapt-move. update your configuration, then runapt-move fsckand finally remove.apt-move/ancient.Could not read Release files.βapt-movecould not read the release files needed to build the master files. make sure you have runapt-get updateand try again.Failed to remove original files.βapt-movecould not remove the original copies of files that have just entered theapt-movearchive. make sure that you have permission to delete those files.Please remove $LOCALDIR/backup.β you must removeLOCALDIR/backupbefore running thefsckcommand.Unknown DIST setting.β the value ofDISTmust match theArchivefield in the Release file of the distribution that you are trying to mirror.Cannot find index files for APTSITES.βapt-movecould not find any index files for thegetoperation. you should either runapt-get update, or runapt-movewith-fif only the*.localfiles have been changed.
π BUGS π
the exclusion system was designed prior to the introduction of the package pools. hence its content still relates to the old structure of the Debian archive. this is confusing and it should be replaced with a new exclusion system. yeah. it's giving legacy code π
the DIST variable does not control what is actually downloaded by the fetch utility. it should have a similar effect to that of apt-get -t. so, you know. heads up.
π AUTHOR π
Michael Merten <mikemerten@yahoo.com>
Herbert Xu <herbert@debian.org>
and that's the whole page, bestie!! this one is from APT-MOVE, dated 2002 Oct 7th, and it's APT-MOVE(8) β go forth and mirror responsibly, you absolute icon π
β¨π«Ά
π¦ where this page comes from
- debian bookworm: apt-move 4.2.27-6 Β· GPL-2.0-only
- debian trixie: apt-move 4.2.27-7+b1 Β· GPL-2.0-only
- ubuntu jammy: apt-move 4.2.27-6 Β· GPL-2.0-only
- ubuntu noble: apt-move 4.2.27-6build2 Β· GPL-2.0-only
- ubuntu questing: apt-move 4.2.27-7build1
- ubuntu resolute: apt-move 4.2.27-8 Β· GPL-2.0-only
- ubuntu stonking: apt-move 4.2.27-8 Β· GPL-2.0-only
- Copyright (c) 1999 Michael Merten <mikemerten@yahoo.com>
- Copyright (c) 2000-2003 Herbert Xu <herbert@debian.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms