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

Re: samba-common = 3.0.23d-4 but 3.0.24-2 is installed



On Tue, Feb 06, 2007 at 22:06:20 +0200, Justin Hartman wrote:
> I'm trying to figure this out but apt is telling me that samba-common
> installed on my machine is 3.0.24-2 but the new updated version it
> wants to upgrade to is 3.0.23d-4 which is lower. How is this possible?

I think you are misunderstanding the output of your "apt-get -f install"
command: It wants to replace samba 3.0.23d-4 with version 3.0.24-2. This
is a normal upgrade attempt. The problem is that the pre-removal script
of the package fails for some reason.

> I now can't upgrade, install, remove or anything using apt because of
> this error and I'm not sure what to do to fix it.
> 
> Here is my output:
> 
> debian:/home/justin# apt-get -f install
> Reading package lists... Done
> Building dependency tree... Done
> Correcting dependencies... Done
> The following extra packages will be installed:
>  samba
> Recommended packages:
>  smbldap-tools
> The following packages will be upgraded:
>  samba
> 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> Need to get 0B/3257kB of archives.
> After unpacking 143kB of additional disk space will be used.
> Do you want to continue [Y/n]?
> Preconfiguring packages ...
> (Reading database ... 87264 files and directories currently installed.)
> Preparing to replace samba 3.0.23d-4 (using .../samba_3.0.24-2_i386.deb) ...
> invoke-rc.d: dangling symlink: /etc/rc2.d/K09samba
> dpkg: warning - old pre-removal script returned error exit status 102
> dpkg - trying script from the new package instead ...
> invoke-rc.d: dangling symlink: /etc/rc2.d/K09samba
> dpkg: error processing /var/cache/apt/archives/samba_3.0.24-2_i386.deb
> (--unpack):
> subprocess new pre-removal script returned error exit status 102
> Errors were encountered while processing:
> /var/cache/apt/archives/samba_3.0.24-2_i386.deb
> E: Sub-process /usr/bin/dpkg returned an error code (1)

You have to make sure that the prerm script can complete without errors.
It might be enough to delete the dangling symlink that invoke-rc.d
complains about. (/etc/rc2.d/K09samba) However, I suspect that the
command actually wants to follow the symlink to stop the samba daemons,
so this may not work. (It looks like your /etc/init.d/samba might be
missing for some reason.)

What should work is to trick dpkg (and hence apt) into thinking that the
script was successful. To do this cleanly you should first stop the
samba daemons yourself. (Stopping these daemons is all that the prerm
script is supposed to do.) You can run

ps -ef | grep [sn]mbd 

to check if smbd and nmbd are still running. If they are you have to
kill them manually. Once they are dead you should remove their PID files

/var/run/samba/nmbd.pid
/var/run/samba/smbd.pid

if they are still there.

Once you have shut down the daemons like this you can simply "castrate"
the prerm script. Edit the file

/var/lib/dpkg/info/sambe.prerm

so that its first two lines look like this:

#!/bin/sh
exit 0

i.e. insert "exit 0" right below the first line.

This will cause the script to exit immediately once it is called.
Now it should be possible to upgrade the package. During the upgrade the
"castrated" prerm script will be replaced with the normal one from the
new package and everything should be A-OK again. (Check to make sure,
though.)

One final disclaimer: I think this will work without (further) damaging
your system, but I cannot guarantee anything. Use this mail at your own
risk.

-- 
Regards,
          Florian



Reply to: