set package on hold — debian admin service

How do i put an debian package that is already installed on hold so that it doesn’t get up/downgraded?

A common admin problem that i just had with the package psi which over here is a aliened version of psi 0.11 from a external mandrake package is that you want to prevent packages from beeing touched i.e. upgraded or downgraded or removed as a dependancy.

You want to set these packages ‘on hold’ and here is how:

echo “{package name} hold” | dpkg —set-selections

Easy once you know how, isn’t it? ;)

To free the package once again just use ‘install’ instead of ‘hold’.

debian admin service

Ok time to make this blog more popular by talking about the things every debian admin needs to know but nobody cares to write down except in the almighty Debian Reference.

You have installed a package and are wondering where the damn configuration files for that stuff can be found?

just do a less /var/lib/dpkg/info/{package name}.list and have a look for something in /etc that isn’t a cron.d entry.

You wonder what package this file belongs to?

dpkg -S /full/path/to/file

You wonder why your “apt-get updates” are taking to long even so you have a 100mbit/s full-duplex link to the internet?

echo Acquire::PDiffs \”false\”\; >> /etc/apt/apt.conf

This causes the incremental update ‘feature’ to be disabled which is quite disk i/o intensive and simply takes for ages — more bandwith is used for the update (note: thats just the update here not upgrade or dist-upgrade) as a result but for most server admins it is just a laughable amount and worth the extra bits in order to spare the time waiting for update to finish.

You cannot work on the systems console because your firewall log is buzzing with activity and cripples your terminal output?

echo “kernel.printk = 4 4 1 7” >> /etc/sysctl.conf

sysctl -p

You want to prevent a service to be started on system boot?

update-rc.d -f {package name} remove

This will remove the appropiate symlinks from /etc/rc*.d

You cannot find the commandline options/flags that a service gets started with in /etc/init.d/{service}?

Well have you had a look in /etc/default/{service}?

Your apt-get is totally fucked up, it wouldn’t apt-get update without error anymore?

cd /var/lib/apt/lists

rm -v *

apt-get update

You installed debian from a bootcd with debootstrap, chrooted there and did a dist-upgrade but now you cannot umount that partition?

lsof -n | grep {name of target partition}

and kill all PIDs that pop up as a result of this for the dist-upgrade probably did start some services during the process that now have open filehandles on the target partition.

You want to build a custom kernel but you have no clue what device drivers you need for that machine?

cat /proc/cpuinfo

lspci (-vvv | less - optional)

lsusb

This should give you some hints on your systems hardware. Reading the kernel hints about the device drivers and probably knowing your way around in the kernel config is the other part.

Why does the output of the mount command show duplicate entries? or Why doesn’t it list the partition that i know is mounted?

Well you probably tried to do your own boot-from-cd distri and ended up with a script overwriting /etc/mtab. Just try cat /proc/mounts > /etc/mtab && mount.