<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:schema="http://schema.org/" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" version="2.0" xml:base="https://www.linuxjournal.com/tag/dpkg">
  <channel>
    <title>dpkg</title>
    <link>https://www.linuxjournal.com/tag/dpkg</link>
    <description/>
    <language>en</language>
    
    <item>
  <title>Clearing Out /boot</title>
  <link>https://www.linuxjournal.com/content/clearing-out-boot</link>
  <description>  &lt;div data-history-node-id="1339989" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/bigstock-Education-concept-Head-With-F-61652528_0.jpg" width="800" height="600" alt="""" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/adam-mcpartlan" lang="" about="https://www.linuxjournal.com/users/adam-mcpartlan" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Adam McPartlan&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
&lt;em&gt;The /boot partition sometimes needs a bit of attention. If you enable
automatic updates, it will fill up with old kernels that you'll probably
never need. It also will stop you from running aptitude to install or remove
anything. If you find yourself in this situation, you can use
dpkg to get
around it. dpkg is the higher-level package manager in Debian-based
distributions, and it's very useful when aptitude has broken.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;
To see the status of your partitions, run: &lt;code&gt;df -h&lt;/code&gt;:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
Filesystem      Size  Used Avail Use% Mounted on
udev            3.0G   12K  3.0G   1% /dev
tmpfs           597M  528K  597M   1% /run
/dev/dm-0        97G   14G   78G  15% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            3.0G     0  3.0G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/sda1       228M  219M     0 100% /boot
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
If you look in the directory /boot, you will see it full of old kernels and
images. It is not advisable just to delete them, as you can break your system.
Run &lt;code&gt;uname -r&lt;/code&gt;, which will tell you what kernel you are currently
on:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
3.13.0-137-generic
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
Let's find out which kernels are installed and which can be purged from
your system. To do this, run the following:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
dpkg --list "linux-image*" | grep -v $(uname) | grep ii
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
This will use &lt;code&gt;dpkg&lt;/code&gt; to list all Linux kernel images (excluding the one you are
using) that are installed.
&lt;/p&gt;

&lt;p&gt;
The output still might be quite long, so let's refine it by piping the results in
to &lt;code&gt;awk&lt;/code&gt;. The &lt;code&gt;awk&lt;/code&gt; command below is an instruction to print the second column
from the output:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
dpkg --list "linux-image*" | grep -v $(uname -r) |
 ↪grep ii | awk '{ print $2 }'
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
This provides a list to work with, and you can stick it in a script or run it
from the command line to purge them all.
&lt;/p&gt;

&lt;p&gt;
&lt;em&gt;Caution:&lt;/em&gt; make sure the kernel you are using is not in the list. You
should have eliminated that when you specified &lt;code&gt;grep -v $(uname
-r)&lt;/code&gt;. The &lt;code&gt;-v&lt;/code&gt;
tells &lt;code&gt;grep&lt;/code&gt; to exclude anything that contains the output of &lt;code&gt;uname -r&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
If you are happy and have sudo privileges, go ahead:

&lt;/p&gt;&lt;pre&gt;
&lt;code&gt;
sudo dpkg --purge $(dpkg --list "linux-image*" | grep -v
 ↪$(uname -r) | grep ii | awk '{ print $2 }')
&lt;/code&gt;
&lt;/pre&gt;


&lt;p&gt;
To finish off, run &lt;code&gt;sudo update-grub2&lt;/code&gt;. This will ensure that grub is updated with
the available kernels. Otherwise, you may be heading for trouble. Then fix
aptitude by running: &lt;code&gt;sudo apt-get -f install&lt;/code&gt;, followed by &lt;code&gt;sudo apt-get
auto remove&lt;/code&gt; to clear the images out of aptitude.
&lt;/p&gt;

&lt;p&gt;
Look at your partition, and you will see that it has free space:

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/clearing-out-boot" hreflang="en"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Fri, 29 Jun 2018 12:00:00 +0000</pubDate>
    <dc:creator>Adam McPartlan</dc:creator>
    <guid isPermaLink="false">1339989 at https://www.linuxjournal.com</guid>
    </item>

  </channel>
</rss>
