[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can't deinstall package



On Tue, 17 Jun 1997, Christian Hudon wrote:

> On Jun 18, Mark Phillips wrote
> > 
> > Thanks for the advice.  I gave it a go and came up with:
> > 
> > # dpkg --remove --force-remove-reinstreq kernel-source-1.99.7
> > dpkg - warning, overriding problem because --force enabled:
> >  Package is in a very bad inconsistent state - you should
> >  reinstall it before attempting a removal.
> > (Reading database ... 28305 files and directories currently installed.)
> > Removing kernel-source-1.99.7 ...
> > The file /usr/src/.linux-versions does not exist. This is an 
> > misconfiguration, making it hard to provide a /usr/src/linux
> > symlink if the latest target is removed.
> > 
> > Please Hit return to continue.
> > 
> > Error: /usr/src/linux not a symbolic link, not removing.
> > dpkg: error processing kernel-source-1.99.7 (--remove):
> >  subprocess post-removal script returned error exit status 1
> > Errors were encountered while processing:
> >  kernel-source-1.99.7
> > 
> > So I still can't get rid of it.  Any more ideas?
> 
> Hmm.
> 
> You installed your own kernels over the one that kernel-source-1.99.7 had
> installed, right? Did you remove the 1.99.7 kernel source tree by hand or
> is it still lying around somewhere under /usr/src or have you moved it
> somewhere else?

Wrong.  I have not done anything by hand relating to kernels.  I think
the problem arose originally when I first installed Debian.  I installed
Debian 1.1 after it had just come out.  The kernel it provided was 2.0
hot off the press (so it could claim to be the first distribution with
the 2.0 kernel).  However the source package that went with it was
the 1.99.7 one.  For some reason I don't think it installed properly
back then.  I didn't worry about it at the time as I had no need to
"roll my own" kernel and I had other difficulties to worry about.
I have upgraded my system a number of times (currently 1.3) and each
time the problem with kernel-source-1.99.7 has remained.  It's only
recently that I've tried to fix the problem and it seems I can't.

> Could you also tack on the contents of the postinst script
> (i.e. /var/lib/dpkg/info/kernel-source-1.99.7.postinst) to your next
> message? 

I have included it at the end of the message.

Thanks.

-----------------------------------------------------------------------------
Mark Phillips                                      mark@maths.flinders.edu.au
           "They told me I was gullible ... and I believed them!"
-----------------------------------------------------------------------------

/var/lib/dpkg/info/kernel-source-1.99.7.postinst:

#! /bin/perl
#                              -*- Mode: Perl -*- 
# debian.postinst --- 
# Author           : Manoj Srivastava ( srivasta@pilgrim.umass.edu ) 
# Created On       : Sat Apr 27 05:42:43 1996
# Created On Node  : melkor.pilgrim.umass.edu
# Last Modified By : root
# Last Modified On : Sun May 19 02:36:13 1996
# Last Machine Used: melkor.pilgrim.umass.edu
# Update Count     : 7
# Status           : Unknown, Use with caution!
# HISTORY          : 
# Description      : 
# 
# 


$|=1;

# Predefined values:
my $package="kernel-source-1.99.7";

# Ignore all invocations uxcept when called on to configure.
exit 0 unless ($ARGV[0] && $ARGV[0] =~ /configure/);

# most of our work is done in /usr/src.
chdir '/usr/src' or die "Could not chdir to /usr/src:$!";

# Test if we need to do anything at all. This test and exit make us
# idempotent. 

if (-e 'linux' && ! -l 'linux') {
  my $answer;
  print STDERR <<"EOF";
 Error configuring $package: /usr/src/linux does not seem to be a 
       symbolic link, possibly from an old package or a left-over from a 
       user installed kernel. Please remove /usr/src/linux and try to
       reconfigure $package.  

 Please Hit return to continue.
EOF
  $answer = <STDIN>;
  exit 1;
}

# fine.  We now have a link.
my $old_target='';
$old_target = readlink('linux') if -e 'linux';
die "could not read link /usr/src/linux:$!" unless defined $old_target;

# before we change the link, let us make sure that if the file
# .linux-versions exists, we can read and write to it.
if (-f '.linux-versions') {
  my $answer;
  if (! -r '.linux-versions' && -w _) {
    print STDERR <<"ERR";
 The file /usr/src/.linux-versions should be read and writable. ($!)
 Please change permissions and reconfigure $package.

 Please Hit return to continue.
ERR
  ;
    $answer = <STDIN>;
    exit 1;
  }
}
else {
  my $answer;
  open(REGISTRY,">>/usr/src/.linux-versions") || do {
    print STDERR <<"ERR";
 The file /usr/src/.linux-versions should be read and writable. ($!)
 Please change permissions and reconfigure $package.

 Please Hit return to continue.
ERR
  ;
    $answer = <STDIN>;
    exit 1;
  };
  print REGISTRY <<"REG";
# This is a list of the current versions of Linux kernel sources or
# kernel header packages on the system.
REG
  ;
  close(REGISTRY);
}

## Another paranoid check before we do anything:
if (! -d "$package") {
  my $answer;
  print STDERR "I could not find the directory /usr/src/$package.\n";
  print STDERR "This is very, very, wrong. I'm not changing the \n";
  print STDERR "/usr/src/linux link.\n\n";
  print STDERR "Please Hit return to continue.\n";
  $answer = <STDIN>;
  exit 1;
}
if ("$old_target" ne "$package") {
  if (-e 'linux') {
    if (! unlink 'linux') {
      print STDERR <<"ERR";
  Could not remove /usr/src/linux to relink:$!
  Please change permissions and reconfigure $package.
ERR
      exit 1;
    }
  }
  if (! symlink $package, 'linux') {
    print STDERR <<"ERR";
  Could not link /usr/src/$package to /urs/src/linux.  
  Please add the link by hand.
ERR
  ;
  }
}


if (open(REGISTRY,"/usr/src/.linux-versions")) {
  $/ = 0777;
  my $name=<REGISTRY>;
  close (REGISTRY);
  if ($name !~ m/$package/) {
    if (open(REGISTRY,">>/usr/src/.linux-versions")) {
      print REGISTRY "$package\n";
      close(REGISTRY);
    }
    else {
      warn "Error registering $package in /usr/src/.linux-versions: $!";
    }
  }
}
else {
  warn "Error registering $package in /usr/src/.linux-versions: $!"; 
}

chdir "/usr/src/$package/include" ||
  die "Could not chdir to  /usr/src/$package/include:$!";

my $architecture;
chomp ($architecture = `dpkg --print-architecture`);

if (! -d "asm-$architecture") {
  warn "/usr/src/$package/include/asm-$architecture does not exist.\n";
  exit 0;
}

if (-e 'asm') {
  if (! -l 'asm') {
    warn "/usr/src/$package/include/asm is not a symlink.\n";
    exit 0;
  }
  else {
    my $target=readlink 'asm';
    if ("$target" eq "asm-$architecture") {
      exit 0;
    }
    if (! unlink 'asm') {
      warn "could not unlink /usr/src/$package/include/asm: $!\n";
      warn "It points to /usr/src/$package/include/$target\n";
      die  "rather than at /usr/src/$package/include/asm-$architecture\n";
    }
  }
}
if (! symlink "asm-$architecture", 'asm') {
  warn "Could not link /usr/src/$package/include/asm:$!\n";
  die "It should point to /usr/src/$package/include/asm-$architecture\n";
}

exit 0
__END__




--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: