Some packages fail to install with the following message: Collected errors: * check_data_file_clashes: Package <name> wants to install directory /lib/ But that path is currently a file On my system, /lib is a symlink that points to /usr/lib. It seems that opkg is not able to handle this situation.
I don't think package managers are suppose to follow directory symlinks when installing files...it's my understanding that dpkg will fail in that situation too: (bb) adelcast@delcastillo2 ~/dpkg $ tree a_1.0 a_1.0 ├── DEBIAN │ └── control ├── myfile └── tmp ├── lib └── lib64 -> lib/ 4 directories, 2 files (bb) adelcast@delcastillo2 ~/dpkg $ tree b_1.0 b_1.0 ├── DEBIAN │ └── control ├── myfile2 └── tmp └── lib64 └── otherfile (bb) adelcast@delcastillo2 ~/dpkg $ sudo dpkg -i a_1.0.deb Selecting previously unselected package a. (Reading database ... 620831 files and directories currently installed.) Preparing to unpack a_1.0.deb ... Unpacking a (1.0) ... Setting up a (1.0) ... (bb) adelcast@delcastillo2 ~/dpkg $ sudo dpkg -i b_1.0.deb Selecting previously unselected package b. (Reading database ... 620834 files and directories currently installed.) Preparing to unpack b_1.0.deb ... Unpacking b (1.0) ... dpkg: error processing archive b_1.0.deb (--install): trying to overwrite '/tmp/lib64', which is also in package a 1.0 Errors were encountered while processing: b_1.0.deb The package needs to be authored in a way that doesn't assume symlinks are going to be followed. Closing as not a bug.
I am reopening this issue because I believe that the error message in your example is not caused by the symlink itself but by the conflict between different packages. The debian policy manual [1] describes the details of unpack phase of installation or upgrade and states the following: "A directory will never be replaced by a symbolic link to a directory or vice versa; instead, the existing state (symlink or not) will be left alone and dpkg will follow the symlink if there is one." In addition there is a comment in the dpkg source code [2] with further details. Based on all these informations I still believe that opkg should be able to handle such situations (follow symlinks) when installing debian packages. [1] https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html [2] https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/src/unpack.c#n1340
What is not clear to me is why my example using dpkg failed? You say that the problem is not due to symlinks but to a conflict between packages...could you expand on which conflict pakcage A and B have, on your view?
I must admit that it is not clear to me either. The dpkg error message in your example states that Package B tries to overwrite '/tmp/lib64' (the symlink from Package A), but the debian policy manual clearly describes how to handle such situations (follow the symlink, do NOT overwrite it). Did you use a dpkg version from dpkg.org or from elsewhere (i.e. BusyBox)? Maybe it would make sense to ask the dpkg folks [1] for a statement on that topic ... [1] https://wiki.debian.org/Teams/Dpkg
Posted on debian mailing list: https://lists.debian.org/debian-dpkg/2019/11/msg00001.html
The error on my example was not due to a dpkg policy, but by the symlink being followed living on tmpfs. The setting on /proc/sys/fs/protected_symlinks (1) toggles the symlink behavior on tmpfs. Opkg then should follow symlinks at install time, and this bug is valid.
Fixed on commit 445fe1b3345ae64b20807ff4c362af273cb247ed