DEBMIRROR(1)
π debmirror(1) π
User Contributed Perl Documentation but make it bestie. β¨
β¨ NAME β¨
debmirror β Debian partial mirror script, with ftp, http or rsync and package pool support
πΈ SYNOPSIS πΈ
debmirror [options] mirrordir
π¦ DESCRIPTION π¦
okay so this program downloads and maintains a partial local Debian mirror. It can mirror any combination of architectures, distributions, and sections. Files are transferred by ftp, and package pools are fully supported. It also does locking and updates trace files.
not me making a whole mirror π but fr fr, the partial mirror created by this program is not suitable to be used as a public Debian mirror. If that's your aim, you should instead follow the instructions at http://www.debian.org/mirrors/ftpmirror.
warning: don't use this as a public Debian mirror, bestie. That's a different vibe entirely.
This program mirrors in three steps.
- download Packages and Sources files β First it downloads all
PackagesandSourcesfiles for the subset of Debian it was instructed to get. - download everything else β The
PackagesandSourcesfiles are scanned, to build up a list of all the files they refer to. A few other miscellaneous files are added to the list. Then the program makes sure that each file in the list is present on the local mirror and is up-to-date, using file size (and optionally checksum) checks. Any necessary files are downloaded. - clean up unknown files β Any files and directories on the local mirror that are not in the list are removed.
π OPTIONS π
okay bestie, here's the whole menu of flags and args. don't skip any, they're all iconic in their own way.
mirrordirβ This required (unless defined in a configuration file) parameter specifies where the local mirror directory is. If the directory does not exist, it will be created. Be careful; telling this program that your home directory is themirrordiris guaranteed to replace your home directory with a Debian mirror! π-p,--progressβ Displays progress bars as files are downloaded. β¨-v,--verboseβ Displays progress between file downloads.--debugβ Enables verbose debug output, including ftp protocol dump.--dry-runβ Simulate a mirror run. This will still download the meta files to the./.tempworking directory, but won't replace the old meta files, won't download debs and source files and only simulates cleanup.--helpβ Display a usage summary.--versionβ Print version number and exit.-h,--host=remotehostβ Specify the remote host to mirror from. Defaults toftp.debian.org, you are strongly encouraged to find a closer mirror. fr fr, find a closer mirror, your bandwidth will thank you.-r,--root=directoryβ Specifies the directory on the remote host that is the root of the Debian archive. Defaults todebian, which will work for most mirrors. The root directory has adistssubdirectory.--method=methodβ Specify the method to download files. Currently, supported methods areftp,http,https, andrsync. Thefilemethod is experimentally supported. π§ͺ--passiveβ Download in passive mode when using ftp.-u,--user=remoteusernameβ Specify the remote user name to use to log into the remote host. Defaults to"anonymous".--passwd=remoteuserpasswordβ Specify the remote user password to use to log into the remote ftp host. It is used with--userand defaults to"anonymous@".--proxy=http://user:pass@url:port/β Specifies the http proxy (like Squid) to use for http or ftp methods.-d,--dist=foo[,bar,..]β Specify the distribution (etch,lenny,squeeze,sid) of Debian to mirror. This switch may be used multiple times, and multiple distributions may be specified at once, separated by commas.
You may also use the stable, testing, unstable, names.
--omit-suite-symlinksβ With this option set, debmirror will not create the symlink from suite to codename. This is needed for example when mirroring archived Debian releases as they will all have either"stable"or"oldstable"as suite in theirReleasefiles.-s,--section=foo[,bar,..]β Specify the section of Debian to mirror. Defaults to"main,contrib,non-free,non-free-firmware,main/debian-installer".-a,--arch=foo[,bar,..]β Specify the architectures to mirror. The default is--arch=i386. Specifying--arch=nonewill mirror no archs.--rsync-extra=foo[,bar,..]β Allows you to also mirror files from a number of directories that are not part of the package archive itself.
Debmirror will always use rsync for the transfer of these files, irrespective of what transfer method is specified in the --method option. This will therefore not work if your remote mirror does not support rsync, or if the mirror needs a different --root option for rsync than for the main transfer method specified with --method.
Note that excluding individual files in the directories is not supported.
The following values are supported.
docβ Download all files and subdirectories indocdirectory, and allREADMEfiles in the root directory of the archive.indicesβ Download all files and subdirectories inindicesdirectory. Note that this directory can contain some rather large files; don't include this type unless you know you need these files.toolsβ Download all files and subdirectories intoolsdirectory.traceβ Download the remote mirror's trace files for the archive (project/trace/*). This is enabled by default.noneβ This can be used to disable getting extra files with rsync.
If specified, the update of trace files will be done at the beginning of the mirror run; the other types are done near the end.
This switch may be used multiple times, and multiple values may be specified at once, separated by commas; unknown values are ignored.
--di-dist=dists | foo[,bar,..]β Mirror current Debian Installer images for the specified dists. See further the section "Mirroring Debian Installer images" below.--di-arch=arches | foo[,bar,..]β Mirror current Debian Installer images for the specified architectures. See further the section "Mirroring Debian Installer images" below.--sourceβ Include source in the mirror (default).--nosourceβ Do not include source.--i18nβ Additionally downloadTranslation-<lang>.*files, which contain translations of package descriptions. Selection of specific translations is possible using the--includeand--excludeoptions. The default is to download only the English file.--getcontentsβ Additionally downloadContents.<arch>.gzfiles. Note that these files can be relatively big and can change frequently, especially for thetestingandunstablesuites. Use of the available diff files is strongly recommended (see the--diffoption).--checksumsβ Use checksums to determine if files on the local mirror that are the correct size actually have the correct content. Not enabled by default, because it is too paranoid, and too slow.
When the state cache is used, debmirror will only check checksums during runs where the cache has expired or been invalidated, so it is worth considering to use these two options together.
--ignore-missing-releaseβ Don't fail if theReleasefile is missing.--check-gpg,--no-check-gpgβ Controls whether gpg signatures from theRelease.gpgfile should be checked. The default is to check signatures.--keyring=fileβ Usefileas an additional gpg-format keyring. May be given multiple times.
Note that these will be used in addition to $GNUPGHOME/trustedkeys.gpg. The latter can be removed from the set of keyrings by setting $GNUPGHOME to something non-existent when using this option.
On a typical Debian system, the Debian archive keyring can be used directly with this option:
debmirror --keyring /usr/share/keyrings/debian-archive-keyring.gpg ...
--ignore-release-gpgβ Don't fail if theRelease.gpgfile is missing. If the file does exist, it is mirrored and verified, but any errors are ignored.--ignore=regexβ Never delete any files whose filenames match theregex. May be used multiple times.--exclude=regexβ Never download any files whose filenames match theregex. May be used multiple times.--include=regexβ Don't exclude any files whose filenames match theregex. May be used multiple times.--exclude-deb-section=regexβ Never download any files whose Debian Section (games,doc,oldlibs,science, ...) match theregex. May be used multiple times.--limit-priority=regexβ Limit download to files whose Debian Priority (required,extra,optional, ...) match theregex. May be used multiple times.--exclude-field=fieldname=regexβ Never download any binary packages where the contents offieldnamematch theregex. May be used multiple times. If this option is used and the mirror includes source packages, only those source packages corresponding to included binary packages will be downloaded.--include-field=fieldname=regexβ Don't exclude any binary packages where the contents offieldnamematch theregex. May be used multiple times. If this option is used and the mirror includes source packages, only those source packages corresponding to included binary packages will be downloaded.-t,--timeout=secondsβ Specifies the timeout to use for network operations (either FTP or rsync). Set this to a higher value if you experience failed downloads. Defaults to300seconds.--max-batch=numberβ Download at mostmax-batchnumber of files (and ignore rest).--rsync-batch=numberβ Download at mostnumberof files with each rsync call and then loop.--rsync-options=optionsβ Specify alternative rsync options to be used. Default options are"-aIL --partial". Care must be taken when specifying alternative options not to disrupt operations, it's best to only add to those options.
The most likely option to add is "--bwlimit=x" to avoid saturating the bandwidth of your link.
--postcleanupβ Clean up the local mirror but only after mirroring is complete and only if there was no error.
This is the default, because it ensures that the mirror is consistent at all times.
--precleanupβ Clean up the local mirror before starting mirroring.
This option may be useful if you have limited disk space, but it will result in an inconsistent mirror when debmirror is running.
The deprecated --cleanup option also enables this mode.
--nocleanupβ Do not clean up the local mirror.--skippackagesβ bestie, this one just skips re-downloading thePackagesandSourcesfiles. Iconic when you already know they're up to date. β¨--diff=use|mirror|noneβ the diff drama. If you say--diff=useand theReleasefile has entries for diff files, debmirror will try to use them to updatePackages,Sources, andContentsfiles (which can significantly reduce the download size for meta files π ), but it will not include them in the mirror. This is the default behavior, and it's giving "no time-consuming diff files for a fast local mirror."
Saying --diff=mirror does the same as use, but it will also include the downloaded diff files in the local mirror. Say --diff=none to completely ignore diff files.
Heads up π«Ά ifrsyncis used as the method to download files and the archive you're mirroring has "rsyncable" gzipped meta files, then--diff=nonemay be the most efficient way to download them. See thegzip(1)man page for info about its rsyncable option.
--gzip-options=optionsβ specify alternative options used when callinggzip(1)to compress meta files after applying diffs. The default options are"-9 -n --rsyncable", which corresponds with the options used to gzip meta files for the main Debian archive.
These options may need to be modified if the checksum of the file as gzipped by debmirror does not match the checksum listed in the Release file (which will result in the gzipped file being downloaded unnecessarily after diffs were successfully applied). π
--slow-cpuβ by default debmirror saves some bandwidth by performing cpu-intensive tasks, like compressing files to generate.gzand.xzfiles. Use this mode if the computer's CPU is slow, and it makes more sense to use more bandwidth and less CPU.
This option implies --diff=none.
--state-cache-days=numberβ save the state of the mirror in a cache file between runs. The cache will expire after the specified number of days, at which time a full check and cleanup of the mirror will be done. While the cache is valid, debmirror will trust that the mirror is consistent with this cache.
The cache is only used for files that have a unique name, i.e. binary packages and source files. If a mirror update fails for any reason, the cache will be invalidated and the next run will include a full check.
Main advantage of using the state cache is that it avoids a large amount of disk access while checking which files need to be fetched. It may also reduce the time required for mirror updates. π₯
--ignore-small-errorsβ normally debmirror will report an error if any deb files or sources fail to download and refuse to update the meta data to an inconsistent mirror. Normally this is a good thing, as it indicates something went wrong during download and should be retried. But sometimes the upstream mirror actually is broken. Specifying--ignore-small-errorscauses debmirror to ignore missing or broken deb and source files but still be pedantic about checking meta files.--allow-dist-renameβ the directory name for a dist should be equal to its Codename and not to a Suite. If the local mirror currently has directories named after Suites, debmirror can rename them automatically. An existing symlink from codename to suite will be removed, but debmirror will automatically create a new symlink suite -> codename (immediately after moving meta files in place). This conversion should only be needed once.--disable-ssl-verificationβ when https is used, debmirror checks that the SSL certificate is valid.
If the server has a self-signed certificate, the check can be disabled with this option.
--debmarshalβ on each pull, keep the repository meta data fromdists/*in a numbered subdirectory, and maintain a symlinklatestto the most recent pull. This is similar to Debmarshal in tracking mode, see debmarshal.debian.net for examples and use. debmirror cleanup is disabled when this flag is specified. Separate pool and snapshot cleanup utilities are available athttp://code.google.com/p/debmarshal/source/browse/#svn/trunk/repository2--config-file=fileβ specify a configuration file. This option may be repeated to read multiple configuration files. By default debmirror reads/etc/debmirror.confand~/.debmirror.conf(see section FILES).
β¨ Experimental options β¨
--retry-rsync-packages=numberβ while downloadingPackagesand related files via rsync, try up to this many times if rsync fails to connect. Defaults to1, to try only once. (A typical nondefault value is10. To try an unlimited number of times, use-1or0.)
π USING DEBMIRROR π
Using regular expressions in options
Various options accept regular expressions that can be used to tune what is included in the mirror. They can be any regular expression valid in perl, which also means that extended syntax is standard. Make sure to anchor regular expressions appropriately: this is not done by debmirror. π
The --include and --exclude options can be combined. This combination for example will, if the --i18n option is used, exclude all Translation files, except for the ones for Portuguese (pt) and Brazillian (pt_BR):
--exclude='/Translation-.*' --include='/Translation-pt.*'
Mirroring Debian Installer images
Debmirror will only mirror the "current" images that are on the remote mirror. At least one of the options --di-dist or --di-arch must be passed to enable mirroring of the images.
The special values "dists" and "arches" can be used to tell debmirror to use the same dists and architectures for D-I images as for the archive, but it is also possible to specify different values. If either option is not set, it will default to the same values as for the archive.
If you wish to create custom CD images using for example debian-cd, you will probably also want add the option "--rsync-extra=doc,tools".
Limitations
There are no progress updates displayed for D-I images. π
Archive size
The tables in the file /usr/share/doc/debmirror/mirror_size give an indication of the space needed to mirror the Debian archive. They are particularly useful if you wish to set up a partial mirror. Only the size of source and binary packages is included. You should allow for around 1-4 GB of meta data (in ./dists/<dist>) per suite (depending in your settings). Plus whatever space is needed for extra directories (e.g. tools, doc) you wish to mirror.
The tables also show how much additional space is required if you add a release on top of its predecessor. Note that the additional space needed for testing and (to a lesser extent) unstable varies during the development cycle of a release. The additional space needed for testing is zero immediately after a stable release and grows from that time onwards.
Note Debmirror keeps an extra copy of all meta data. This is necessary to guarantee that the local mirror stays consistent while debmirror is running.
π EXAMPLES π
Simply make a mirror in /srv/mirror/debian, using all defaults (or the settings defined in debmirror.conf):
debmirror /srv/mirror/debian
Make a mirror of i386 and sparc binaries, main only, and include both unstable and testing versions of Debian; download from 'ftp.nl.debian.org':
debmirror -a i386,sparc -d sid -d etch -s main --nosource \
-h ftp.nl.debian.org --progress $HOME/mirror/debian
Make a mirror using rsync (rsync server is 'ftp.debian.org::debian'), excluding the section 'debug' and the package 'foo-doc':
debmirror -e rsync $HOME/mirror/debian --exclude='/foo-doc_' \
--exclude-deb-section='^debug$'
π¦ FILES π¦
/etc/debmirror.conf~/.debmirror.conf
Debmirror will look for the presence of these files and load them in the indicated order if they exist. See the example in /usr/share/doc/debmirror/examples for syntax.
~/.gnupg/trustedkeys.gpg
When gpg checking is enabled, debmirror uses gpgv to verify Release and Release.gpg using the default keying ~/.gnupg/trustedkeys.gpg. This can be changed by exporting GNUPGHOME resulting in $GNUPGHOME/trustedkeys.gpg being used. (Note that keyring files can also be specified directly with debmirror's --keyring option -- see above).
To add the right key to this keyring you can import it from the debian keyring (in case of the debian archive) using:
gpg --keyring /usr/share/keyrings/debian-archive-keyring.gpg --export \
| gpg --no-default-keyring --keyring trustedkeys.gpg --import
or download the key from a keyserver:
gpg --no-default-keyring --keyring trustedkeys.gpg \
--keyserver keyring.debian.org --recv-keys <key ID>
The <key ID> can be found in the gpgv error message in debmirror:
gpgv: Signature made Tue Jan 23 09:07:53 2007 CET using DSA key ID 2D230C5F
π COPYRIGHT π
This program is copyright 2000-2001, 2010-2014 by Joey Hess <joeyh@debian.org>, under the terms of the GNU GPL (either version 2 of the licence or, at your option, any later version), copyright 2001-2002 by Joerg Wendland <joergland@debian.org>, copyright 2003-2007 by Goswin von Brederlow <goswin-v-b@web.de>, copyright 2009-2010 by Frans Pop <fjp@debian.org>, copyright 2015 by Thaddeus H. Black <thb@debian.org>, and copyright 2016 by Colin Watson <cjwatson@debian.org>.
The author disclaims any responsibility for any mangling of your system, unexpected bandwidth usage bills, meltdown of the Debian mirror network, etc, that this script may cause. See NO WARRANTY section of GPL.
Not me reading "meltdown of the Debian mirror network" and sweating π please mirror responsibly besties.
π AUTHOR π
- Author:
- Joey Hess
<joeyh@debian.org>
- Joey Hess
- Previous maintainers:
- Joerg Wendland
<joergland@debian.org> - Goswin von Brederlow
<goswin-v-b@web.de> - Frans Pop
<fjp@debian.org> - Joey Hess
<joeyh@debian.org> - Thaddeus H. Black
<thb@debian.org>
- Joerg Wendland
- Current maintainer:
- Colin Watson
<cjwatson@debian.org>
- Colin Watson
β MOTTO β
Waste bandwidth -- put a partial mirror on your laptop today!
okay and that's the whole page, bestie π«Ά this is perl v5.42.2, dated 2026-06-16, and it's DEBMIRROR(1) β go forth and mirror, you absolute icon π
β¨
π¦ where this page comes from
- fedora 43: debmirror 2.48-3.fc43 Β· GPL-2.0-or-later
- fedora 44: debmirror 2.48-3.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms