Thursday, 18 September 2014
Monday, 15 September 2014
Wednesday, 27 August 2014
Package Management
Let’s look at Package Management in the Debian Family System.
dpkg is the underlying package manager for these systems; it can install, remove, and build packages. Unlike higher-level package management systems, it does not automatically download and install packages and satisfy their dependencies.
For Debian-based systems, the higher-level package management system is the apt(Advanced Package Tool) system of utilities. Generally, while each distribution within the Debian family uses apt, it creates its own user interface on top of it (for example,apt-get, aptitude, synaptic, Ubuntu Software Center, Update Manager, etc). Although apt repositories are generally compatible with each other, the software they contain generally isn’t. Therefore, most apt repositories target a particular distribution (like Ubuntu), and often software distributors ship with multiple repositories to support multiple distributions. The demonstration using the Ubuntu Software Center is shown later in this section.
Tuesday, 26 August 2014
display manager for gnome :gdm
gdm - after booting & login a gui display manager program runs that is responsible for graphic interface like gdm for gnome.
Booting process of linux operating system
Booting process of linux consist of following steps:
1)POWER ON
2)BIOS (basic input/output system)-initializes the hardware like keyboard, mouse etc,. Bios software is stored on a ROM chip on the motherboard. After this remaining boot process is controlled by the os. Bios consist of some basic drivers like usb, cd-rom, network with limited functionalities etc.
3)MBR(master boot record)-It is small space of 512 bytes in first sector of hard disk which stores the bootloader code.
4)BOOTLOADER(like grub[GRAND UNIFIED BOOTLOADER] & ISOLINUX(for booting from removable media) )-usually stored in mbr (but now a new space EFI partion space in hard disk is also used for this purpose). Bootloader also provides a interface to choose kernel version & any other os if present.
first bootloader check for bootable partition, then it search for grub & loads it into RAM. The second stage boot loader resides under /boot. A splash screen is displayed which allows us to choose which Operating System (OS) to boot. After choosing the OS, the boot loader loads the kernel of the selected operating system into RAM and passes control to it.
5)INITIALISE KERNEL AND INITRAMFS :
The initramfs filesystem image contains programs and binary files that perform all actions needed to mount the proper root filesystem, like providing kernel functionality for the needed filesystem and device drivers for mass storage controllers with a facility called udev (for User Device) which is responsible for figuring out which devices are present, locating the drivers they need to operate properly, and loading them.The mount program instructs the operating system that a filesystem is ready for use, and associates it with a particular point in the overall hierarchy of the filesystem (the mount point). If this is successful, the initramfs is cleared from RAM and the init program on the root filesystem (/sbin/init) is executed.
6)INIT PROCESS RUNS,
Once the kernel has set up all its hardware and mounted the root filesystem, the kernel runs the /sbin/init program. This then becomes the initial process, which then starts other processes to get the system running. Most other processes on the system trace their origin ultimately to init; the exceptions are kernel processes, started by the kernel directly for managing internal operating system details.
Near the end of the boot process, init starts a number of text-mode login prompts (done by a program called getty). These enable you to type your username, followed by your password, and to eventually get a command shell.
7)XWINDOWS SYSTEM
1)POWER ON
2)BIOS (basic input/output system)-initializes the hardware like keyboard, mouse etc,. Bios software is stored on a ROM chip on the motherboard. After this remaining boot process is controlled by the os. Bios consist of some basic drivers like usb, cd-rom, network with limited functionalities etc.
3)MBR(master boot record)-It is small space of 512 bytes in first sector of hard disk which stores the bootloader code.
4)BOOTLOADER(like grub[GRAND UNIFIED BOOTLOADER] & ISOLINUX(for booting from removable media) )-usually stored in mbr (but now a new space EFI partion space in hard disk is also used for this purpose). Bootloader also provides a interface to choose kernel version & any other os if present.
first bootloader check for bootable partition, then it search for grub & loads it into RAM. The second stage boot loader resides under /boot. A splash screen is displayed which allows us to choose which Operating System (OS) to boot. After choosing the OS, the boot loader loads the kernel of the selected operating system into RAM and passes control to it.
The boot loader loads the selected kernel image (in the case of Linux) and passes control to it. Kernels are almost always compressed, so its first job is to uncompress itself. After this, it will check and analyze the system hardware and initialize any hardware device drivers built into the kernel.
Bootloader loads kernel as well as initramfs into memory which can be used by kernel.
The initramfs filesystem image contains programs and binary files that perform all actions needed to mount the proper root filesystem, like providing kernel functionality for the needed filesystem and device drivers for mass storage controllers with a facility called udev (for User Device) which is responsible for figuring out which devices are present, locating the drivers they need to operate properly, and loading them.The mount program instructs the operating system that a filesystem is ready for use, and associates it with a particular point in the overall hierarchy of the filesystem (the mount point). If this is successful, the initramfs is cleared from RAM and the init program on the root filesystem (/sbin/init) is executed.
6)INIT PROCESS RUNS,
Once the kernel has set up all its hardware and mounted the root filesystem, the kernel runs the /sbin/init program. This then becomes the initial process, which then starts other processes to get the system running. Most other processes on the system trace their origin ultimately to init; the exceptions are kernel processes, started by the kernel directly for managing internal operating system details.
Near the end of the boot process, init starts a number of text-mode login prompts (done by a program called getty). These enable you to type your username, followed by your password, and to eventually get a command shell.
7)XWINDOWS SYSTEM
Generally, in a Linux desktop system, the X Window System is loaded as the final step in the boot process.
A service called the display manager keeps track of the displays being provided, and loads the X server (so-called because it provides graphical services to applications, sometimes called X clients). The display manager also handles graphical logins, and starts the appropriate desktop environment after a user logs in.
Sunday, 27 July 2014
SIZEOF different data types: (int,float,double,char) vs SIZEOF a pointer & pointer datatype
size of data types (int,float,double,char) is compiler dependent which vary depending on the compiler.
sizeof a pointer is kernel dependent .
data type of pointer : void or (char *)0
Saturday, 26 July 2014
declaration & initialisation of a global & local variable. (linux)
global variable:
In C global variables are stored in data segment ,
if variable is only declared & not initialised with some value : that variable is stored in BSS(block startup symbol) segment which is starting address of data segment where it is initialised with value '0' with a logical address.When we assign some value to it then it will move to main data segment .
if variable is assigned value at time of declaration : it directly moves to main data segment with some physical addressing.
local variables:
Local variables are stored in stack segment of process context
if variable is only declared & not initialised with some value: logical address is given to the variable like if we initialise "int val" then only 4 bytes or 8bytes (depending on compiler) with starting logical address is given to the variable.But physical addressing is provided by kernel at the time we assign some value to variable.
In C global variables are stored in data segment ,
if variable is only declared & not initialised with some value : that variable is stored in BSS(block startup symbol) segment which is starting address of data segment where it is initialised with value '0' with a logical address.When we assign some value to it then it will move to main data segment .
if variable is assigned value at time of declaration : it directly moves to main data segment with some physical addressing.
local variables:
Local variables are stored in stack segment of process context
if variable is only declared & not initialised with some value: logical address is given to the variable like if we initialise "int val" then only 4 bytes or 8bytes (depending on compiler) with starting logical address is given to the variable.But physical addressing is provided by kernel at the time we assign some value to variable.
Saturday, 5 July 2014
sizeof a pointer
size of pointer in linux vary with kernel version
for old kernels its: 4bytes
for new versions above 3 .10 : 8bytes
sizeof vs strlen
sizeof-prints even null character
strlen-prints size excluding null
for old kernels its: 4bytes
for new versions above 3 .10 : 8bytes
sizeof vs strlen
sizeof-prints even null character
strlen-prints size excluding null
printf("hello %s\n",sizeof(char ));
output:
run time error :segmntation fault
printf("hello %c\n",sizeof(char ));
out:
hello
no warning or error
run time error :segmntation fault
printf("hello %c\n",sizeof(char ));
out:
hello
no warning or error
Thursday, 26 June 2014
How to start an operating system ???
When we switch on the cpu of our computer it follows a series of steps to start.
Ist BIOS of our system starts which is loaded by the manufacturer.BIOS loaded MBR which is located in our hard disk .MBR consist of bootloader & partition table for our operating system .
Bootloader(like GRUB) starts our kernel by selecting from a no of kernels available for the os.
After booting kernel starts the init process which further initialtes other drivers & programs.
Monday, 23 June 2014
Apt-get in fedora :
apt-get install package : apt-get is not installed in FEDORA so ,instead use :
yum install package
yum install package
WHAT IS KERNEL CRASH OR KERNEL PANIC??? + KERNEL CRASH DUMP
KERNEL CRASH :
It is an action taken by the operating system whenever os detects any fatal error from which kernel can not recover .It might occur due to :
i)hardware failure
ii)software bug
panic() is the function which handle such situation which might lead to system reboot.
KERNEL CRASH DUMP:
It is the portion of the volatile memory (RAM) that is copied in a file whenever kernel crashes which can be analysed to search the reason of crash & prevent any further harm to system .
(for fedora ) :
yum install --enablerepo=fedora-debuginfo --enablerepo=updates-debuginfo kexec-tools crash kernel-debuginfo
Sunday, 22 June 2014
depmod
DEPMOD: it is used to create module dependencies & save it in /lib/modules/kernel_version/modules.dep
modprobe vs insmod
Both modprobe & insmod are used to load module into linux kernel but differ in some points:
i) modprobe load module from /lib/module/linux_kerenel/ & do not search for any other loacation until linked to other location while insmod can load module from any file location on the system .
ii)modprobe also take care & load module dependencies , it call insmod after getting module dependencies info while insmod does not look for module dependencies.
i) modprobe load module from /lib/module/linux_kerenel/ & do not search for any other loacation until linked to other location while insmod can load module from any file location on the system .
ii)modprobe also take care & load module dependencies , it call insmod after getting module dependencies info while insmod does not look for module dependencies.
MODULE DEPENDENCIES :
There are certain modules which rely on other modules for their functioning & operate successfully.Moreover , we might need to remove some certain modules which are not operating at the moment so we need to list dependencies.
Dependencies can be checked by :
i)lsmod -
ii)Use modinfo mudule_name
iii)Use # cat /lib/modules/3.9.10-100.fc17.x86_64/modules.dep
to list all the dependencies of all the modules of the kernel regardless of wheather modules are loaded or not .
Dependencies can be checked by :
i)lsmod -
Module Size Used by iptable_filter 1790 1 ip_tables 7706 1 iptable_filter x_tables 8327 1 ip_tables vmhgfs 41755 0Used by cloumn depict dependencies .
ii)Use modinfo mudule_name
iii)Use # cat /lib/modules/3.9.10-100.fc17.x86_64/modules.dep
to list all the dependencies of all the modules of the kernel regardless of wheather modules are loaded or not .
Subscribe to:
Comments (Atom)