• Rob's side project: I recently started Gun-Forums.com and we currently have a $100 raffle - if you're into guns, join up and enter the raffle to win $100.00. Raffle Link

Linux+: Applications 16 – Options for dpkg

J

Jarret W. Buse

Guest
Linux+: Applications 16 – Options for dpkg

As you have seen in the previous articles for the dpkg command, there are numerous actions available. There also exists many options which will be covered in this article.

The command dpkg has the following syntax:

dpkg <actions> <options> <package_names>

NOTE: The command must have one action and zero or more options. Most of these require Root privileges, so place sudo before dpkg when needed.

The commands are used in conjunction with all or some of the available actions.

The options are as follows:

  • --abort-after=#
  • -B (--auto-deconfigure)
  • -D# (--debug=#)
  • --force-things
  • --no-force-things (--refuse-things)
  • --ignore-depends=package
  • --new
  • --old
  • --nocheck
  • --no-act, --dry-run, --simulate
  • -R (--recursive)
  • -G
  • --admindir=directory
  • --instdir=directory
  • --root=directory
  • -O (--selected-only)
  • -E (--skip-same-version)
  • --pre-invoke=command
  • --post-invoke=command
  • --log=filename
  • --no-debsig
  • --no-triggers
  • --triggers

The option --abort-after is used to specify how many errors can occur before the whole command aborts. The default is 50, but can be set to another number. To specify to abort the dpkg command after 100 errors when installing the rar package, the following can be used:

sudo dpkg -i --abort-after=100 rar_4.2.0-1_amd64.deb

When packages are removed from a system other packages may be dependent on it. To deconfigure the packages which were dependent on the removed package do the following:

sudo dpkg -r -B rar

To switch the debugger on, there is one option, but many levels.

For help with debugging options, use the “--D(octal)” action. The octal value is given as one of the following:

• 1 - General help progress information
• 2 - Invocation and status of maintainer scripts
• 10 - Output for each file processed
• 100 - A lot of output for each file processed
• 20 - Output for each configuration file
• 200 - A lot of output for each configuration file
• 40 - Displays dependencies and conflicts
• 400 - A lot of dependencies/conflicts output
• 10000 - Trigger activation and processing
• 20000 - A lot of output regarding triggers
• 40000 - Major amounts of output regarding triggers
• 1000 - Extra information about e.g. the dpkg/info dir
• 2000 - Extreme amounts of output information

For example, debug output can be used for the removal of a package as follows:

sudo dpkg -r –D2000 rar

To force specific things, use the --force=things option. The “things” are as follows:

  • all – turn on all force options
  • downgrade – install a specific package even if a newer one exists on the system
  • configure-any – configures any unpacked item on which the current package depends
  • hold – process packages marked as “hold”
  • remove-reinstreq – remove a package even if it is broken and marked fro reinstallation
  • remove-essential – package will be removed even if it is essential to the system
  • depends – dependency issues will become warnings
  • depends-version – cause version checking on dependencies to be ignored
  • breaks – installs a package even if it would break another package
  • conflicts – installs a package even if it conflicts with another package
  • confmiss – install a missing conffile no matter what
  • confnew – always install a new conffile without prompting to overwrite the old conffile
  • confold – old conffile is kept and not overwritten or prompts user
  • confdef – choose default action for overwriting conffile
  • overwrite – overwrite one package with another
  • overwrite-dir – overwrite one package directory with another
  • overwrite-diverted – overwrite a diverted file with an undiverted file
  • architecture – process packages with improper architecture
  • bad-path – a path is missing important files
  • not-root – installs even when not root user
  • bad-verify – install package even with failed authentication check

If you want to skip dependency checking on a package, use the “--ignore-depends” option as follows:

sudo dpkg -i --ignore-depends=rar rar_4.2.0-1_amd64.deb

To select from the “old” or “new” binary format, use wither the “--old” or “--new” option as follows:

sudo dpkg -i --old rar_4.2.0-1_amd64.deb

To not read or check the contents of the control file, use the following:

sudo dpkg -i --nocheck rar_4.2.0-1_amd64.deb

To perform a simulated install without actually writing or changing any files, use “--no-act”, “ --dry-run” or “--simulate” as follows:

sudo dpkg -i --no-act rar_4.2.0-1_amd64.deb

To perform an action on multiple packages with a similar filename pattern on a folder and all subfolders, do the following:

sudo dpkg -i -R rar*.deb

Sometimes, you may try to install a package which is already installed. In this case, you will get errors and prompts of what to do. If a newer version exists, the older version will not be installed if the “-G” option is used:

sudo dpkg -i –G rar_4.2.0-1_amd64.deb

If the dpkg administrative directory is not the default of /var/lib/dpkg, another can be specified as follows:

sudo dpkg -i –admindir=/usr/lib/dpkg rar_4.2.0-1_amd64.deb

If the installation root is not the default of “/”, it can be specified as shown:

sudo dpkg -i --instdir=/usr/root rar_4.2.0-1_amd64.deb

If you want to change both the root and installation directory, you can use the “--root=” option. The directory specified will change the instdir to “dir” and the admindir to “dir/var/lib/dpkg” as shown:

sudo dpkg -i --root=place rar_4.2.0-1_amd64.deb

To process packages marked as selected for installation, use the –O or --selected-only option as shown:

sudo dpkg -i -O rar_4.2.0-1_amd64.deb

If you wish to not install a package if the same version already is installed, do the following:

sudo dpkg -i –E rar_4.2.0-1_amd64.deb

To produce a log of status change, use the “--log” option and specify a path and filename for the log. The default is /var/log/dpkg.log and is changed as shown:

sudo dpkg -i --log=fileout rar_4.2.0-1_amd64.deb

If the package file signature should not be checked, perform the following:

sudo dpkg -i --no-debsig rar_4.2.0-1_amd64.deb

To not perform the triggers during the install, do the following:

sudo dpkg -i --no-triggers rar_4.2.0-1_amd64.deb

If you perform the “--no-triggers” option, you can undo the option as shown:

sudo dpkg -i --triggers rar_4.2.0-1_amd64.deb

Be aware of these options and try them to see what works and how they work. These can be very important to remember when using the dpkg command.
 

Attachments



Members online


Top