when I do
dpkg --get-selections or
less /proc/modules I see two different list. I don't understand the difference between the elements of each...
The two commands are not related in any way.
dpkg --get-selections returns the selection state of available packages. From
--get-selections [package-name-pattern...] Get list of package selections, and write it to stdout. Without a pattern, non-installed packages (i.e. those which have been previously purged) will not be shown.
The selection state is one of:
install The package is selected for installation. hold A package marked to be on hold is not handled by dpkg, unless forced to do that with option --force-hold. deinstall The package is selected for deinstallation (i.e. we want to remove all files, except configuration files). purge The package is selected to be purged (i.e. we want to remove everything from system directories, even configuration files).
/proc/modules, on the other hand, is the list of available kernel modules (you can consider these as equivalent to
dll files in the Windows world). While some modules will have been installed as packages, others are included in the kernel. So, looking at the list of modules, you will see some overlap with the
dpkg command above if you have installed certain modules that are not part of the kernel.
For example, on my system, I have installed the
fuse package which provides the
fuse kernel module. I therefore have an entry for
fuse in both lists:
$ dpkg --get-selections | grep -P 'fuse\t' fuse install $ grep 'fuse' /proc/modules fuse 67503 3 - Live 0xffffffffa1140000
Conversely, the package
firefox does not provide any modules so it is only listed in the
$ dpkg --get-selections | grep -P 'firefox\t' firefox install $ grep 'firefox' /proc/modules $
Kernel modules (which you see under /proc/modules) are part of the Linux Kernel and needed for hardware support (like device drivers) or some other operating system feature. Loadable kernel modules in Linux are loaded (and unloaded) by the modprobe command. They are located in /lib/modules and have had the extension .ko ("kernel object"). You don't deal with them on a daily basis unless you are a Kernel Developer or looking for a some rare driver for your hardware.
Packages, which you can install with dpkg command (in case of Debian-like distro), are the user software. These you usually install to have one programme or another, like e.g. Firefox, OpenOffice etc.
The correct question should be:
What is the difference between a Debian package and a Linux module?
They are completely different things.
Debian is a Linux distribution.
Debian package (deb) is a file format and tools used to package software of a Debian distribution.
Linux module is a module of the Linux kernel which can be loaded on demand.