CS469 - Linux and Unix Administration and Networking



The Virtual Dynamic Shared Object (VDSO) is a virtual pseudo library provided by the kernel for fast-path, non-glibc direct to kernel memory syscalls for frequently used syscalls, such as gettimeofday.

Shared (.so) vs. static (.a)

  • Readings:
    man 7 libc
    man 8 ld.so

Static libraries end with .a and are linked into the program at compile time. Static libraries are archive files that contain un-linked object files that are linked to a program with the ld command.

Shared libraries end with .so.version and are linked to a program at run time by the dynamic linker, an external program, the location of which is usually included in the executable.

The dynamic linker (man 8 ld.so), located in the /lib or /lib64 directory as ld-libc-version.so (usually linked from ld-linux*.so*) is a program that find and locate the shared libraries needed by a program, loads them into memory, prepares the program to run by resolving the undefined symbols within the program with the symbols present in the shared libraries, then finally runs the program.

It can be used to load and run a program:

> /lib64/ld-2.17.so [ options ] [ program [ options ]]

The linker is modified by env. vars such as:

LD_LIBRARY_PATH - Additional paths to search for libraries.

LD_PRELOAD - Libraries to link to first, useful for overriding certain other libraries or specific function calls.

commands for dynamic libraries:

> ldconfig

  • Maintains links to shared libraries and updates the linker cache files (/etc/ld.so.cache). /etc/ld.so.conf is used to determine libraries locations that the ldconfig program should keep up to date.

> ldd program|library

  • lists the shared library/objects used by a particular program.

  • LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=files \ /lib64/ld-linux-x86-64.so.2 /bin/cat

> nm object file|library|executable w/ symbols

  • lists symbols from an object.

> ar

  • create/modify and extract from archives (.a files).

> ranlib

  • creates a index to the archive, same as ar -s.

> strace [ -p pid | program ]

  • Trace syscalls made by a running executable.

The boot process:

After power-on, control is given over to the BIOS (Basic Input/Output System) which reads the system configuration from the battery backed CMOS and configures the hardware and performs a set of basic tests called the POST (Power On Self Test.) Current systems are now using the UEFI (Unified Extensible Firmware Interface) BIOS system, which more or less works in a similar manner to the legacy BIOS. The principle difference is in the addition of secure boot and GPT partitioning of disks.

After the boot device has been determined, the boot loader is loaded into memory by the BIOS and control is handed over to it.

The boot loader is usually located on the first sector of the disk, known as the Master Boot Record (MBR.) Too small (512bytes) to load the entire boot loader, the MBR is used to load a secondary boot loader, located elsewhere on the disk which then completes the loading of the OS. Linux typically uses either lilo (LInux LOader) or grub (GNU GRand Unified Bootloader)

The Lilo or Grub bootloaders then load the kernel, which for example may be located at /boot/vmlinux into memory and turn over execution to it.

The kernel then configures the CPUs and memory and initializes other hardware in the system (via their drivers) and starts the swapper (kswapd), mounts the root (/) file-system and loads /sbin/init as process 1 and starts it. In some systems init has been replaced with SystemD, which has been designed to facilitate more modern boot processes, logging, user authentication and security features such as containers.

Init is configured by the file /etc/inittab which tells init what to do at each "Runlevel", which are meant to control what processes and services are supposed to be actively running.

Run Level Description
* 0 Shutdown the system and halt (optionally poweroff)
* 1/S Used to bring the system into single-user mode.
2,3,5 Multi-user modes w/o X11.
4 Multi-user modes w/ X11.
* 6 Shutdown the system and reboot.
7-9 Undefined.

* = Reserved

Init also manages "gettys" that connect users to the console or other lines to the system.

Finally init acts as the parent to all orphaned processes and reaps them when they exit.

Scripts for services and startup are usually stored in /etc/init.d/ (or /etc/rc.d/ in the case of Slackware.) Scripts can usually be passed the arguments "start", "stop" and "restart" to start/stop and restart the service. There may be other options depending on the service script.

Special scripts in Slackware:

rc.S Initial boot script.
rc.K Start single user mode.
rc.M Start multi-user mode.
rc.0 Halt the system.
rc.6 Reboot the system.


# init runlevel
# telinit runlevel

  • Change runlevel.
    q = Reread inittab.

> runlevel

  • Displays the current runlevel

# shutdown [ -rh ] time [ warning message ]

  • halt (-h) or reboot (-h) the system.


# shutdown -r now

  • Reboot immediately

# shutdown -h +10 "Dusting buffers"

  • Halt the machine in 10 minutes.

# halt
# reboot
# poweroff

  • Immediately halt/reboot/poweroff the system, use shutdown instead.


> man 7 boot bootparam
> man 8 init

Parition Tables:


  • 32 bits, limited to 2TB (512 byte sectors) / 16TB (4K sectors)
  • Has 4 "primary" partitions which may be normal partitions or extended partitions which are containers for more partitions.
  • Considered legacy, GPT is preferred by UEFI BIOS systems.


  • GUID (Globally Unique Identifiers) Partition Tables (8ZB @ 512 sectors). Most modern systems use GPT partitions.


# fdisk [ -l ] [ devices... ]
-l - List the device or all devices enumerated in /proc/partions if no device given.

fdisk commands:
p print current partion table
n Create a new partition
d delete a partition
a toggle boot flag
t change parition type
l list known parition types
u switch units (cylinder/sectors)
q quit w/o saving
w write changes to disk & quit

Useful partition types:

6 FAT16
82 Linux swap
83 Linux
8e Linux LVM
fd Linux RAID auto-configured


# parted [-l]

help Help on commands
mklabel gpt / msdos / etc. Make a new disk label (partition scheme)
mkpart Make a new partition
rm partition Delete a partition
print Print the partition table
quit Saves and quits
set partition flag state Set a flag on a parition
set <partition> boot on
flags: boot, root, swap, raid, lvm, etc.
state: on, off


  • displays the partitions and their sizes that the system knows about.


  • processes currently mounted in the processes name-space (man 5 fstab)


  • Lists the file-systems that are supported by the kernel (man 5 filesystems)