|
Rescue system after crashing /var in debian
Since the /var directory contains regularly updated data such as mail, it is more susceptible of corruption than, e.g., /usr/. Putting /var/ on a separate partition reduces risks. If disaster happens, you may have to rebuild the /var directory to rescue your Debian system. Obtain the skeleton content of the /var directory from a minimum working Debian system based on the same or older Debian version, for example var.tar.gz, and place it in the root directory of the broken system. Then # cd / # mv var var-old # if any useful contents are left # tar xvzf var.tar.gz # use sarge skeleton file # aptitude # or dselect This should provide a working system. Install a package into an unbootable system in debian Boot into Linux using a Debian rescue floppy/CD or an alternative partition in a multiboot Linux system. Mount the unbootable system on /target and use the chroot install mode of dpkg. # dpkg --root /target -i packagefile.deb Then configure and fix problems. By the way, if a broken lilo is all that prevents booting, you can boot using a standard Debian rescue disk. At boot prompt, assuming the root partition of your Linux installation is in /dev/hda12 and you want runlevel 3, enter boot: rescue root=/dev/hda12 3 Then you are booted into an almost fully functional system with the kernel on floppy disk. Creating Command alias in Debian You can set an alias for the frequently used command. For example: $ alias la='ls -la' Now, la works as a short hand for ls -la which lists all files in the long listing format. You can identity exact path or identity of the command using type command. For example: $ type ls ls is hashed (/bin/ls) $ type la la is aliased to `ls -la' $ type echo echo is a shell builtin $ type file file is /usr/bin/file Here ls was recently searched while file was not, thus ls is "hashed", i.e., the shell has an internal record for the quick access to the location of the ls comma Strange access problems with some websites in debian Recent Linux kernels enable ECN by default, which may cause access problems with some websites on bad routers. To check ECN status: # cat /proc/sys/net/ipv4/tcp_ecn or # sysctl net.ipv4.tcp_ecn To turn it off, use # echo "0" > /proc/sys/net/ipv4/tcp_ecn or # sysctl -w net.ipv4.tcp_ecn=0 To disable TCP ECN on every boot, edit /etc/sysctl.conf and add net.ipv4.tcp_ecn = 0 Too many open files in debian The Linux kernel may complain "Too many open files". This is due to the small default value (8096) for file-max. To fix this problem, run the following command as root # echo "65536" > /proc/sys/fs/file-max # for 2.2 and 2.4 kernel # echo "131072" > /proc/sys/fs/inode-max # for 2.2 kernel only or put the following into /etc/sysctl.conf for the permanent change file-max=65536 # for 2.2 and 2.4 kernel inode-max=131072 # for 2.2 kernel only Cannot boot debian machine No problem, even if you didn't bother to make a boot disk during install. If lilo is broken, grab the boot disk from the Debian installation set and boot your system from it. At the boot prompt, assuming the root partition of your Linux installation is on /dev/hda12 and you want runlevel 3, enter boot: rescue root=/dev/hda12 3 Then you are booted into an almost fully functional system using the kernel on the floppy. Disable beep sound in Debian One can always unplug the PC speaker.For the Bash shell: echo "set bell-style none">> ~/.inputrc Convert a text file from DOS to Unix style Convert a DOS text file (end-of-line = ^M^J) to a Unix text file (end-of-line = ^J). # apt-get install sysutils $ dos2unix dosfile |