Difference between revisions of "Modprobed-db"

From ArchWiki
Jump to: navigation, search
m (Recommendations: added missing parenthesis)
Line 71: Line 71:
 
*Mount every kind of filesystem you would typically use including ext2/3/4, fat, vfat, CIFS shares, NFS shares, etc.
 
*Mount every kind of filesystem you would typically use including ext2/3/4, fat, vfat, CIFS shares, NFS shares, etc.
 
*Use as many applications (that you normally use) as possible in order to capture modules on which they depend.  For example, IP blocking/filtering software like {{AUR|pgl-cli}}.
 
*Use as many applications (that you normally use) as possible in order to capture modules on which they depend.  For example, IP blocking/filtering software like {{AUR|pgl-cli}}.
*If you plan to mount an iso file do so (this will make sure you capture the '''loop''' and '''isofs''' modules.
+
*If you plan to mount an iso file do so (this will make sure you capture the '''loop''' and '''isofs''' modules).
 
*If you use encryption software such as {{Pkg|truecrypt}} make sure to load it, and mount some encrypted containers to ensure that the needed crypto modules are in the db.
 
*If you use encryption software such as {{Pkg|truecrypt}} make sure to load it, and mount some encrypted containers to ensure that the needed crypto modules are in the db.
  

Revision as of 16:59, 7 October 2012

Summary help replacing me
Describes the installation and usage of modprobe db.
Related
Kernels
Linux-ck

modprobed_dbAUR will keeping a running list of ALL modules ever probed on a system and allow for easy recall. This is very useful for users wishing to build a minimal kernel via a `make localmodconfig`which simply takes every module currently probed and switches everything BUT them off in the .config for a kernel resulting in smaller kernel packages and reduced compilation times.

Installation and Setup

  1. Download, build, and install modprobed_dbAUR.
  2. Edit /etc/modprobed_db.conf and optionally add some modules to ignore to the IGNORE array. Some common ones are included by default.

Usage

Data Collection

The most convenient method to "use" modprobed_db is to simply add an entry in the root user's crontab to invoke /usr/bin/modprobed_db store at some regular interval.

Example running the script once every 20 minutes:

# crontab -e
*/20 * * * *   /usr/bin/modprobed_db store &> /dev/null

Data Recall

As mentioned earlier, this script is meant to be used in concert with the make localmodconfig step of compiling a kernel. After the database has been adequately populated, simply invoke /usr/bin/modprobed_db recall prior to compiling a kernel to load all modules followed by the make localmodconfig to do the magic.

Using the Official ARCH kernel PKGBUILD

The official ARCH kernel's PKGBUILD does not have native support for this, but it is easily modified as follows:

 ...
  # get kernel version
  make prepare

  /usr/bin/modprobed_db recall         <---- insert this line
  make localmodconfig              <---- insert this line

  # load configuration
  # Configure the kernel. Replace the line below with one of your choice.
  #make menuconfig # CLI menu for configuration
  #make nconfig # new CLI menu for configuration
  #make xconfig # X-based configuration
  #make oldconfig # using old config from previous kernel version
  # ... or manually edit .config
 ...

Using Some Kernels in the AUR

Several kernel packages in the AUR have native support for modprobed_db in their PKGBUILD files. For example:

Find which other packages use it:

cd /scratch
git clone http://pkgbuild.com/git/aur-mirror.git
find /scratch/aur-mirror -iname "PKGBUILD" -print0 | xargs -0 grep "modprobed_db recall" | sort
Note: The server pkgbuild.com is rather slow and the git clone can take a while. You will be pulling down over 1.1 GB of data.

Recommendations

It is recommended that users install the package and then "use" the system for a good amount of time to allow the database to grow based on usage and capture everything the system needs before building a kernel with a make localmodconfig. Some suggested actions to allow appropriate modules to load and get cataloged:

  • Insert every kind of removable media (USB, DVD, CD, etc.)
  • Use every device on the machine (wifi, network, USB stuff like cameras, ipods, etc.)
  • Mount every kind of filesystem you would typically use including ext2/3/4, fat, vfat, CIFS shares, NFS shares, etc.
  • Use as many applications (that you normally use) as possible in order to capture modules on which they depend. For example, IP blocking/filtering software like pgl-cliAUR.
  • If you plan to mount an iso file do so (this will make sure you capture the loop and isofs modules).
  • If you use encryption software such as truecrypt make sure to load it, and mount some encrypted containers to ensure that the needed crypto modules are in the db.

Suggested Modules

  • cifs
  • ext2
  • ext3
  • ext4
  • fat
  • isofs
  • loop
  • vfat

Benefits of modprobed_db with make localmodconfig in custom kernels

  1. Reduced kernel footprint on FS
  2. Reduced compilation time

Comparisons using version 3.1.1-1 of the ARCH kernel (from ABS):

Note: The /var/log/modprobed.db on the test machine contains 171 lines; YMMV based on specific usage and needs.
Machine CPU make localmodconfig # of Modules Modules' Size on HDD Compilation Time
Intel C2Q @ 3.4 GHz No 3,148 46 MB 13 min 50 sec
Intel C2Q @ 3.4 GHz Yes 596 13 MB 5 min 30 sec
AMD Athlon XP 3200+ @ 2.2 GHz No 3,148 46 MB 127 min 35 sec
AMD Athlon XP 3200+ @ 2.2 GHz Yes 596 13 MB 41 min 20 sec
  • Net decrease in number of modules: 5.2x
  • Net decrease in kernel footprint: 3.5x
  • Net decrease in compilation time: 2.5x - 3.1x

Number of modules found by:

find /lib/modules/3.1.1-1-ARCH/kernel -iname "*.ko.gz" | wc -l

Size on HDD found by:

$ du -ch /lib/modules/3.1.1-1-ARCH/kernel | grep total

Compilation time found by entering a preconfigured src/linux-3.1.1 (using stock ARCH config):

$ time make -jx bzImage modules