Removing Unwanted Startup Debian Files or Services

Under Debian Linux ( and most other distros) startup files are stored in /etc/init.d/ directory and symbolic linked between /etc/rcX.d/ directory exists. Debian Linux (Red Hat/ Fedora) uses System V initialization scripts to start services at boot time from /etc/rcX.d/ directory. Debian Linux comes with different utilities to remove unwanted startup file:

(A) rcconf
It is a console based interactive utility that allows you to control which services are started when the system boots up or reboots. It displays a menu of all the services which could be started at boot. The ones that are configured to do so are marked and you can toggle individual services on and off. To start rconf, login as root user and type rcconf
# rcconf


Debian rcconf – a console based utility to control startup services

Select the service you would like to enable or disable.

(B) sysv-rc-conf is yet another tool for for SysV like init script links under Debian Linux. To start sysv-rc-conf, login as root user and type sysv-rc-conf:
# sysv-rc-conf


Debian sysv-rc-conf – a console based advanced utility to control startup services

Select the service you would like to enable or disable.

Both sysv-rc-conf and rcconf are best tools to use on Remote Debian Linux or when GUI is not available, they are just like ntsysv command under Red Hat Linux.

(C) You can also use update-rc.d script as follows (update-rc.d removes any links in the /etc/rcX.d directories to the script /etc/init.d/service):
# update-rc.d -f {SERVICE-NAME} remove

For example to stop xinetd service at boot time, type the command as follows:
# update-rc.d -f xinetd remove

Linux Testing your network connection

1) First try pining your own IP address to see if your IP address is set properly, syntax is:
ping IP-ADDRESS

If your IP address is 202.54.1.10 then try:
# ping 202.54.1.10

Tip use ifconfig command to see IP address for eth0 or any other interface.

2) Try pinging neighboring machines IP addresses:
# ping 192.168.1.2
# ping 202.54.1.12

If you need to setup/configure network or connecting to the network under Linux use following tools:
Under Red Hat use neat OR system-config-network (Fedora core) command
Uder Debian Linux use network-admin command.

You can also start above command from GUI. Using above GUI tools you should able to configure DNS, hosts, IP address etc. For more information see:
List of LINUX troubleshooting commands/tools part # 1

How do I restart Linux network service?

RedHat Linux command to reload or restart network (login as root user):

# service network restart
OR
# /etc/init.d/network restart

To start Linux network service:
# service network start

To stop Linux network service:
# service network stop

Debian Linux command to reload or restart network:
# /etc/init.d/networking restart

To start Linux network service:
# /etc/init.d/networking start

To stop Linux network service:
# /etc/init.d/networking stop

Ubuntu Linux user use sudo command with above Debian Linux command:
# sudo /etc/init.d/networking restart

To start Linux network service:
# sudo /etc/init.d/networking start

To stop Linux network service:
# sudo /etc/init.d/networking stop

Exploring Linux Kernel

Your Linux kernel compiled and always installed in /boot directory:

To list of all installed kernel in your system, enter:
$ ls -l /boot/
Outputs:

Where,

  • config-3.2.0-0.bpo.1-amd64 –> Kernel configuration file generated by make menuconfig/make xconfig/make gconfig.
  • System.map-3.2.0-0.bpo.1-amd64 –> This file has a map of positions of symbols in the kernel. Device driver such as USB pen uses hot plug, which depend upon symbols generated by depmod utility.
  • vmlinuz-3.2.0-0.bpo.1-amd64 — > Your kernel file.
  • initrd.img-3.2.0-0.bpo.1-amd64 –> Contains device drivers which are required to boot and load rest of operating system from disk. Usually SCSI,IDE, software RAID drivers are stored in this file.
  • grub –> It is a directory, which stores grub Boot loader configuration file.

You may also find the following files:

  • config –> Soft link to current kernel configuration file
  • vmlinuz -> Soft link to current running kernel file
  • System.map –> Soft link to current running kernel system map file

Please note that 3.2.0-0.bpo.1-amd64 is kernel version.

Task: Find out version of running Linux kernel

Use any one of the following command:
uname -r
OR
cat /proc/version
Outputs:

Task: Find out where running kernel modules (device drivers) are stored

Use any one of the following command:
ls -l /lib/modules/$(uname -r)
OR
ls -d /lib/modules/$(uname -r)
For 64 bit system, use /lib64 directory:
ls -l /lib64/modules/$(uname -r)
Outputs:

How do I load kernel modules at boot time?

/etc/modules file contain the names of kernel modules that are to be loaded at boot time, one per line. Lines beginning with “#” are ignored.Parameters can be specified after the module name
$ cat /etc/modules
Sample outputs:

However, modern Linux distribution uses the following location or configuration directory/file for modprobe kernel device driver:

  • /etc/modprobe.conf file
  • /etc/modprobe.d/ directory

How do I install latest kernel version?

Find out if latest version available or not via following command:
apt-cache search kernel-image| grep VERSION
An example to see if 2.6.xx.xx series new kernel available or not (Debian Linux):
apt-cache search kernel-image| grep 2.6
Compare version with existing running kernel if it is greater than running kernel, run following command to install new kernel (run it as a root user and assuming that 2.6.12.1 is latest the kernel available):
apt-get install linux-image-2.6.12-1-386

Difference between Monolithic and Modular kernel:

Monolithic kernel

  • Single binary file [ directory ls -d /lib/modules/$(uname -r) does NOT exists ]
  • All drivers included in kernel itself

Modular kernel

  • Multiple files for kernel
  • Drivers can be loaded or unloaded into kernel using modprob command, see man page of
    lsmod, modprob etc [directory ls -d /lib/modules/$(uname -r) exists to store drivers]
  • Almost all drivers are build and linked against kernel

How do I build modular kernel?

You can built modular kernel by setting option in kernel configuration option:
Enable loadable module support (CONFIG_MODULES) [Y/n/?]
If you set above option to Y then kernel becomes modular and three possibilities occurs for each and every feature/driver:

  1. m – you can compile driver as module
  2. y – built into kernel itself
  3. n – Don’t include feature/driver

Type the command make menuconfig:
make menuconfig
1) Select Loadable module support and press enter/return key:


Loadable module support
Loadable module support

2) Select Enable Loadable module support option and other options, see following figure:


Loadable module support
Enable Loadable module support

For more information see the followin links:
* Compiling Linux kernel 2.6
* Text books :

This book covers Memory management including file buffering, process swapping, and Direct memory Access (DMA), The Virtual Filesystem and the Second Extended Filesystem, Process creation and scheduling, Signals, interrupts, and the essential interfaces to device drivers, Timing, Interprocess Communication (IPC), Program execution etc. A must read to master kernel concepts
If you wants starting hacking kernel then this perfect book for you. This book can be also use with your CS (college course) to get more indepth information on operating systems – it helps gain a better idea of kernel conepts. Try following book:

Halt or stop linux firewall

A firewall is designed to help protect your computer from attack by malicious users or by malicious software (viruses that use unsolicited incoming network traffic to attack).

Also before you disable your firewall, you must disconnect your computer from all networks, including the Internet to avoid damage :D

You would like to Halt linux firewall or stop linux firewall (i.e. flush iptables rules). First login as root user.

Option A – If you are redhat Linux user type command:

If you are using Red Hat (RHEL) / CentOS / Fedora Core Linux, use the following command:

OR

Option B – If you are Debian Linux user type following commands one by one