[7859] in Release_7.7_team

home help back first fref pref prev next nref lref last post

Re: recovery hook to clean up /boot

daemon@ATHENA.MIT.EDU (Jonathan Reed)
Wed Dec 19 16:26:57 2012

Date: Wed, 19 Dec 2012 16:26:49 -0500 (EST)
From: Jonathan Reed <jdreed@MIT.EDU>
To: Geoffrey Thomas <geofft@MIT.EDU>
cc: release-team@MIT.EDU
In-Reply-To: <alpine.DEB.2.00.1212191317490.5325@team-rocket.mit.edu>
Message-ID: <alpine.DEB.2.02.1212191624060.25010@infinite-loop.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

The recovery hook is guaranteed to run.  I... actually have no idea what 
happens if apt-get attempts to upgrade the kernel package and /boot is 
full.  Hopefully unpacking fails cleanly?  I also don't know what happens 
if /boot is at 100% and grub is updated via the postinstall hook.  It's 
probably worth testing these before pushing this out.  Because removing 
the kernel will also trigger a grub reconfiguration, I'd hate for grub to 
now end up trying to boot a nonexistent or broken kernel.

-Jon

On Wed, 19 Dec 2012, Geoffrey Thomas wrote:

> Looks reasonable. But do we need a recovery hook for this, or can we push 
> this logic into the autoupdater and wait for its next run?
>
> -- 
> Geoffrey Thomas
> geofft@mit.edu
>
> On Tue, 18 Dec 2012, Jonathan Reed wrote:
>
>> We apaprently filled up /boot on a bunch of cluster workstations, and users 
>> are helpfully getting notified about this.  We need to clean it up.
>> 
>> I propose the following recovery hook.  (Cluster workstations should only 
>> have linux-image-generic).   I plan to push this out on the 26th unless 
>> people object.  (I'm not here on the 21st, and, uh, that's a bad day to 
>> push out additional things)
>> 
>> Silence will be interpreted as approval.
>> 
>> #!/bin/bash
>> 
>> kernels=$(dpkg-query -W -f '${Package}\n' linux-image-\*-generic | sed -e 
>> 's/^linux-image-//' | sort -V)
>> numkernels=$(echo "$kernels" | wc -l)
>> if [ $numkernels -le 2 ]; then
>>    exit 0
>> fi
>> toremove=$(echo "$kernels" | head -$(($numkernels-2)))
>> kpkgs=
>> for k in $toremove; do
>>    if [ "$(uname -r)" != "$k" ]; then
>> 	kpkgs="$kpkgs linux-image-$k"
>>    fi
>> done
>> if apt-get -s remove $kpkgs; then
>>    apt-get remove $kpkgs
>> fi
>> 
>> 
>> 
>

home help back first fref pref prev next nref lref last post