Size: 337
Comment: Reinstall conf files
|
← Revision 15 as of 2024-08-06 22:40:29 ⇥
Size: 3278
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
<<TableOfContents>> |
|
Line 8: | Line 10: |
# Remove old kernels # from: http://chr4.org/blog/2013/08/04/apt-get-cleanup-commands/ apt-get purge $(dpkg --list |egrep 'linux-image-[0-9]' |awk '{print $3,$2}' |sort -nr |tail -n +2 |grep -v $(uname -r) |awk '{ print $2}') # List packages that are uninstalled, but configuration remains dpkg --list |grep '^rc' |awk '{print $2}' # Remove those packages apt-get purge -y $(dpkg --list |grep '^rc' |awk '{print $2}') apt-get autoremove -y # Remove dependencies no longer required # Save automatically installed packages aptitude search '?installed?not(?automatic)' -F %p > packages.txt # or apt-mark showmanual | sort --unique > packages.txt # ...then install those packages... aptitude install `cat packages.txt` # This may contain too many packages, so instead run: cat packages.txt | xargs -n 100 aptitude install --schedule-only; aptitude |
|
Line 9: | Line 32: |
== Building packages == If using dpkg-buildpackage to build a customized package (one for which you've not made a formal patch), you may get an error that looks like: {{{ dpkg-source: info: using source format `3.0 (quilt)' dpkg-source: info: building cairo using existing ./cairo_1.13.0~20140204.orig.tar.xz dpkg-source: info: local changes detected, the modified files are: cairo-1.13.0~20140204/src/cairo-ft-font.c dpkg-source: info: you can integrate the local changes with dpkg-source --commit dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/cairo_1.13.0~20140204-0ubuntu1.diff.Rho4ow dpkg-buildpackage: error: dpkg-source -b cairo-1.13.0~20140204 gave error exit status 2 }}} This is because dpkg-buildpackage wants to create a source package, but with an unexpected change a source package may get built that does not match the binary. To fix this, pass the '-b' option to only build a binary: {{{#!highlight sh dpkg-buildpackage -b -uc }}} To build for another architecture (cross compile), use {{{#!highlight sh dpkg-buildpackage -b -uc -ai386 }}} == Building packages from another distribution (e.g. testing) == Add deb-src line for the repository (Q: how do you specify from where to fetch the package?). Then: {{{#! highlight sh aptitude install build-essential fakeroot devscripts apt-get build-deb $PACKAGE apt-get -b source $PACKAGE # Install the created *.deb file }}} == Fixing locale issues == tl;dr: use UTF-8. To set the system default locale: {{{#! highlight sh numbers=off sudo update-locale LANG=en_US.UTF-8 }}} If this doesn't work, may need to regenerate locale: {{{#! highlight sh sudo locale-gen en_US.UTF-8 }}} if this fails, may need to use dpkg interactively: {{{#! highlight sh sudo dpkg-reconfigure locales }}} and select en_US.UTF-8. == Links == * [[https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/|Unofficial non-free installation images including firmware packages]] |
Contents
1 # What packages use the most disk space?
2 dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -n
3
4 # Reinstall conf files
5 sudo dpkg -i --force-confmiss /var/cache/apt/archives/whatever*deb
6 sudo aptitude install -o 'Dpkg::Options::=--force-confmiss' whatever # Doesn't work?
7
8 # Remove old kernels
9 # from: http://chr4.org/blog/2013/08/04/apt-get-cleanup-commands/
10 apt-get purge $(dpkg --list |egrep 'linux-image-[0-9]' |awk '{print $3,$2}' |sort -nr |tail -n +2 |grep -v $(uname -r) |awk '{ print $2}')
11
12
13 # List packages that are uninstalled, but configuration remains
14 dpkg --list |grep '^rc' |awk '{print $2}'
15 # Remove those packages
16 apt-get purge -y $(dpkg --list |grep '^rc' |awk '{print $2}')
17 apt-get autoremove -y # Remove dependencies no longer required
18
19 # Save automatically installed packages
20 aptitude search '?installed?not(?automatic)' -F %p > packages.txt
21 # or
22 apt-mark showmanual | sort --unique > packages.txt
23
24 # ...then install those packages...
25 aptitude install `cat packages.txt`
26 # This may contain too many packages, so instead run:
27 cat packages.txt | xargs -n 100 aptitude install --schedule-only; aptitude
Building packages
If using dpkg-buildpackage to build a customized package (one for which you've not made a formal patch), you may get an error that looks like:
dpkg-source: info: using source format `3.0 (quilt)' dpkg-source: info: building cairo using existing ./cairo_1.13.0~20140204.orig.tar.xz dpkg-source: info: local changes detected, the modified files are: cairo-1.13.0~20140204/src/cairo-ft-font.c dpkg-source: info: you can integrate the local changes with dpkg-source --commit dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/cairo_1.13.0~20140204-0ubuntu1.diff.Rho4ow dpkg-buildpackage: error: dpkg-source -b cairo-1.13.0~20140204 gave error exit status 2
This is because dpkg-buildpackage wants to create a source package, but with an unexpected change a source package may get built that does not match the binary. To fix this, pass the '-b' option to only build a binary:
1 dpkg-buildpackage -b -uc
To build for another architecture (cross compile), use
1 dpkg-buildpackage -b -uc -ai386
Building packages from another distribution (e.g. testing)
Add deb-src line for the repository (Q: how do you specify from where to fetch the package?). Then:
aptitude install build-essential fakeroot devscripts apt-get build-deb $PACKAGE apt-get -b source $PACKAGE # Install the created *.deb file
Fixing locale issues
tl;dr: use UTF-8. To set the system default locale:
sudo update-locale LANG=en_US.UTF-8
If this doesn't work, may need to regenerate locale:
sudo locale-gen en_US.UTF-8
if this fails, may need to use dpkg interactively:
sudo dpkg-reconfigure locales
and select en_US.UTF-8.