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

Re: Question about dpkg -r



Hope Duryea <hope_duryea@yahoo.com> writes:

> --- Ian Jackson <ian@davenant.greenend.org.uk> wrote:
>
>> Hope Duryea writes ("Re: Question about dpkg -r "):
>> > dpkg did not need to create /usr (the symlink),
>> > but it wants to -- and does -- remove it just the
>> > same. As I mentioned before, there are plenty of
>> > other files under there, but none that came from
>> > a debian package.
>> 
>> Ohhhhh!
>> 
>> This is not a supported configuration.  Don't do
>> that then.
>
> Are you saying debian packages can only be used on
> systems where the entire system is comprised solely of
> things installed as debian packages? I was hoping I
> could use debian packages for additional material to
> be installed on an existing (non-debian) system.

No, he is saying (or meaning or whatever) that if you mix directories
controlled by dpkg with stuff you manage manually then odd things will
happen.

You installed some package with files in /usr and now you removed the
last package having files there. dpkg will naturally try to clean
up. With /usr being a link your manual files under /usr/./ won't
prevent that cleanup (and imho should not).

If you need to install stuff outside the packagin system I suggest you
use directories outside of dpkgs control for that, like
/usr/local/. Subdirs in /usr/local are specifically made outside of
the dpkg database to prevent removals.

[And I still don't get how you manage to create a debian system with
no package claiming /usr any more. No libc6 installed?]

>> If you absolutely must do this, create a dummy
>> package to contain /usr.
>
> Can you say what you mean by a "dummy package"?

Create a Debian package that contains just
/usr/share/doc/dummy/changelog saying that it is a dummy package to
keep /usr alive.

>> I do agree that this behaviour might occur on a real
>> Debian system in some obscure corner of the
>> filesystem but the situation has to be very
>> contrived.  It can only happen to a directory which
>> is present in only one package but which the
>> sysadmin has made be a symlink elsewhere.
>
> By "made be a symlink elsewhere", I take it you mean
> "created the symlink, before installing any debian
> package that installs into the (symlink) dir." If so,
> then yes, that describes my situation -- all the
> symlinks that exist under / (usr, etc, opt, and so on)
> exist up-front, before I install any packages, which
> is why I don't want dpkg to remove them (since it
> didn't create them in the first place).

You can also 'mv dir /new/place; ln /new/place dir' after the
fact. Makes no difference to dpkg.

Dpkg does not care about who created a dir or symlink but only about
how many packages are providing it. Always when the last package
providing a directory gets removed that directory (or symlink if you
meddled) gets removed if possible.

mrvn@frosties:~% dpkg -S /opt
dpkg: /opt not found.
mrvn@frosties:~% dpkg -S /usr/local
dpkg: /usr/local not found.
mrvn@frosties:~% dpkg -S /srv      
dpkg: /srv not found.

Some directories are specifically not put into dpkg control but
created manually in maintainer scripts to avoid removals. Specifically
those dirs where admins are supposed to do what they want without dpkg
interference. Use them.


> Thanks,
> Hope

MfG
        Goswin



Reply to: