@Ventrical: Just jump to the last topic (Pinning the Packages Versions) if you need a fast answer
The text below is my own attempt at studying and learning about this subject.
If you already have those packages installed, we don't have to talk about sources.list, PPAs or manual download/install of packages .deb file. In your example, there's no need to downgrade from non-working/not-wanted packages versions to working/preferred packages versions: You already have them working in your install, you just want to keep them from being upgraded (replaced by more recent releases of their packages). That's the pure definition of pinning. All we discussed about sources.list, PPAs, installing manually downloaded .deb files with dpkg -i were hacks to downgrade.
Ok, now let's pretend we don't know which exact packages provide kernel and Nautilus. We need to query something to get this information and we have some alternatives.
FINDING THE RIGHT PACKAGES
1) dpkg --search <string> or dpkg-query --search <string>
This will search the dpkg information stored in your PC at /var/lib/dpkg/status. Just nano this file to understand what it is about and how it is organized. <string> can be a part of the file name you are looking for (you can't use a regular expression).
dpkg-query is just a frontend for dpkg. Have a look at "man dpkg-query" and you will see some interesting options there.
Try to run dpkg --search nautilus. You will get a lot of output on console, because there are many references to this word in packages informations. We need to be more specific.
What is executed when we run nautilus? We can find this with the command "whereis".
Code:
$ whereis nautilus
nautilus: /usr/bin/nautilus /usr/lib/nautilus /usr/bin/X11/nautilus /usr/share/nautilus /usr/share/man/man1/nautilus.1.gz
We got 5 answers. The one we want is the first (inside bin, the binary executable of nautilus). If we investigate, we can see that the first answer (the binary for nautilus) is in one package, while the fourth answer (/usr/share/nautilus) comes from another package.
Code:
dpkg --search /usr/bin/nautilus
nautilus: /usr/bin/nautilus
$ dpkg --search /usr/share/nautilus
nautilus-data: /usr/share/nautilus
2) apt-file search <string>
apt-file creates a local database of information about packages available at repos. By using it, we are not limited the information we have stored locally (in /var/lib/dpkg/status). We need to let it create a database that we can then query later.
Code:
$ apt-file search nautilus
E: The cache is empty. You need to run 'apt-file update' first.
The database needs to be created. Let's do it.
Code:
$ sudo apt-file update
The first time you run the command above, it will take some time to get information from the servers mentioned in your sources and populate a local database.
Code:
$ apt-file search nautilus
Again, you will get a lot of output and for the same reasons I mentioned previously. We need to trim things down. Lucky for us, apt-file supports the use of regular expressions (REGEX)
Code:
$ apt-file search -x "/usr/bin/nautilus$"
nautilus: /usr/bin/nautilus
nautilus-dbg: /usr/lib/debug/usr/bin/nautilus
3) apt-cache search <REGEX>
apt-cache will not build a new database and will rely on information already stored locally. The advantage over dpkg --search is that it also supports regular expressions.
As you probably expect at this point, you will also get a lot of output if you just search for "nautilus", as I explained previously. And I jus said it supports REGEX, so let's try it. I'll list only the lines that start (^) with the word nautilus using REGEX.
Code:
$ apt-cache search '^nautilus'
nautilus-sendto - integrates Evolution and Pidgin into the Nautilus file manager
nautilus-compare - Context menu comparison extension for Nautilus file manager
nautilus-emblems - emblems property page for nautilus
nautilus-gtkhash - nautilus extension for computing checksums and more using gtkhash
nautilus-ideviceinfo - utility showing information of idevices on nautilus
nautilus-image-manipulator - Resize and send images from Nautilus
nautilus-open-terminal - nautilus plugin for opening terminals in arbitrary paths
nautilus-qdigidoc - Nautilus file manager support for QDigiDoc client
nautilus-script-audio-convert - A nautilus audio converter script
nautilus-script-collection-svn - Nautilus subversion management scripts
nautilus-script-debug - Simple nautilus debugging script
nautilus-script-manager - A simple management tool for nautilus scripts
nautilus-wallpaper - Nautilus extension. Add a "set as wallpaper" entry in context menu
nautilus-wipe - Secure deletion extension for Nautilus
nautilus-dropbox - Dropbox integration for Nautilus
nautilus - file manager and graphical shell for GNOME
nautilus-dbg - file manager and graphical shell for GNOME - debugging version
nautilus-sendto-empathy - GNOME multi-protocol chat and call client (nautilus-sendto plugin)
nautilus-share - Nautilus extension to share folder using Samba
nautilus-actions - nautilus extension to configure programs to launch
nautilus-bzr - Bazaar (bzr) integration for nautilus
nautilus-clamscan - Antivirus scanning for Nautilus
nautilus-filename-repairer - Nautilus extension for filename encoding repair
nautilus-image-converter - nautilus extension to mass resize or rotate images
nautilus-pastebin - Nautilus extension to send files to a pastebin
nautilus-scripts-manager - simple tool for nautilus scripts management
nautilus-data - data files for nautilus
One of the packages above provide /usr/bin/nautilus. We know it's the package named "nautilus" (16th line).
4) Finally, we can use packages.ubuntu.com. It's pretty much self-explanatory. JUst type "nautilus" in the search box, mark "package names only", get some results, filter them by Ubuntu release, etc.
Going back to your example we aleady know that, unsurprisingly, the packages named "nautilus" is the package that provides nautilus. If you use any of the methods above, you will find out the kernel is provided by the linux-image* file.
One thing to note is that you can investiate which packages depend on the nautilus and kernel packages and which packages they depend on using dpkg-query. You can use many different syntax. Here's an example:
Code:
$ dpkg-query -S nautilus
You can also use -W and -f options to fully customize the output. Another example:
Code:
dpkg-query -W -f='\nThe package named ${Package} provides:\n${Provides}\n\nIt depends on the following packages:\n${Depends}\n\n' linux-image-$(uname -r)
EDIT: I have piped the output of the command "uname -r" to the string "linux-image-" instead of manually typing the full package name in the command above, because I assume one would pin the kernel that is currently in use, i.e. the one currently loaded. Its just a lazy trick to avoid typing and eventual typos (which are actually frequent for me).
FINDING OUT THE VERSION CURRENTLY INSTALLED
Suppose you didn't new the version of the nautilus and kernel packages you want to pin. In order to find out, you can also do that in different ways, which include simply using nano to edit /var/lib/dpkg/status and search for status information about the packages. The easy way I'll use here relies on dpkg-query, which will do exactly that for us.
Code:
$ dpkg-query -W nautilus
nautilus 1:3.5.5-0ubuntu3
$ dpkg-query -W linux-image-$(uname -r)
linux-image-3.5.0-10-generic 3.5.0-10.10
PINNING THE PACKAGES VERSIONS
Again, you could go hardcore and manually edit (nano, gedit) /var/lib/dpkg/status to set the desired packages versions to a "Hold" status. If you use the dpkg --set-selections command it will do exactly that for you (as I mentioned in my first post in this thread).
We can also do it using apt. You have to open /etc/apt/preferences in any editor (nano, gedit, etc). You need root permissions to edit it.
Code:
$ sudo nano /etc/apt/preferences
There are many ways to write instructions to apt preferences. Have a look at man apt_preferences to learn some. Here's one way to do it:
Code:
Package: nautilus
Pin: version 1:3.5.5-0ubuntu3
Pin-Priority: 1001
Package: linux-image-3.5.0-10-generic
Pin: version 3.5.0-10.10
Pin-Priority: 1001
After setting apt-preferences with the instructions above, you will be warned about new versions when you run apt-get update && apt-get upgrade, but more recent releases of this packages (as well as the packages that depend on them) will not be upgraded.
OBS: Sorry for the wall of text. This is not meant to be a "tutorial thread", as it would go against current UF policy. I'm studying the subject myself and writting a wiki page, so I already had the content above in drafts.
Regards,
Effenberg
Bookmarks