Determine files associated to a package in APT

Fetch Contents files from apt-sources

root@ubuntu:~# apt-file update
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16.7M  100 16.7M    0     0  13.2M      0  0:00:01  0:00:01 --:--:-- 13.3M
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5738k  100 5738k    0     0  8368k      0 --:--:-- --:--:-- --:--:-- 8389k
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 3321k  100 3321k    0     0   9.7M      0 --:--:-- --:--:-- --:--:--  9.8M
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Ignoring source without Contents File:
  http://archive.canonical.com/dists/lucid/Contents-amd64.gz

Find what package installs a file

root@ubuntu:~# apt-file search /etc/init/upstart-udev-bridge.conf
upstart: /etc/init/upstart-udev-bridge.conf

List the files installed by a package

root@ubuntu:~# apt-file list upstart
brltty: /usr/share/doc/brltty/examples/upstart.job
cloud-init: /usr/share/doc/cloud-init/examples/upstart-cloud-config.txt
cloud-init: /usr/share/doc/cloud-init/examples/upstart-rclocal.txt
debhelper: /usr/share/debhelper/autoscripts/postinst-upstart
debhelper: /usr/share/debhelper/autoscripts/postinst-upstart-replace
debhelper: /usr/share/debhelper/autoscripts/postinst-upstart-restart
debhelper: /usr/share/debhelper/autoscripts/prerm-upstart
debhelper: /usr/share/debhelper/autoscripts/prerm-upstart-norestart
ebox-openvpn: /usr/share/ebox/stubs/openvpn/upstart.mas
ifupdown: /etc/network/if-down.d/upstart
ifupdown: /etc/network/if-up.d/upstart
...

How to Change a Network Device's MAC Address

root@ubuntu:~# ifconfig -a wlan0
wlan0     Link encap:Ethernet  HWaddr FF:FF:FF:FF:FF:FF
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:66769 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9225 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:22089814 (22.0 MB)  TX bytes:1509599 (1.5 MB)
root@ubuntu:~# ifconfig wlan0 down
root@ubuntu:~# ifconfig wlan0 hw ether AA:AA:AA:AA:AA:AA
root@ubuntu:~# ifconfig wlan0 up
root@ubuntu:~# ifconfig -a wlan0
wlan0     Link encap:Ethernet  HWaddr AA:AA:AA:AA:AA:AA
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:66977 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9399 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:22181538 (22.1 MB)  TX bytes:1534290 (1.5 MB)

References

How to Mount an Encrypted LVM Partition

root@ubuntu:~# fdisk -l
Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a735a
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          61      487424   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              61       15567   124546048   83  Linux
root@ubuntu:~# ls /dev/mapper/
control
root@ubuntu:~# cryptsetup luksOpen /dev/sda2 encrypted-partition
Enter passphrase for /dev/sda2:
Key slot 0 unlocked.
root@ubuntu:~# ls /dev/mapper/
control  encrypted-partition
root@ubuntu:~# mkdir /mnt/encrypted-partition
root@ubuntu:~# mount /dev/mapper/encrypted-partition /mnt/encrypted-partition/
mount: unknown filesystem type 'LVM2_member'
root@ubuntu:~# apt-get install lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libdevmapper-event1.02.1 watershed
The following NEW packages will be installed:
  libdevmapper-event1.02.1 lvm2 watershed
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 447kB of archives.
After this operation, 1,282kB of additional disk space will be used.
Do you want to continue [Y/n]? y
root@ubuntu:~# sudo /sbin/modprobe dm-mod
root@ubuntu:~# /sbin/lsmod | grep dm_crypt
dm_crypt               11331  1
root@ubuntu:~# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "system" using metadata type lvm2
root@ubuntu:~# vgchange -ay system
  3 logical volume(s) in volume group "system" now active
root@ubuntu:~# lvs
  LV   VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  root system -wi-ao 113.19g
  swap system -wi-a-   2.79g
  tmp  system -wi-a-   2.79g
root@ubuntu:~# ls /dev/mapper/
control  encrypted-partition  system-root  system-swap  system-tmp
root@ubuntu:~# mount /dev/mapper/system-root /mnt/encrypted-partition/
root@ubuntu:~# ls /mnt/encrypted-partition/
bin   etc         initrd.img.old  lost+found  opt   sbin     sys  var
boot  home        lib             media       proc  selinux  tmp  vmlinuz
dev   initrd.img  lib64           mnt         root  srv      usr  vmlinuz.old

Unmount

root@ubuntu:~# umount /mnt/system-root
root@ubuntu:~# cryptsetup remove encrypted-partition

References