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 the Packages and Sources files sitting in the apt(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 the LISTSTATE variable. πŸ‘‘
  • getlocal [ dir ] β€” literally just an alias of get. 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 (peep get above) 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 next delete operation. in both of those cases, the package counts as having been skipped.
  • delete β€” deletes obsolete package files. you control this through the DELETE and MAXDELETE settings 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 the delete command afterwards. periodt.
  • packages β€” builds brand new local versions of the Packages.gz and Sources.gz files.
  • fsck β€” rebuilds every index file used to make the Packages and Sources files, and reprocesses every package in the archive by calling movefile on them. use this if you're upgrading from an old version (<< 4.2) of apt-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 for update. it may be removed in future releases. πŸ™ˆ
  • mirror β€” this command auto-runs get, then uses /usr/lib/apt-move/fetch and apt-get(8) to download any packages your mirror is missing. the downloaded files get installed into the repository via move. then it runs packages and exits. check the DIST and PKGTYPE settings in /etc/apt-move.conf. ⚠️ before you use this command you need to set up a $LOCALDIR/.exclude file with patterns that exclude unwanted files from your mirror β€” peep the SAMPLE.exclude file 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 the mirror function, but it only grabs the packages currently installed on your system. it uses dpkg(8) --get-selections to figure out what to download. it skips any files matching one of the patterns in the $LOCALDIR/.exclude file (if that file exists). and sync gets the latest versions of the packages, regardless of the version currently installed on your system (think about it 🧠).
  • exclude β€” this command tests your $LOCALDIR/.exclude pattern 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 to move. except instead of moving files from FILECACHE, it moves the files you specify on the command line.
  • copydir directory... β€” similar to movefile. except instead of taking files from the command line, it copies .deb files 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 to mirrorbin or mirrorsrc. if the argument is mirror or sync, it produces the same lists the mirror and sync commands use. if the argument is repo, 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 way mirror does.
  • mirrorsrc β€” acts like mirrorbin, 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 like listbin and mirrorbin only 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.
  • -c conffile β€” use conffile as the configuration file instead of /etc/apt-move.conf.
  • -d dist β€” use dist as the default suite instead of whatever DIST says in the configuration file.
  • -f β€” forces deletion of files even when the percentage of files marked for deletion blows past the MAXDELETE setting. 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, -ft shows 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.list that 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 the Release file is missing. it has no effect on whether a suite is stored in the archive.
  • PKGTYPE=binary β€” set this to your choice of: binary, source or both, to tell mirror, sync and movefile which type(s) of files to get.
  • FILECACHE=/var/cache/apt/archives β€” the directory where your local cache of packages lives. the default works for the apt-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 of Packages files. the default works for the apt-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 -f parameter with apt-move.
  • COPYONLY=no β€” if you set this to yes, then move and movefile will 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 generating Packages and Sources files. possible values are none, gzip and bzip2. with the current apt package you should include at least none, otherwise apt will complain about missing files.
  • CONTENTS=no β€” if set to yes, then packages will generate Contents files.
  • GPGKEY= β€” if set to a non-empty string, then packages will sign generated Release files with the specified key. you must install gnupg before enabling this option.
πŸ’œ and one last thing for the sync/mirror girlies: for the sync and mirror commands to function correctly, you need to list your apt-move repository at the top of /etc/apt/sources.list as 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 like apt-get install -d does. 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-move could not find the /etc/apt-move.conf file. 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 a DIST setting in /etc/apt-move.conf.
  • You specified an invalid package type. β€” you can only use binary, source or both for the PKGTYPE setting.
  • No master files exist! β€” you need to run apt-ve with the get command at least once in order to create the master files which determine where packages are to be installed.
  • bc calculation returned invalid result β€” apt-move uses the bc(1) program to determine when the number of files to delete will exceed the MAXDELETE setting in apt-move.conf. if you get this error, make sure that MAXDELETE is 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-move will report this error if the number of files to be deleted exceeds the MAXDELETE setting in apt-move.conf. you need to study the output to determine if this is normal (in which case you can override this using the force parameter), 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 master Packages.gz or Sources.gz file.
  • Your current mirror directory is incompatible... β€” you have just upgraded from an old version of apt-move. update your configuration, then run apt-move fsck and finally remove .apt-move/ancient.
  • Could not read Release files. β€” apt-move could not read the release files needed to build the master files. make sure you have run apt-get update and try again.
  • Failed to remove original files. β€” apt-move could not remove the original copies of files that have just entered the apt-move archive. make sure that you have permission to delete those files.
  • Please remove $LOCALDIR/backup. β€” you must remove LOCALDIR/backup before running the fsck command.
  • Unknown DIST setting. β€” the value of DIST must match the Archive field in the Release file of the distribution that you are trying to mirror.
  • Cannot find index files for APTSITES. β€” apt-move could not find any index files for the get operation. you should either run apt-get update, or run apt-move with -f if only the *.local files 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