Prasad Pillarisetti
2005-Jul-15 12:05 UTC
[CentOS] How to query the package owning the file? (no packahe manger installed)
Guys recently I had this question asked in a technical interview. How do I find out the package owning a particular file, when no package managers are installed? I am assuimg SRPMs are used to install the software? Is this actually possible? Install the Linux OS without a package manager? I know "rpm -qf filename" gives the package owning the file. But how to get the package name when I don't have any package manager? Maybe this was a question to rattle me? -- Prasad Pillarisetti "If everything is coming your way, then you are in the wrong lane" -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20050715/7735cf61/attachment-0001.html>
Simon Perreault
2005-Jul-15 12:20 UTC
[CentOS] How to query the package owning the file? (no packahe manger installed)
On Friday 15 July 2005 08:05, Prasad Pillarisetti wrote:> How do I find out the package owning a particular file, when no package > managers are installed?If RPM is not installed, then no package can own a file since packages do not exist. Maybe you should have answered: Google!
Johnny Hughes
2005-Jul-15 12:33 UTC
[CentOS] How to query the package owning the file? (no packahe manger installed)
On Fri, 2005-07-15 at 17:35 +0530, Prasad Pillarisetti wrote:> Guys recently I had this question asked in a technical interview. > > How do I find out the package owning a particular file, when no > package managers are installed? > > I am assuimg SRPMs are used to install the software? > > Is this actually possible? Install the Linux OS without a package > manager? > > I know "rpm -qf filename" gives the package owning the file. > But how to get the package name when I don't have any package manager? > > Maybe this was a question to rattle me? > > -- > Prasad Pillarisetti > "If everything is coming your way, then you are in the wrong lane"To find the package that owns a particular file that is installed on your system, you would do: rpm -q --whatprovides /full/path/to/file for example, on CentOS-4 if I do: rpm -q --whatprovides /bin/bash I get this as an answer: bash-3.0-19.2 OR ... rpm -q --whatprovides /usr/lib/rlm_expr.so provides this: freeradius-1.0.1-3.RHEL4 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.centos.org/pipermail/centos/attachments/20050715/fd4f19b8/attachment-0001.sig>
Bryan J. Smith <b.j.smith@ieee.org>
2005-Jul-15 15:11 UTC
[CentOS] Re: How to query the package owning the file? (no packahe manger installed)
From: Prasad Pillarisetti <prasad.pillarisetti at gmail.com>> Guys recently I had this question asked in a technical interview. > How do I find out the package owning a particular file, when no > package managers are installed?Impossible. I think he didn't know what he was talking about. He might have mistakenly been looking for... 1. Find the tarball on the system 2. Find the source directory of the system (/usr/local/src)? 3. Use Checkinstall (build package from tarball build) 4. Use rpmbuild -t to look inside of a tarball for SPEC files 5. Others? I guess I just had to be there.> I am assuimg SRPMs are used to install the software?An rpm -i blah.src.rpm merely dumps things into /usr/src/redhat. You go through the SPEC, SOURCE, etc... subdirectories.> Is this actually possible? > Install the Linux OS without a package manager?Of course! There are "packages"** distros like Debian, Fedora, etc... based. And then there are "tarball" distros with some meta-data** in the tarballs, such as Slackware. [ SIDE NOTE: Both DPKG and RPM are System V cpio archives, pretty much the same USTAR format as tar itself, but use 5KiB blocking instead of 10KiB blocking by default. ] Newer to Linux (but no stranger to BSD) are "ports" distros, such as Gentoo. It uses a centralized build system whereby instead of a "package manager" that creates the SPEC (RPM) file, config/Makefile and other commands and bundles it into a single file, the "ports" repository (e.g., Gentoo's portage) just gives you basic Makefiles and other meta-data, and you actually fetch the software.> I know "rpm -qf filename" gives the package owning the file. > But how to get the package name when I don't have any > package manager? Maybe this was a question to rattle me?Of course. People do it all-the-time. -- Bryan J. Smith mailto:b.j.smith at ieee.org
Hilliard, Jay
2005-Jul-15 17:37 UTC
[CentOS] How to query the package owning the file? (no packahe manger installed)
> To find the package that owns a particular file that is installed on > your system, you would do: > > rpm -q --whatprovides /full/path/to/file > > for example, on CentOS-4 if I do: > > rpm -q --whatprovides /bin/bash > > I get this as an answer: > > bash-3.0-19.2rpm -qf /path/to/file will give you the same results -Jay
Ugo Bellavance
2005-Jul-15 17:53 UTC
[CentOS] Re: How to query the package owning the file? (no packahe manger installed)
Johnny Hughes wrote:> On Fri, 2005-07-15 at 17:35 +0530, Prasad Pillarisetti wrote: > >>Guys recently I had this question asked in a technical interview. >> >>How do I find out the package owning a particular file, when no >>package managers are installed? >> >>I am assuimg SRPMs are used to install the software? >> >>Is this actually possible? Install the Linux OS without a package >>manager? >> >>I know "rpm -qf filename" gives the package owning the file. >>But how to get the package name when I don't have any package manager? >> >>Maybe this was a question to rattle me? >> >>-- >>Prasad Pillarisetti >>"If everything is coming your way, then you are in the wrong lane" > > > To find the package that owns a particular file that is installed on > your system, you would do: > > rpm -q --whatprovides /full/path/to/file >The question was "... whithout having a package manager installed (ie no rpm). -- Ugo -> Please don't send a copy of your reply by e-mail. I read the list. -> Please avoid top-posting, long signatures and HTML, and cut the irrelevant parts in your replies.
Feizhou
2005-Aug-04 04:33 UTC
[CentOS] How to query the package owning the file? (no packahe manger installed)
Prasad Pillarisetti wrote:> Guys recently I had this question asked in a technical interview. > > How do I find out the package owning a particular file, when no package > managers are installed?If it was a system using deb packages, you could go to /var/lib/deb and search there I think.> > I am assuimg SRPMs are used to install the software?rpm is not the only packaging system available. Is the question generic or related to a particular flavour of Unix/Linux?> > Is this actually possible? Install the Linux OS without a package manager?Linux is a kernel. If floppy based Linux distributions are anything to go by, I would say yes.> > I know "rpm -qf filename" gives the package owning the file. > But how to get the package name when I don't have any package manager?Depends on the packaging system. Never tried looking inside /var/lib/rpm files...> > Maybe this was a question to rattle me?Or the interviewer is very savvy.
Les Mikesell
2005-Aug-04 05:09 UTC
[CentOS] How to query the package owning the file? (no packahe manger installed)
On 7/15/05, Prasad Pillarisetti <prasad.pillarisetti at gmail.com> wrote:> Guys recently I had this question asked in a technical interview. > > How do I find out the package owning a particular file, when no package > managers are installed?Ummm.... Ask on the distribution's mailing list???> Maybe this was a question to rattle me?Or to see how resourceful you are. -- Les Mikesell lesmikesell at gmail.com