LinkShare rotating banner
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, October 16, 2012

Share your Linux desktop with x11vnc

x11vnc is a pretty useful program that you can use to share your Linux desktop with someone far away. To start x11vnc while using X11 windows, issue the following command:



x11vnc -display :0


This command will work in most cases, assuming there is only one instance of X11 Windows server running. However, the display number could be different. To be sure, type the following command:



xdpyinfo | head


x11vnc will output a lot of information, including the port number it runs on:



The VNC desktop is:      bootcd:2
PORT=5902


Subtracting 5900 from the port number (5902), you'll get the display number (2). Use this number to connect to your desktop remotely. I use gvncviewer.



gvncviewer 192.168.200.83:2


TightVNC viewer on Windows Vista




Administrator To Monitor Someone's Desktop with X11VNC



Let's assume that you are a system administrator with root privilege and want to monitor a user's X11 Windows desktop. You can't just run “x11vnc -display :0” because you are not the user currently using display :0. In that case, you need access to the X11 Windows' xauth file which is located at one of the following locations:




  • /var/lib/gdm
  • /var/lib/kdm
  • /var/lib/xdm/authdir/authfiles
  • /home/USER/.Xauthority


Once you locate the xauth file associated with the user's X11 desktop, you can use x11vnc to monitor his desktop activity.



x11vnc -display :0 -auth /var/lib/gdm/\:0.Xauth


Then, on your desktop as administrator, connect to the user's desktop with a vnc client.



gvncviewer 192.168.200.83:2


x11vnc with SSL



x11vnc supports various connection schemes, including SSL. On Debian and Ubuntu, type the following command to create a SSL certificate for use with x11vnc.



cat /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/certs/ssl-cert-snakeoil.pem > /tmp/x11vnc.pem


Then, start x11vnc with -ssl option to run x11vnc in secure mode.



x11vnc -display :0 -auth /var/lib/gdm/\:0.Xauth -ssl /tmp/x11vnc.pem


ssvnc and gvncviewer can be used to connect to x11vnc via SSL connection. The following example command starts x11vnc in anonymous SSL mode that doesn't require X509 exchange.



x11vnc -display :0 -xauth /var/lib/xdm/authdir/authfiles/A\:0-R2x5Db -xkb -nopw -nc_cr -ssl /tmp/x11vnc.pem -vencrypt newdh:nox509:support

Setting Up XDM on Debian/Ubuntu Linux

XDM, short for X Display Manager, is my favorite login manager for its simplicity. Sure, gdm and kdm are visually pleasant, but why do I have to install all the dependencies if xdm provides the same functionality as them? After all, xdm can launch GNOME and KDE for you — you just need to fix your ~/.xsession file. This post will serve as my notes on installation, configuration and customization of xdm.



All configuration of xdm, except for distribution-specific settings, is done by modifying the files in the /etc/X11/xdm directory. For now, I'll just go over what I have in my xdm files.



/etc/X11/xdm/Xaccess



This file is used to tell xdm who can use xdm. Therefore, if you are happy to let anyone access the X-Windows desktop locally or remotely, then you would just put an asterisk (*) in Xaccess as I did.



*


If you are very keen on security, you would put only the following in Xaccess. This only allows local users to have access to xdm.



localhost
127.0.0.1


However, even if Xaccess is set up as above, remote xdm login may still be possible with SSH X11 forwarding.



/etc/X11/xdm/Xresources



Xresources file is used to fine-tune the behavior and appearance of XDM. Here is what I put in my Xresources file:



Xcursor.theme: redglass

xlogin*login.translations: #override \
Ctrl<Key>R: abort-display()\n\
<Key>F1: set-session-argument(failsafe) finish-field()\n\
<Key>Delete: delete-character()\n\
<Key>Left: move-backward-character()\n\
<Key>Right: move-forward-character()\n\
<Key>Home: move-to-begining()\n\
<Key>End: move-to-end()\n\
Ctrl<Key>KP_Enter: set-session-argument(failsafe) finish-field()\n\
<Key>KP_Enter: set-session-argument() finish-field()\n\
Ctrl<Key>Return: set-session-argument(failsafe) finish-field()\n\
<Key>Return: set-session-argument() finish-field()

xlogin*greeting: Welcome to CLIENTHOST
xlogin*namePrompt: Login:\040
xlogin*passwdPrompt: Password:\040
xlogin*fail: Login incorrect

xlogin*greetFace: Serif-21:bold:italic
xlogin*face: Sans-15
xlogin*promptFace: Sans-15:bold
xlogin*failFace: Sans-16:bold

xlogin*geometry: 600x400
xlogin*borderWidth: 1
xlogin*frameWidth: 5
xlogin*innerFramesWidth: 2
xlogin*shdColor: grey30
xlogin*hiColor: grey90
xlogin*background: grey
xlogin*greetColor: Blue3
xlogin*failColor: red
*Foreground: black
*Background: #fffff0

xlogin*logoFileName: /usr/share/X11/xdm/pixmaps/penguin_doll_200x300.xpm
xlogin*useShape: true
xlogin*logoPadding: 10


I think the settings are self-explanatory. This is how xdm would look with the above settings. The penguin image was taken from here.



xdm-screenshot

/etc/X11/xdm/Xresources



The Xresources file allows you to specify how many X servers to run and their command arguments. In my case, I run Xorg and Xvfb. Xorg is the standard X server, and Xvfb is a server that runs totally in memory without depending on the video hardware. To see what's going on with Xvfb, I use x11vnc and gvncviewer.



# Default X.org server
:0 local /usr/bin/Xorg :0 vt7 -br -dpi 96 -nolisten TCP

:1 local /usr/local/bin/Xvfb :1 -dpi 96 -screen 0 1024x768x16


/etc/X11/xdm/Xsetup



Xsetup allows you to write any command to run when xdm displays the login screen. In my case, I run gm to set up the background image and run x11vnc to remotely access Xvfb via VNC.



#!/bin/sh
#
# This script is run as root before showing login widget.

gm display -window root /usr/share/wallpapers/Board_Tile_Gray.jpg
xkbcomp -dflts -I/usr/share/X11/xkb /etc/X11/xkb/server-0.xkm $DISPLAY

PID_XVFB=$(pidof Xvfb)
PID_X11VNC=$(pidof x11vnc)
if [ -n "$PID_XVFB" -a -z "$PID_X11VNC" ]; then
x11vnc -display :1 -bg -xkb -nopw -nc_cr -forever -listen localhost -auth $(find /var/lib/xdm/authdir/authfiles -name \*:1\*) > /var/log/x11vnc.log 2>&1
fi


/etc/X11/xdm/xdm-config



In xdm-config, there is only one line that I bother to change. This line enables remote xdm logins.



! SECURITY: do not listen for XDMCP or Chooser requests
! Comment out this line if you want to manage X terminals with xdm
DisplayManager.requestPort: 177


/etc/X11/xdm/xdm-options



I think xdm-options is Debian specific. I don't think I made any change in this file.



# configuration options for xdm
# See xdm.options(5) for an explanation of the available options.

no-ignore-nologin
no-restart-on-upgrade
no-start-on-install
use-sessreg


Resetting XDM



There are other files in /etc/X11/xdm directory that you can safely leave as is. After you make any change with the files, have xdm reread the config files.



kill -1 $(pidof xdm)


If you want to force xdm to kill all running sessions and restart, enter the following command.



/etc/init.d/xdm restart


That's all I have to write about xdm for now. In summary, xdm is a simple, yet functional login manager that is easy to set up.

Monday, October 15, 2012

Linux: Transmitting a Bunch of Files using socat

computer

socat is a nifty, versatile tool for establishing a secure data channel between two computers. To install socat on Debian, use apt-get:



apt-get install socat


I was trying to use socat and tar to duplicate the contents of an entire filesystem securely between two computers. In this case, I copied all files in partition /dev/sda5 on box A to partition /dev/sdb6 on box B (IP 192.168.200.83).



Using the SCTP protocol



This method does not involve encryption, so it is relatively simple to follow.




  1. First, I opened a terminal at box B (192.168.200.83) and changed the current directory to /mnt/sdb6 where I will unpack the incoming stream of files.


    cd /mnt/sdb6

    Then, I typed the following command to have socat establish a SCTP connection listening on port 7749. tar would be expecting to receive incoming files.


    socat EXEC:"tar xzf -" SCTP4-LISTEN:7749

  2. Then, I opened a terminal at box A. Here I would transmit a bunch of files to box B (192.168.200.83). I changed directory to /mnt/sda5 containing files to send.


    cd /mnt/sda5

    Then, I typed the following command to transmit all the files in the current directory.


    socat EXEC:"tar czf - ." SCTP4-CONNECT:192.168.200.83:7749



Using the SSL connection



This method involves encrypted connection and requires SSL certicates on both sides of the link. Read this post to learn how to create self-signed SSL certificates if you don't already have one.




  1. Debian and Ubuntu automatically create a local SSL certificate at /etc/ssl/certs/ssl-cert-snakeoil.pem. Both parties of an SSL connection — box A and box B — should exchange each other's ssl-cert-snakeoil.pem in order to have SSL connections between them.



  2. On box B, I typed the following command to run socat in SSL listening mode at port 7749.

    cd /mnt/sdb6
    socat EXEC:"tar xzf -" OPENSSL-LISTEN:7749,reuseaddr,cert=/etc/ssl/certs/ssl-cert-snakeoil.pem,key=/etc/ssl/private/ssl-cert-snakeoil.key,cafile=box-A.pem


  3. On box A, I typed the following command to run socat in SSL mode while running tar to pack all the files and send them through the pipeline.

    cd /mnt/sda5
    socat EXEC:"tar czf - ." OPENSSL:192.168.200.83:7749,cert=/etc/ssl/certs/ssl-cert-snakeoil.pem,key=/etc/ssl/private/ssl-cert-snakeoil.key,cafile=box-B.pem




Thus I have duplicated the whole directory tree from Box A to Box B. Using socat and tar, I was able to mirror a filesystem over the network. As shown above, socat alone can be a good substitute in situations where ssh, scp and/or netcat are needed. socat has many other features I have yet to explore.

Tuesday, October 9, 2012

isolinux.cfg for a live CD

isolinux is a bootloader included in the syslinux package and is used to boot a CD or DVD. isolinux is one of several popular bootloaders used to create a bootable CD for open-source operating systems, including Linux and FreeDOS. Another bootloader is GRUB, which I rarely use except for booting Windows 7 with BIOS emulation.



To create a bootable CD with isolinux, just copy the file isolinux.bin to a folder that will hold CD contents for ISO mastering. On Debian or Ubuntu, the file is located at the /usr/lib/syslinux folder.



ISOFS contents

A file named isolinux.cfg needs to be created in order to provide a menu or boot entries. A sample isolinux.cfg is shown below. It makes use of vesamenu.c32 which helps display a nice graphical menu with a background picture. Vesamenu.c32 is also located in /usr/lib/syslinux and needs to be copied too.





# isolinux.cfg
# Configuration for ISOLINUX

# Wait for 60 seconds before booting up the default entry.
TIMEOUT 600
F1 help.txt #ff702640

UI vesamenu.c32
MENU RESOLUTION 640 480
MENU BACKGROUND back642.jpg
MENU COLOR border 30;44 #40dfdfdf #00000000 std
MENU COLOR title 1;36;43 #e0fdff49 #804206ef none
MENU COLOR sel 7;37;40 #e0000000 #40ffffff all
MENU COLOR hotsel 1;7;37;40 #e0af0000 #40ffffff all
MENU COLOR disabled 1;30;44 #ffe4de6f #00000000 std
MENU COLOR scrollbar 30;44 #40000000 #e0af0000 std
MENU TITLE Boot Menu
MENU CLEAR

MENU ROWS 14
MENU TABMSGROW 20
MENU CMDLINEROW 20
MENU TIMEOUTROW 22
MENU HELPMSGROW 24
MENU VSHIFT 1

# The default is to boot the first hard drive.
DEFAULT hd0
ONERROR hd1

MENU BEGIN livecd_menu

MENU TITLE Linux Live CD Menu

LABEL livecd_heading
MENU LABEL Boot Linux live CD
MENU DISABLE

LABEL livecd_640x480
MENU LABEL 640x480 screen
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND root=/dev/sr0 edd=off vmode=640x480

LABEL livecd_800x600
MENU LABEL 800x600 screen
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND root=/dev/sr0 edd=off vmode=800x600

LABEL livecd_1024x768
MENU LABEL 1024x768 screen
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND root=/dev/sr0 edd=off vmode=1024x768

MENU SEPARATOR

LABEL livecd_console_heading
MENU LABEL Boot Linux live CD into text console
MENU DISABLE

LABEL livecd_console
MENU LABEL text-mode console
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND root=/dev/sr0 nox

LABEL livecd_console_old
MENU LABEL text-mode console for an old computer
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND root=/dev/sr0 acpi=off irqpoll nox

MENU SEPARATOR

LABEL exit0
MENU LABEL Return to the main menu.
MENU EXIT

MENU END

MENU BEGIN cdram_menu

MENU TITLE Linux on RAMdisk Menu

LABEL cdram_heading
MENU LABEL Boot Linux on RAMdisk
MENU DISABLE

LABEL cdram_640x480
MENU LABEL 640x480 screen
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND boot=cdrom root=/dev/ram ramdisk_size=573440 edd=off vmode=640x480

LABEL cdram_800x600
MENU LABEL 800x600 screen
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND boot=cdrom root=/dev/ram ramdisk_size=573440 edd=off vmode=800x600

LABEL cdram_1024x768
MENU LABEL 1024x768 screen
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND boot=cdrom root=/dev/ram ramdisk_size=573440 edd=off vmode=1024x768

MENU SEPARATOR

LABEL cdram_console_heading
MENU LABEL Boot Linux RAMdisk into text console
MENU DISABLE

LABEL cdram_console
MENU LABEL text-mode console
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND boot=cdrom root=/dev/ram ramdisk_size=573440 nox

LABEL cdram_console_old
MENU LABEL text-mode console for an old computer
MENU INDENT 1
KERNEL 360.lnx
INITRD initram.lzm
APPEND boot=cdrom root=/dev/ram ramdisk_size=573440 acpi=off irqpoll nox

MENU SEPARATOR

LABEL exit1
MENU LABEL Return to the main menu.
MENU EXIT

MENU END

LABEL hd0
MENU LABEL First Hard Drive
LOCALBOOT 0x80

LABEL hd1
MENU LABEL Second Hard Drive
KERNEL chain.c32
APPEND hd1 swap

MENU BEGIN hd0_menu

MENU TITLE Partition in First Hard Drive

LABEL hd0_part1
MENU LABEL 1st partition
KERNEL chain.c32
APPEND hd0 1

LABEL hd0_part2
MENU LABEL 2nd partition
KERNEL chain.c32
APPEND hd0 2

LABEL hd0_part3
MENU LABEL 3rd partition
KERNEL chain.c32
APPEND hd0 3

LABEL hd0_part4
MENU LABEL 4th partition
KERNEL chain.c32
APPEND hd0 4

LABEL hd0_part5
MENU LABEL 5th partition
KERNEL chain.c32
APPEND hd0 5

LABEL hd0_part6
MENU LABEL 6th partition
KERNEL chain.c32
APPEND hd0 6

LABEL hd0_part7
MENU LABEL 7th partition
KERNEL chain.c32
APPEND hd0 7

LABEL hd0_part8
MENU LABEL 8th partition
KERNEL chain.c32
APPEND hd0 8

LABEL hd0_part9
MENU LABEL 9th partition
KERNEL chain.c32
APPEND hd0 9

LABEL hd0_part10
MENU LABEL 10th partition
KERNEL chain.c32
APPEND hd0 10

MENU SEPARATOR

LABEL exit3
MENU LABEL Return to the main menu
MENU EXIT

MENU END

LABEL fd0
MENU LABEL Floppy Drive
LOCALBOOT 0x00

LABEL next
MENU LABEL Next in boot sequence
LOCALBOOT -1

LABEL memtest
MENU LABEL Test your computer memory
LINUX memtest.bin
TEXT HELP
Run Memtest86 to test your computer memory
ENDTEXT

LABEL help
MENU LABEL Help
MENU HELP help.txt #ff702640


isolinux boot menu

The example above is one that I use for my live CD, so some settings are specific to my situation. Thus, KERNEL and APPEND settings may have to be adapted for other users. However, all the keywords shown above is standard and acceptable.


Monday, October 8, 2012

Linux: Building X.org Kdrive Server Xfbdev on Debian Wheezy

Kdrive is a minimal X11 server that runs as a single executable with little dependencies. I use Kdrive for my Web-only/Rescue Linux systems. Before compiling Kdrive, I installed the following packages on my box running Debian Sid — which will be eventually rolled into Wheezy release:



  • bison

  • g++-4.7

  • libexpat1-dev

  • libpciaccess-dev

  • libpixman-1-dev

  • libssl-dev

  • libudev-dev
  • libxdamage-dev

  • libxfont-dev

  • libxi-dev

  • libxkbfile-dev

  • libxmu-dev

  • libxxf86vm-dev

  • make

  • pkg-config

  • x11proto-bigreqs-dev

  • x11proto-composite-dev

  • x11proto-randr-dev

  • x11proto-render-dev

  • x11proto-resource-dev

  • x11proto-scrnsaver-dev

  • x11proto-video-dev

  • x11proto-xcmisc-dev

  • x11proto-xf86dga-dev

  • x11proto-xinerama-dev

  • xkb-data



Installing X Protocol Headers



The current RandR protocol headers from Debian didn't meet the required version, so I had to download the latest one from freedesktop.org. I installed randrproto like this.



tar xjvf randrproto-1.4.0.tar.bz2
cd randrproto-1.4.0
./configure --prefix=/usr
make install


Compiling Xfbdev



I got the latest X.org release from freedesktop.org. The following commands will build Xfbdev:



tar xjf xorg-server_1.13.0.tar.bz2

cd xorg-server-1.13.0/

./configure --prefix=/usr --disable-xorg --enable-kdrive --enable-kdrive-evdev --enable-config-udev --disable-aiglx --disable-glx --disable-dri --disable-dri2 --disable-drm --disable-record --with-xkb-path=/usr/share/X11/xkb --with-xkb-output=/var/lib/xkb --with-xkb-bin-directory=/usr/bin --with-default-xkb-rules=xorg --with-default-xkb-model=pc105 --with-default-xkb-layout=us

make

make install


Installed Files



The following files are installed after successfully building a Kdrive server.


/usr/bin/Xfbdev

/usr/bin/Xnest

/usr/bin/Xvfb

/usr/lib/xorg/protocol.txt

/usr/share/man/man1/Xnest.1

/usr/share/man/man1/Xserver.1

/usr/share/man/man1/Xvfb.1

/var/lib/xkb/README.compiled


To Use Xfbdev



An executable file Xfbdev will be created in /usr/bin. To be able to use the Xfbdev server, framebuffer video must be enabled either in the kernel or as a module. If CONFIG_FB_VESA option was enabled in the kernel, you can use the syslinux bootloader in the following way to boot Linux into a framebuffer video mode:



LABEL minimal
KERNEL vmlinuz-2.6.31.5
INITRD initramfs.lzma
APPEND vga=0x314 video=vesafb:mtrr


Once the framebuffer video has been activated, Xfbdev can be started in the following way:



Xfbdev :0 vt7 dpms -ac -br +bs -dpi 96 -mouse evdev,5,device=/dev/input/event2 -2button -keybd evdev,,device=/dev/input/event3 -fp /usr/local/share/fonts,/usr/share/fonts/X11/Type1,/usr/share/fonts/truetype/ttf-dejavu -nolisten TCP


Download my X.org build 1.13.0



Download

Here you can obtain my compiled binaries Xfbdev, Xnest and Xvfb:





Also Read:



Saturday, October 6, 2012

My Live CD based on Debian Linux Sid

I created a Live CD from my Debian Linux installation. It is based on the unstable version (Sid). However, the live CD still lacks the capability to automatically configure X-Windows and the network, and uses IceWM for minimalist desktop. It can be downloaded from Google Drive. This Live CD has many uses, such as:



  • To troubleshoot and fix computer problems
  • To create backups and restore them
  • To partition a hard drive before installing Windows or Linux
  • To set up GRUB bootloader or enter boot commands
  • To install Debian, Ubuntu or Fedora
  • To access a Windows partition when it is unbootable
  • To survey and diagnose wireless and wired networks
  • To enjoy the Internet with the Web, IM, IRC and VoIP
  • To run a simple FTP or HTTP server
  • To participate in peer-to-peer networks
  • To do basic word processing and spreadsheet
  • To listen to music or watch movies
  • To rip CD's and DVD's


livecd-001

The snapshot above shows idesk icons on the desktop. Idesk is a neat application that displays icons on the desktop for you to quickly launch. Currently, I use IceWM instead of GNOME or KDE desktop to save space on the CD. So idesk is used to provide desktop icons for IceWM.





livecd-002

The snapshot above shows mlterm running. mlterm is my favorite terminal application. It allows me to use many languages.



livecd-003

Gparted is a cool application to have on a live CD. It lets you divide the hard drive into many partitions so you can run multiple operating systems.



livecd-004

IceWeasel is rebranded Firefox from Debian. Sorry, Chrome is not included.



livecd-005

LibreOffice is a fork of OpenOffice.org suite. I use it to create documents or read Microsoft Office documents.



Specifying the locale at boot time



To see your own language with the live CD, select an entry from the menu, click Tab and append LANG= option to the command line. For example, if you speak French, append LANG=fr_FR.UTF-8.

Friday, October 5, 2012

Using GraphicsMagick to Set the Background

GraphicsMagick is a powerful graphics tool that can be used to set the background on Linux. I've been using xsetbg from the xloadimage package to set X-Windows background. However, I realized that GraphicsMagick can replace xloadimage and netpbm that I've used for setting background and converting images.



So far I just learned a few tricks for setting background with GraphicsMagick. To tile an image on the background, type a command like this:



gm display -window root background.jpg


To fill the background with an image smaller than the screen size, use the -geometry option:



gm display -window root -geometry 1440x960 Background.jpg


You can also use the percentage (%) sign to zoom in or out the image and place it on the background.



gm display -window root -geometry 300x200% background.jpg


You can add the -gamma option to darken or brighten the image. If gamma is less than 1, the output image will be darker. If gamma is greater than 1, the image will be brighter.



gm display -window root -gamma 0.5 BG_pix.jpg


There are many more options that you can use with GraphicsMagick, for example, -crop, -dither, -trim etc. Read the manual page of GraphicsMagick and documentation for further information.

Thursday, October 4, 2012

Disk Cloning / Imaging over Network with SSH, Netcat, DD and XZ

Today we have affordable, ample storage and faster bandwidth to facilitate partition imaging and disk cloning over network. Nowadays, it's common and feasible to take the image of a whole partition for various reasons. Compared to file-based backups using tar, disk imaging provides the following advantages.




  • The boot sector is preserved so that it's easy to make it bootable after the restore.
  • Information such as UUID and LABEL is presered, which helps identify the partition in booting and mounting.
  • Information such as ACL and XATTR is preserved, which helps restrict file access and secure the system.
  • Every bit in the unused sectors is preserved, which may assist in digital forensics to uncover deleted or hidden information.


There are commercial programs for disk imaging and backup (Norton Ghost, Acronis True Image). However, Linux users can use readily available tools to get things done. For disk cloning/imaging, we can use ssh, netcat, dd and xz. Note that dd will fail on physically damaged disks. For such disks, use ddrescue instead.



For security and compression, we are going to use ssh and xz in this tutorial. If you don't like xz, feel free to substitute xz with gzip, bzip2 or lzop. Also, netcat is used to stream the dd output over the network. On Debian and Ubuntu derivatives, you need the following packages.




  • bzip2, gzip, lzop, lzma OR xz-utils
  • dd
  • netcat
  • ssh


We are making these assumptions in the following scenarios.




  • Sending computer S

    This computer has IP address 192.168.1.1 and needs to back up partition /dev/sda1.
  • Sending Port

    We'll send using port 5525.
  • Receiving computer T

    This computer has IP address 192.168.1.2 and needs to restore partition /dev/sda2.
  • Receiving Port

    We'll receive at port 7749.


Disk Cloning using dd, xz, netcat and ssh


In this scenario, we will clone a disk partition, simultaneously sending an image of the source partition /dev/sda1 from computer S (192.168.1.1) and restoring it at /dev/sda2 on computer T (192.168.1.2). Make sure that the source partition is not mounted or is mounted read-only. Also, make sure that the target partition size is greater than or equal to the source partition size.




  1. At the sending computer, compress the source partition /dev/sda1 with xz and set up netcat to send it at port 5525:

    dd if=/dev/sda1 bs=16M | xz | nc -l 5525

  2. At the receiving computer, set up a SSH tunnel to the sending computer (192.168.1.1):

    ssh -f -N -L 7749:127.0.0.1:5525 username@192.168.1.1

  3. At the receiving computer, type the following command to receive the partition image and restore it at /dev/sda2:

    nc 127.0.0.1 7749 | xz -d | dd of=/dev/sda2 bs=16M



Alternatively, we could take the following steps to achieve the same thing. However, we start at the receiving computer.




  1. At the receiving computer with the target partition /dev/sda2, type the following command to receive the partition image:

    nc -l 7749 | xz -d | dd of=/dev/sda2 bs=16M

  2. At the sending computer with the source partition /dev/sda1, set up a SSH tunnel to the receiving computer (192.168.1.2):

    ssh -f -N -L 5525:127.0.0.1:7749 username@192.168.1.2

  3. At the sending computer, type the following command to compress the source partition /dev/sda1 and transmit it over the SSH tunnel:

    dd if=/dev/sda1 bs=16M | xz | nc 127.0.0.1 5525

    Note that the transfer may take many hours for a large partition.




Disk Imaging using dd, xz, netcat and ssh


In this scenario, we will just send an image of the source partition /dev/sda1 to the receiving computer T (192.168.1.2) without restoring it. Make sure that the source partition is not mounted or is mounted read-only. A question remains whether to compress the image at the sending or receiving computer. The answer depends on which computer is more powerful. For this example, we'll compress at the sending computer (for network bandwidth reason).




  1. At the sending computer, compress the source partition /dev/sda1 with xz and stream it using netcat:

    dd if=/dev/sda1 bs=16M | xz | nc -l 5525

  2. At the receiving computer, set up a SSH tunnel to the sending computer (192.168.1.1):

    ssh -f -N -L 7749:127.0.0.1:5525 username@192.168.1.1

  3. At the receiving computer, type the following command to receive the file:

    nc 127.0.0.1 7749 > partimg.xz



Alternatively, we could take the following steps to achieve the same thing.




  1. At the receiving computer, set up netcat to listen at port 7749 and save the incoming data to a file partimg.xz.

    nc -l 7749 | dd of=partimg.xz bs=16M

  2. At the sending computer, establish a SSH tunnel to the receiving computer (192.168.1.2) first:

    ssh -f -N -L 5525:192.168.1.2:7749 username@192.168.1.2

  3. At the sending computer, type the following command to compress the source partition /dev/sda1 and transmit it over the SSH tunnel:

    dd if=/dev/sda1 bs=16M | xz | nc 127.0.0.1 5525

    Note that the transfer may take many hours for a large partiiton.




Alternative Simple Commands for Disk Cloning / Imaging


I don't like these methods for some reason, but here I show the simpler methods where netcat is not needed. For disk cloning, type something like this:



dd if=/dev/sda1 bs=16M | xz | ssh username@192.168.1.2 "xz -d | dd of=/dev/sda2 bs=16M"


Just to send an image file, run a command as follows:



dd if=/dev/sda1 bs=16M | xz | ssh username@192.168.1.2 "dd of=partimg.xz bs=16M"


Also Read:


Sunday, September 30, 2012

Download Linux Kernel 3.5.4 / 3.6.0



I am sharing my kernel builds for Linux 3.5.4 and 3.6.0. Hope it works for everyone.



To Compile ndiswrapper 1.58rc1 for Linux 3.5.4

ndiswrapper allows Linux users to use Windows drivers for PCI/USB network adapters on Linux. If you own a network device for which Linux support is still absent or premature, then you need to compile ndiswrapper yourself and install Windows driver for your network device. Fortunately, today's Linux supports most network devices out-of-box, so most distributions don't bother to include ndiswrapper. However, I am compiling ndiswrapper believing that Windows NDIS drivers would outperform native Linux drivers.





To my surprise, building the latest version of ndiswrapper (1.58rc1) did not require any patch. After compiling Linux 3.5.4, I downloaded the ndiswrapper source from the sourceforge site. I chose the testing version because I thought it would work better with Linux 3.5.x. I unpacked the source.



tar xzvf ndiswrapper-1.58rc1.tar.gz
cd ndiswrapper-1.58rc1


I typed the following commands to compile and install ndiswrapper.



KVERS=3.5.4 make uninstall
KVERS=3.5.4 make
KVERS=3.5.4 make install


Then, I generated modules.* files again.



depmod -e -m -F /boot/System.map-3.5.4 3.5.4


The following files were installed by ndiswrapper.



/lib/modules/3.5.4/misc/ndiswrapper.ko
/sbin/loadndisdriver
/usr/sbin/ndiswrapper
/usr/sbin/ndiswrapper-buginfo
/usr/share/man/man8/loadndisdriver.8
/usr/share/man/man8/ndiswrapper.8


Also read:



Saturday, September 29, 2012

My All-Purpose Init Script for initrd / initramfs Boot Images

Here I post my init script. It is used in my initrd/initramfs boot images for the following purposes.




  • Boot from a live CD / DVD
  • Boot from a read-only filesystem image, compressed in SquashFS
  • Copy the filesystem image to a RAM disk and run Linux entirely on memory
  • Boot Linux from a USB flash drive
  • Boot Linux from a local disk partition
  • Run a rescue shell without booting Linux


I have yet to implement network booting. Right now it is good enough for my current needs. It takes the following boot parameters.




  • root=

    Specifies the root partition to boot Linux from. For example, /dev/sda2.
  • label=

    Specifies the label of the device to boot from. For example, label=DEBIAN.
  • uuid=

    Specifies the UUID of the device to boot from. For example, uuid=dcfd6a0a-2a0f-4b3d-8a1a-5e7d642ebfbd
  • boot=

    Can be cdrom, loop, ram, usb or ata.
  • vmode=

    Specifies the screen resolution of the framebuffer video. For example, vmode=640x480
  • single

    Boot into the single-user mode.
  • nox

    Boot into the console mode in runlevel 2




#!/bin/dash

# Define a function to parse kernel command line options.
get_opt() {
echo $@ | cut -d "=" -f 2
}

# Define a function to load drivers.
loadmod() {
for i in $@ ; do
for j in $(grep $i /tmp/pcimodules.txt); do
modprobe $j
done
done
}

# Define a function to guess the partition type.
gpart() {
for i in $(blkid | grep $1); do
case $i in
*\=*)
eval $i
;;
*)
true
;;
esac
done
}

# Define a function for mounting the root partition.
mountr() {
if [ $uuid ]; then
if [ $# = 2 ]; then
mount -r -U $uuid $2
elif [ $# = 1 ]; then
mount -r -U $uuid $1
else mount -r -U $uuid /mnt
fi
elif [ $label ]; then
if [ $# = 2 ]; then
mount -r -L $label $2
elif [ $# = 1 ]; then
mount -r -L $label $1
else mount -r -L $label /mnt
fi
else
gpart $1
case $TYPE in
ext*)
e2fsck -p $1
[ $# = 2 ] && mount $1 $2 || mount $1 /mnt
;;
jfs)
jfs_fsck $1
if [ $# = 2 ]; then
mount -t jfs -o ro,iocharset=utf8 $1 $2
else mount -t jfs -o ro,iocharset=utf8 $1 /mnt
fi
;;
vfat)
if [ $# = 2 ]; then
mount -t vfat -o ro,gid=100,dmask=2,fmask=113 $1 $2
else mount -t vfat -o ro,gid=100,dmask=2,fmask=113 $1 /mnt
fi
;;
*)
[ $# = 2 ] && mount -r $1 $2 || mount -r $1 /mnt
;;
esac
fi
}

# Create a union filesystem
union() {
mount -t tmpfs none /opt/tmp
modinfo unionfs > /dev/null 2>&1 &&
mount -t unionfs -o dirs=/opt/tmp=rw:/opt=ro none /mnt ||
( mkdir /opt/tmp/.change
modprobe fuse
unionfs-fuse -o allow_other,use_ino,suid,dev,nonempty,kernel_cache \
-o cow,chroot=/opt,max_files=32768 /tmp/.change=RW:/=RO /mnt )
}

# Mount proc and sysfs.
mount -t proc none /proc
mount -t sysfs none /sys

# Find the available PCI hardware
mount -t tmpfs none /tmp
pcimodules > /tmp/pcimodules.txt

# Populate /dev (Needs kernel >= 2.6.32)
mount -t devtmpfs none /dev
mkdir -m 755 /dev/pts
mount -t devpts -o gid=5,mode=620 none /dev/pts

# Set default values
boot=ata
root=/dev/sda6

# Find the root=, label=, uuid= and boot= values on kernel command line.
for i in $(cat /proc/cmdline); do
case $i in
root\=*)
root=$(get_opt $i)
case $root in
/dev/cdr* | /dev/dvd* | /dev/sr* | /dev/scd*)
boot=cdrom
;;
0x200)
root=/dev/fd0
;;
esac
;;
label\=* | uuid\=* | boot\=* | vmode\=* )
eval $i
;;
single)
RUNLEVEL=single
;;
nox)
RUNLEVEL=2
;;
esac
done

# Activate framebuffer display devices.
if [ $vmode ]; then
if [ $boot = cdrom ]; then
modprobe uvesafb scroll=ywrap mode_option=$vmode-16
else for i in $(grep fb /tmp/pcimodules.txt); do
case $i in
atyfb)
modprobe $i mode=$vmode-16
;;
nvidiafb | rivafb)
modprobe nvidiafb mode_option=$vmode bpp=16 hwcur=1
;;
radeonfb | savagefb)
modprobe $i mode_option=$vmode-16
;;
sisfb)
modprobe $i mode=$vmodex16 mem=12288 font=SUN12x22
;;
viafb | vt8623fb)
modprobe viafb viafb_mode=$vmode viafb_bpp=16
;;
*)
modprobe $i
;;
esac
done
if grep -q i915 /tmp/pcimodules.txt; then true
else [ -c /dev/fb0 ] || modprobe uvesafb scroll=ywrap mode_option=$vmode-16
fi
fi
fi

case $boot in
cdrom)
# Boot Linux from a live CD.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sr_mod &&
sleep 7
modprobe isofs
mount -t iso9660 /dev/sr0 /media
[ -d /media/isolinux -o -d /media/boot/isolinux ] ||
mount -t iso9660 /dev/sr1 /media
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
if [ $root = /dev/ram ]; then
echo "Please wait until the RAM disk is ready."
dd if=$SQF of=/dev/ram1 bs=2048 &&
mount -t squashfs /dev/ram1 /opt
else modprobe loop
mount -t squashfs -o loop $SQF /opt
fi
else
mount --move /media /opt
fi
union
;;
loop)
# Boot Linux from an image file.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root /media
modprobe loop
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
mount -t squashfs -o loop $SQF /opt
elif [ -f /media/*.[Ii][Ss][Oo] ]; then
ISO=$(ls -t /media/*.[Ii][Ss][Oo] | head -n 1)
modprobe isofs
mount -t iso9660 -o loop $ISO /opt
fi
union
;;
ram)
# Boot Linux from ramdisk.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root /media
echo "Please wait until the RAM disk is ready."
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
dd if=$SQF of=/dev/ram1 &&
mount -t squashfs /dev/ram1 /opt
elif [ -f /media/*.[Ii][Ss][Oo] ]; then
ISO=$(ls -t /media/*.[Ii][Ss][Oo] | head -n 1)
dd if=$ISO of=/dev/ram1 bs=2048 &&
modprobe isofs
mount -t iso9660 /dev/ram1 /opt
fi
union
;;
usb*)
# Boot Linux from a USB drive.
loadmod ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root
;;
ata*)
loadmod ata_ ahci pdc_adma &&
modprobe sd_mod &&
mountr $root
;;
esac

# Make sure that init exists and is executable.
if [ -x /mnt/sbin/init ]; then
mount --move /dev /mnt/dev
mount --move /proc /mnt/proc
mount --move /sys /mnt/sys
umount /tmp

# Start init from the root filesystem.
cd /mnt
[ -f /media/updates.zip ] && unzip -o /media/updates.zip
case $boot in
cdrom)
[ $root = /dev/ram ] && umount /media
[ $RUNLEVEL ] || RUNLEVEL=3
;;
loop | ram)
umount /media
[ $RUNLEVEL ] || RUNLEVEL=3
;;
*)
[ $RUNLEVEL ] || RUNLEVEL=5
;;
esac
[ -d initrd ] && pivot_root . initrd
exec chroot . /sbin/init $RUNLEVEL
fi

# Start a shell as a last resort.
echo "Error booting from the root filesystem. Starting a shell."
exec /bin/dash


The following are examples of boot parameters that can be used with my init script.




  • Boot Linux from the local hard drive partition /dev/sda8

    boot=ata root=/dev/sda8

  • Boot Linux from the latest squashfs file (*.sq*) on /dev/sda1

    boot=loop root=/dev/sda1

  • Boot Linux from the CD-ROM with 1024x768 video resolution

    boot=cdrom vmode=1024x768

  • Copy the squashfs image from CD-ROM into memory and run Linux on memory

    boot=cdrom root=/dev/ram ramdisk_size=573440 vmode=800x600

  • Boot Linux from the second partition of a USB drive

    boot=usb root=/dev/sda2



Also read:


Wednesday, September 26, 2012

Using UnionfsFuse on Debian/Ubuntu Linux

Unionfs-fuse is a user-space implementation of unionfs that makes it possible to run Linux over a read-only medium, such as CD-ROM. Unionfs-fuse is a convenient alternative to kernel implementations (unionfs, aufs and overlayfs), so users don't have to patch the kernel in order to try unionfs. There are many possible uses of unionfs:




  • Create a live CD
  • Run Linux from a read-only filesystem image, such as a squashfs file
  • Freeze an existing Linux system and save all changes in the memory


Unionfs achieves all this by merging a read-only filesystem and a writeable filesystem into a single virtual filesystem and mount it at a certain mount point. Let's try and apply unionfs-fuse to the third situation above. Basically, we need to create an initramfs file containing unionfs-fuse and a custom init script. The basic procedure is like this:






  1. Load kernel drivers necessary to access the underlying storage device
  2. Mount the read-only filesystem image at /opt
  3. Mount tmpfs at /opt/tmp and create a directory /opt/tmp/.change
  4. Use unionfs-fuse to merge the two and mount it at /mnt
  5. Use chroot and start /sbin/init to boot the new unionfs filesystem


To carry about the above steps, an init script might look like this:



#!/bin/dash
# Use the small but functional dash to process this script

# Mount /proc, /sys, /dev and /dev/pts just in case
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev
mkdir -m 755 /dev/pts
mount -t devpts -o gid=5,mode=620 none /dev/pts

# Write commands here to load modules necessary to access a hard drive
modprobe pata_via
modprobe sd_mod

# Mount the Linux filesystem read-only at /opt
mount -r /dev/sda6 /opt

# Mount tmpfs at /opt/tmp
mount -t tmpfs none /opt/tmp
mkdir /opt/tmp/.change

# Create a unionfs mount at /mnt
modprobe fuse
unionfs-fuse -o allow_other,use_ino,suid,dev,nonempty,kernel_cache \
-o cow,chroot=/opt,max_files=32768 /tmp/.change=RW:/=RO /mnt

# Make sure that init exists and is executable
if [ -x /mnt/sbin/init ]; then
mount --move /dev /mnt/dev
mount --move /proc /mnt/proc
mount --move /sys /mnt/sys

# Start init from the root filesystem with runlevel 5.
exec chroot /mnt /sbin/init 5
fi


The computer will boot into a virtual unionfs, consisting of writable tmpfs on top of read-only root filesystem. Make sure to modify /etc/rc.local so that it contains the following snippet of code.



for i in `ps ax | grep unionfs | grep -v grep | awk '{print $1}'`; do
echo $i > /var/run/sendsigs.omit.d/unionfs.$i;
done


This prevents Linux from killing unionfs-fuse during shutdown so the system will properly shut down.



Related Posts



Saturday, September 22, 2012

To Compile UnionFS-fuse 0.26 on Debian Linux

I am trying to switch to unionfs-fuse for my live CD, but so far I haven't much success yet. Debian's unionfs-fuse package in Sid is outdated (version 0.24), so I compiled version 0.26. I had to install libfuse-dev in order to be able to build UnionFS-fuse. I probably needed cmake too, but I didn't choose to install cmake.






  • cmake
  • gcc
  • libfuse-dev
  • make


I edited Makefile to change PREFIX.



PREFIX=/usr
BINDIR=/bin
SBINDIR=/sbin


I just typed make to begin compilation.



make
make install


The following files are installed.



/usr/bin/unionfs
/usr/sbin/mount.unionfs
/usr/share/man/man8/unionfs-fuse.8


To make it compatible with Debian and derivatives, I renamed unionfs.



mv /usr/bin/unionfs /usr/bin/unionfs-fuse

Tuesday, August 28, 2012

Manually Creating initrd / initramfs to Boot Linux

Initrd and initramfs files are used together with a Linux kernel and a bootloader (such as GRUB and syslinux) to start up Linux and boot it in many different ways. Many Linux distributions provide prepackaged kernels and convenient tools for creating initramfs, but I like to build my own kernel and initramfs because it allows me to customize the boot process. For instance, one can choose to boot from the local disk or network-mounted disk with the help of initramfs and some user-defined boot parameters. Here's a list of things that I'd like to achieve with my custom initramfs.




  1. Boot from a live CD
  2. Boot from a read-only filesystem image, compressed with SquashFS
  3. Copy the filesystem image to a RAM disk and run Linux entirely on memory
  4. Boot Linux from a USB flash drive or a Firewire disk
  5. Boot Linux from a local disk partition
  6. Boot Linux from a network drive
  7. Run a rescue shell without booting Linux
  8. Start a kdrive X-server and run gparted, partclone or partimage


In this post, I show how I normally create initrd / initramfs files. For this tutorial, the following Debian/Ubuntu packages are needed:




  • busybox

    provides small essential utilities for booting and rescue shell.
  • cpio

    is used to create the actual initramfs format.
  • dash

    provides a minimalist shell for running the init script and the rescue shell.
  • e2fsprogs, jfsutils, etc.

    provides fsck to check Linux filesystems and replay any stale journal
  • lzma or xz-utils

    compresses the initramfs
  • module-init-tools

    is used to load kernel modules necessary to activate hardware and mount the filesystem
  • pciutils

    is used to detect PCI hardware
  • unionfs-fuse

    makes it possible to use read-only Linux systems, such as live CD and filesystem images
  • unzip

    is used to apply customized settings and changes to the unionfs boot mode
  • v86d

    is used to set the screen resolution for the framebuffer screen


First, create a text file with a list of files to put in initramfs. The following is an example of such file:



bin/busybox
bin/dash
bin/mount
etc/filesystems
etc/fuse.conf
etc/group
etc/modprobe.d
lib/ld-linux.so.2
lib/libacl.so.1
lib/libattr.so.1
lib/libblkid.so.1
lib/libbz2.so.1.0
lib/libcom_err.so.2
lib/libc.so.6
lib/libdl.so.2
lib/libe2p.so.2
lib/libext2fs.so.2
lib/libfuse.so.2
lib/libkmod.so.2
lib/libmount.so.1
lib/libm.so.6
lib/libpci.so.3
lib/libpthread.so.0
lib/libresolv.so.2
lib/librt.so.1
lib/libselinux.so.1
lib/libsepol.so.1
lib/libuuid.so.1
lib/libx86.so.1
lib/libz.so.1
lib/modules/3.5.3/kernel/drivers/ata
lib/modules/3.5.3/kernel/drivers/block/loop.ko
lib/modules/3.5.3/kernel/drivers/cdrom/cdrom.ko
lib/modules/3.5.3/kernel/drivers/connector/cn.ko
lib/modules/3.5.3/kernel/drivers/firewire/firewire-core.ko
lib/modules/3.5.3/kernel/drivers/firewire/firewire-ohci.ko
lib/modules/3.5.3/kernel/drivers/firewire/firewire-sbp2.ko
lib/modules/3.5.3/kernel/drivers/i2c/algos/i2c-algo-bit.ko
lib/modules/3.5.3/kernel/drivers/scsi/sd_mod.ko
lib/modules/3.5.3/kernel/drivers/scsi/sr_mod.ko
lib/modules/3.5.3/kernel/drivers/usb/host/ehci-hcd.ko
lib/modules/3.5.3/kernel/drivers/usb/host/ohci-hcd.ko
lib/modules/3.5.3/kernel/drivers/usb/host/uhci-hcd.ko
lib/modules/3.5.3/kernel/drivers/usb/storage/usb-storage.ko
lib/modules/3.5.3/kernel/drivers/video
lib/modules/3.5.3/kernel/fs/ext3/ext3.ko
lib/modules/3.5.3/kernel/fs/ext4/ext4.ko
lib/modules/3.5.3/kernel/fs/fat/fat.ko
lib/modules/3.5.3/kernel/fs/fat/vfat.ko
lib/modules/3.5.3/kernel/fs/fuse/fuse.ko
lib/modules/3.5.3/kernel/fs/isofs/isofs.ko
lib/modules/3.5.3/kernel/fs/jbd2/jbd2.ko
lib/modules/3.5.3/kernel/fs/jbd/jbd.ko
lib/modules/3.5.3/kernel/fs/jfs/jfs.ko
lib/modules/3.5.3/kernel/fs/nls/nls_cp437.ko
lib/modules/3.5.3/kernel/fs/nls/nls_iso8859-1.ko
lib/modules/3.5.3/kernel/fs/nls/nls_utf8.ko
lib/modules/3.5.3/kernel/fs/reiserfs/reiserfs.ko
lib/modules/3.5.3/kernel/fs/squashfs/squashfs.ko
lib/modules/3.5.3/kernel/fs/xfs/xfs.ko
lib/modules/3.5.3/kernel/lib/crc16.ko
lib/modules/3.5.3/kernel/lib/crc-t10dif.ko
lib/modules/3.5.3/modules.dep
lib/modules/3.5.3/modules.dep.bin
lib/modules/3.5.3/modules.pcimap
sbin/blkid
sbin/e2fsck
sbin/jfs_fsck
sbin/modprobe
sbin/v86d
usr/bin/pcimodules
usr/bin/unionfs-fuse
usr/bin/unzip


Then, create an empty directory, for example, /tmp/initrd and copy the files listed in the above-mentioned text file (called rd354.txt) to the new directory.



mkdir /tmp/initrd
cd /
tar cvhf - -T rd354.txt | (cd /tmp/initrd; tar xf -)


Then, create the necessary directory structure under /tmp/initrd:



cd /tmp/initrd
mkdir -p dev media mnt proc root sys tmp


Since I chose to use busybox, I need to create symbolic links to busybox in /bin. Busybox provides incomplete functionality for modprobe, mount, sh and unzip, so I removed their symbolic links.



cd /tmp/initrd/bin
for f in $(./busybox --list); do [ -e $f ] || ln -s busybox $f ; done
rm modprobe unzip


Then, create essential device nodes in /tmp/initrd/dev:



cd /tmp/initrd/dev
MAKEDEV std fb0 fd0 sda sdb scd
mknod console c 5 1
mknod fuse c 10 229
chmod 666 fuse


Now, create an init script. The contents of this init script is crucial for customization of the boot process. The following is the script I use. This script is capable of booting a live CD and running Linux within memory in addition to booting Linux from hard drives and USB flash.



#!/bin/dash

# Define a function to parse kernel command line options.
get_opt() {
echo $@ | cut -d "=" -f 2
}

# Define a function to load drivers.
loadmod() {
for i in $@ ; do
for j in $(grep $i /tmp/pcimodules.txt); do
modprobe $j
done
done
}

# Define a function to guess the partition type.
gpart() {
for i in $(blkid | grep $1); do
case $i in
*\=*)
eval $i
;;
*)
true
;;
esac
done
}

# Define a function for mounting the root partition.
mountr() {
if [ $uuid ]; then
if [ $# = 2 ]; then
mount -r -U $uuid $2
elif [ $# = 1 ]; then
mount -r -U $uuid $1
else mount -r -U $uuid /mnt
fi
elif [ $label ]; then
if [ $# = 2 ]; then
mount -r -L $label $2
elif [ $# = 1 ]; then
mount -r -L $label $1
else mount -r -L $label /mnt
fi
else
gpart $1
case $TYPE in
ext*)
e2fsck -p $1
[ $# = 2 ] && mount $1 $2 || mount $1 /mnt
;;
jfs)
jfs_fsck $1
if [ $# = 2 ]; then
mount -t jfs -o ro,iocharset=utf8 $1 $2
else mount -t jfs -o ro,iocharset=utf8 $1 /mnt
fi
;;
vfat)
if [ $# = 2 ]; then
mount -t vfat -o ro,gid=100,dmask=2,fmask=113 $1 $2
else mount -t vfat -o ro,gid=100,dmask=2,fmask=113 $1 /mnt
fi
;;
*)
[ $# = 2 ] && mount -r $1 $2 || mount -r $1 /mnt
;;
esac
fi
}

# Create a union filesystem
union() {
mount -t tmpfs none /opt/tmp
modinfo unionfs > /dev/null 2>&1 &&
mount -t unionfs -o dirs=/opt/tmp=rw:/opt=ro none /mnt ||
( mkdir /opt/tmp/.change
modprobe fuse
unionfs-fuse -o allow_other,use_ino,suid,dev,nonempty,kernel_cache \
-o cow,chroot=/opt,max_files=32768 /tmp/.change=RW:/=RO /mnt )
}

# Mount proc and sysfs.
mount -t proc none /proc
mount -t sysfs none /sys

# Find the available PCI hardware
mount -t tmpfs none /tmp
pcimodules > /tmp/pcimodules.txt

# Populate /dev (Needs kernel >= 2.6.32)
mount -t devtmpfs none /dev
mkdir -m 755 /dev/pts
mount -t devpts -o gid=5,mode=620 none /dev/pts

# Set default values
boot=ata
root=/dev/sda6

# Find the root=, label=, uuid= and boot= values on kernel command line.
for i in $(cat /proc/cmdline); do
case $i in
root\=*)
root=$(get_opt $i)
case $root in
/dev/cdr* | /dev/dvd* | /dev/sr* | /dev/scd*)
boot=cdrom
;;
0x200)
root=/dev/fd0
;;
esac
;;
label\=* | uuid\=* | boot\=* | vmode\=* )
eval $i
;;
single)
RUNLEVEL=single
;;
nox)
RUNLEVEL=2
;;
esac
done

# Activate framebuffer display devices.
if [ $vmode ]; then
if [ $boot = cdrom ]; then
modprobe uvesafb scroll=ywrap mode_option=$vmode-16
else for i in $(grep fb /tmp/pcimodules.txt); do
case $i in
atyfb)
modprobe $i mode=$vmode-16
;;
nvidiafb | rivafb)
modprobe nvidiafb mode_option=$vmode bpp=16 hwcur=1
;;
radeonfb | savagefb)
modprobe $i mode_option=$vmode-16
;;
sisfb)
modprobe $i mode=$vmodex16 mem=12288 font=SUN12x22
;;
viafb | vt8623fb)
modprobe viafb viafb_mode=$vmode viafb_bpp=16
;;
*)
modprobe $i
;;
esac
done
if grep -q i915 /tmp/pcimodules.txt; then true
else [ -c /dev/fb0 ] || modprobe uvesafb scroll=ywrap mode_option=$vmode-16
fi
fi
fi

case $boot in
cdrom)
# Boot Linux from a live CD.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sr_mod &&
sleep 7
modprobe isofs
mount -t iso9660 /dev/sr0 /media
[ -d /media/isolinux -o -d /media/boot/isolinux ] ||
mount -t iso9660 /dev/sr1 /media
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
if [ $root = /dev/ram ]; then
echo "Please wait until the RAM disk is ready."
dd if=$SQF of=/dev/ram1 bs=2048 &&
mount -t squashfs /dev/ram1 /opt
else modprobe loop
mount -t squashfs -o loop $SQF /opt
fi
else
mount --move /media /opt
fi
union
;;
loop)
# Boot Linux from an image file.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root /media
modprobe loop
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
mount -t squashfs -o loop $SQF /opt
elif [ -f /media/*.[Ii][Ss][Oo] ]; then
ISO=$(ls -t /media/*.[Ii][Ss][Oo] | head -n 1)
modprobe isofs
mount -t iso9660 -o loop $ISO /opt
fi
union
;;
ram)
# Boot Linux from ramdisk.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root /media
echo "Please wait until the RAM disk is ready."
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
dd if=$SQF of=/dev/ram1 &&
mount -t squashfs /dev/ram1 /opt
elif [ -f /media/*.[Ii][Ss][Oo] ]; then
ISO=$(ls -t /media/*.[Ii][Ss][Oo] | head -n 1)
dd if=$ISO of=/dev/ram1 bs=2048 &&
modprobe isofs
mount -t iso9660 /dev/ram1 /opt
fi
union
;;
usb*)
# Boot Linux from a USB drive.
loadmod ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root
;;
ata*)
loadmod ata_ ahci pdc_adma &&
modprobe sd_mod &&
mountr $root
;;
esac

# Make sure that init exists and is executable.
if [ -x /mnt/sbin/init ]; then
mount --move /dev /mnt/dev
mount --move /proc /mnt/proc
mount --move /sys /mnt/sys
umount /tmp

# Start init from the root filesystem.
cd /mnt
[ -f /media/updates.zip ] && unzip -o /media/updates.zip
case $boot in
cdrom)
[ $root = /dev/ram ] && umount /media
[ $RUNLEVEL ] || RUNLEVEL=3
;;
loop | ram)
umount /media
[ $RUNLEVEL ] || RUNLEVEL=3
;;
*)
[ $RUNLEVEL ] || RUNLEVEL=5
;;
esac
[ -d initrd ] && pivot_root . initrd
exec chroot . /sbin/init $RUNLEVEL
fi

# Start a shell as a last resort.
echo "Error booting from the root filesystem. Starting a shell."
exec /bin/dash


Copy the init script to the initrd folder (Assuming its filename is init.sh).



cp init.sh /tmp/initrd/init
cp init.sh /tmp/initrd/etc
chmod 775 /tmp/initrd/init


Now, use cpio and lzma to create an initramfs file. This assumes that the kernel was compiled with CONFIG_RD_LZMA option enabled.



cd /tmp/initrd
find . | cpio -H newc -o | lzma -c > ../initram.lzm


A file named initram.lzm will be created. If you want to create an old-style initrd file instead, use the mkcramfs command. This assumes your kernel has built-in cramfs support (CONFIG_CRAMFS):



mkcramfs /tmp/initrd /boot/initrd.bin


Copy the kernel and the initramfs file to your boot directory (whereever it is). I use SYSLINUX which I installed at /dev/sda1 partition. Finally, edit the boot configuration file. The following is the contents of a sample syslinux.cfg:



LABEL debian
KERNEL 314.lnx
INITRD /initrd/initram.lzm
APPEND root=/dev/sda7

LABEL sid
KERNEL 314.lnx
INITRD /initrd/initram.lzm
APPEND boot=usb label=SID edd=off vmode=800x600

LABEL bfile
KERNEL 314.lnx
INITRD /initrd/initram.lzm
APPEND boot=loop root=/dev/sda1

LABEL ram
KERNEL 314.lnx
INITRD /initrd/initram.lzm
APPEND boot=ram ramdisk_size=524288 root=/dev/sda1

Saturday, August 21, 2010

Debian Linux: Simple steps to recover files from /lost+found

The following steps illustrate how one can use simple shell commands to recover files from the /lost+found directory in Linux. This assumes that you actually have some files in /lost+found.




  1. First, concatenate all the *.md5sums files in /var/lib/dpkg/info into a single file:


    cd /var/lib/dpkg/info
    cat *.md5sums | sort -k 2 > /tmp/all.md5


  2. Go to the /lost+found directory. fsck may have placed some files here after fixing the Linux partition. If you don't find any file here, you can relax and skip the following steps. Run md5sum on files in /lost+found.


    cd /lost+found
    md5sum * | sort > /tmp/lost.md5


  3. Put only the md5sum values into a temporary file, called 0.txt.


    awk '{print $1}' /tmp/lost.md5 > /tmp/0.txt


  4. Search all.md5 for the md5sum values in 0.txt and save the results in 1.txt.


    for f in $(cat /tmp/0.txt); do grep $f all.md5 >> /tmp/1.txt; done


  5. Put the names of files in /lost+found into a temporary fie 2.txt.


    awk '{print $2}' /tmp/lost.md5 > /tmp/2.txt


  6. Move the lost+found files to their original locations.


    cd /
    for $f in $(cat /tmp/2.txt); do MD5=$(grep $f /dev/shm/lost.md5 | awk '{print $1}'); ORIGIN=$(grep $MD5 /tmp/1.txt | awk '{print $2}'); mv /lost+found/$f /$ORIGIN; done

Wednesday, July 28, 2010

Checking Integrity of A Debian/Ubuntu System

Sometimes, a Linux filesystem becomes corrupted, system files are damaged, or some crucial files get lost. This often happens, regardless of which filesystem (ext2, ext3, ext4, jfs, reiserfs, reiser4, or xfs) is used. There are many possible reasons, such as:



  • Unstable hardware, for example, memory or hard drive problem
  • Overheat, power surge, quake or another environmental disaster
  • Buggy software, such as a bug in the kernel or the filesystem driver
  • Compromised security, for example, network intrusion or attack
  • Worm or virus infection


Files in Linux systems can be categorized into the following three:




  1. Verifiable System Files

    In Linux systems that are managed by packages (such as Debian and Ubuntu), these files are installed by packages and make up the bulk of the filesystem. These files reside in such directories as /bin, /lib, /sbin and /usr. They are usually static, which means they don't normally change except when the system is updated, or locally compiled binaries are installed.
  2. Changeable System Files

    These files are auxiliary system files for system configuration, initialization or customization, and system data (such as logs and cache). They reside in /boot, /etc, /opt, /srv and /var.
  3. User Data

    These files are created and used by superuser (a.k.a root) and normal users, or software-generated during casual user activities. Typically, they are in /home, /media, /mnt and /root.


This post focuses on verifiable system files (installed by packages). When the filesystem becomes corrupted (but not completely unreadable), it is possible to verify and restore the system integrity by using package checksums. Before you continue, make sure to fsck the filesystem.



e2fsck -r -v /dev/sda7


In this example, /dev/sda7 points to an ext2 partition we're going to check. Be aware that you cannot fsck a mounted filesystem. Therefore, boot with a Debian Live CD (or a Ubuntu CD) and run fsck. After you've performed fsck, there may be some files created in the /lost+found directory. We'll deal with them later. First, mount the filesystem.



mount -t ext2 /dev/sda7 /mnt


Go to /var/lib/dpkg/info. Then, concatenate all the md5sums files. Most, if not all, Debian and Ubuntu packages come with a md5sum file that we can use to check the integrity of the package and the files installed by the package.



cd /var/lib/dpkg/info
cat *.md5sums | sort > /dev/shm/all.md5


all.md5 has md5 checksums of all the files installed on the system. Now, check the files on the Debian/Ubuntu system against the concatenated md5sums file.



cd /
md5sum -c /dev/shm/all.md5 > /dev/shm/check.txt 2>&1


/dev/shm/check.txt now contains the results of the integrity check. It looks like this:



bin/bash: OK
bin/bunzip2: OK
bin/bzcat: FAILED


In this example, /bin/bzcat is damaged. To find all the missing or damaged files, use a command like this one:



grep -v ': OK$' /dev/shm/check.txt


Let's reinstall this file. First, find out which package this file belongs to.



dpkg -S /bin/bzcat


We'll see the following result.



bzip2: /bin/bzcat


Now we know that we need to reinstall bzip2. Let's download the package.



dpkg -p bzip2 | grep 'Filename: '


This command will let us know the name of the package to download. Use wget to download it.



wget ftp://ftp.us.debian.org/debian/pool/main/b/bzip2/bzip2_1.0.5-4_i386.deb


You can just reinstall the package.



dpkg -i bzip2_1.0.5-4_i386.deb


Or, you can just extract one file:



dpkg --fsys-tarfile bzip2_1.0.5-4_i386.deb | tar xf - ./bin/bzcat


Alternatively,



dpkg --fsys-tarfile bzip2_1.0.5-4_i386.deb | tar xOf - ./bin/bzcat > /mnt/bin/bzcat


To restore a file from the /lost+found directory, you can also use the MD5SUMS file. First, run md5sum on files in /lost+found.



cd /lost+found
md5sum *


You may get an output like this.



9aaa2176d20c1b1203e3abbac55a2513  #124531


To find out what #124531 file is originally, find its md5 checksum from the all.md5 file above.



grep 9aaa /dev/shm/all.md5


You'll get a result like this.



9aaa2176d20c1b1203e3abbac55a2513  bin/bzip2


Now you can just move it to its place.



mv \#124531 /mnt/bin/bzip2


After you restore all damaged files and restore files from /lost+found, you can find missing files in the system. Go to /var/lib/dpkg/info again and concatenate all the list files.



cd /var/lib/dpkg/info
cat *.list | sort | uniq > /dev/shm/all.txt


The .list files in the /var/lib/dpkg/info directore show the list of files installed by packages. Let's find what's missing from the system.



cd /
for f in $(cat /dev/shm/all.txt ); do test -e "$f" || echo "$f" >> /dev/shm/nonexist.txt ; done


The file /dev/shm/nonexist.txt will show which files are missing from the system. You can then replace the missing files as done previously.

Monday, July 26, 2010

Linux: Using dd To Back Up Hard Drive Partitions

I am going to use the omnipresent and omnipotent tool called dd to back up a hard drive partition. I am working with the drive /dev/sdb. First, I save a text file that has information on the partition table layout.



fdisk -l /dev/sdb > hdpt.txt
fdisk -l -u /dev/sdb >> hdpt.txt


Then, I choose the compression format to use for the backup archive.


  • gzip
  • bzip2
  • lzma
  • xz


My choice for the compression format is lzma which provides superior compression and faster decompression. The following command backs up a partition at /dev/sdb1 with dd and lzma.



dd if=/dev/sdb1 | lzma -9c > backup01.bin.lzma


To restore this backup later, use the following command:



lzcat backup01.bin.lzma | dd of=/dev/sdb1

Thursday, July 22, 2010

Linux Commands To Partition and Format a Drive

Partitioning



In addition to the wonderful gparted, we can also use fdisk to partition a disk:



fdisk /dev/sdb


The device names for hard disks and USB drives are typically /dev/sd?, for example, /dev/sda, /dev/sdb, /dev/sdc, etc. For Linux kernels 2.6.18 or older, IDE hard drives may be called /dev/hda, /dev/hdb, etc.



Formatting



To format a FAT16 partition:



mkdosfs -F 16 -n LABEL -r 512 -v /dev/sdb1


To format EXT2 partition:



mke2fs -L SID -v /dev/sdb2


To format a JFS partition:



jfs_mkfs -c -L Debian_Sid /dev/sdb2


Installing MBR


MBR is a boot code necessary for booting from the hard drive or USB flash.



install-mbr /dev/sdb -v --drive 0x80 --enable +12


Installing bootloaders


For SYSLINUX:


syslinux /dev/sdb1


Checking Filesystem Integrity


For FAT16/FAT32:


dosfsck -r -v -V /dev/sdb1

Friday, June 5, 2009

VNC4 vs TightVNC

A frequent question people have when setting up and using VNC is what differences are there between VNC4 and TightVNC. These differences are summarized in the table below.





VNC4 TightVNC
Developer RealVNC Limited TightVNC.com
License Only free edition is open-source Open-source
Platfrom Windows, Linux Windows, Linux
Installed Size 4648 KB 1432 KB
Linux Dependencies libsm6, libstdc++6, libxext6, zlib1g libxext6, libjpeg62, zlib1g
Supported Encodings ZRLE, Hextile, Raw copyrect, tight, hextile, zlib, corre, rre, raw
Inetd supported mode Wait, Nowait Nowait
Shared Sessions from Inetd Shared, Non-shared Non-shared

Thursday, June 4, 2009

Building FAAC, XviD, GPAC and OGMRip



After building MPlayer and Mencoder for Linux, the last fun part is to build OGMRip so that we can rip movies into AVI or MP4 files as found on the P2P networks. OGMRip is a graphical movie convertor that uses MPlayer and Mencoder to convert a movie into another format.



Building FAAC


First, let's compile FAAC as it is needed to encode AAC audio. You need a g++ compiler, autoconf, automake and tcl-dev to compile FAAC, following a typical procedure:


./bootstrap
./configure --build=i586-pc-linux-gnu --prefix=/usr --with-mp4v2
make
make install

The bootstrap command produces the configure script and Makefile necessary for the build procedure. The following set of files are generated upon compilation of FAAC:


/usr/bin/faac
/usr/include/faac.h
/usr/include/faaccfg.h
/usr/lib/libfaac.a
/usr/lib/libfaac.la
/usr/lib/libfaac.so
/usr/lib/libfaac.so.0
/usr/lib/libfaac.so.0.0.0
/usr/man/man1/faac.1.gz


Building XviD library


Now, let's build the XviD library. XviD is a popular video codec. A typical build procedure for XviD looks like this:


tar xzf xvidcore-1.2.2.tar.gz
cd xvidcore/build/generic
./configure --build=i586-pc-linux-gnu --prefix=/usr
make
make install

Upon successful compilation, the following set of files are installed on system.


/usr/lib/libxvidcore.a
/usr/include/xvid.h
/usr/lib/libxvidcore.so
/usr/lib/libxvidcore.so.4
/usr/lib/libxvidcore.so.4.1


Building GPAC


Next, let's compile GPAC which is an open-source MPEG-4 encoder. Before compiling GPAC, install the following developer libraries, most of which are optional:


liba52-0.7.4-dev
libasound2-dev
libavformat-dev
libfaad-dev
libmad0-dev
libmozjs-dev
libogg-dev
libopenjpeg-dev
libssl-dev
libtheora-dev
libvorbis-dev
libwxgtk2.8-0
libxvidcore4

Then, compile GPAC as follows:


./configure --prefix=/usr/local --cpu=i586 --enable-pic --strip --use-ffmpeg=local --use-js=local

make

make install

When GPAC is compiled and installed successfully, the following set of files are generated on the system:


/usr/bin/MP4Box
/usr/bin/MP4Client
/usr/bin/Osmo4
/usr/lib/gpac/gm_aac_in.so
/usr/lib/gpac/gm_ac3_in.so
/usr/lib/gpac/gm_alsa.so
/usr/lib/gpac/gm_bifs_dec.so
/usr/lib/gpac/gm_ctx_load.so
/usr/lib/gpac/gm_dummy_in.so
/usr/lib/gpac/gm_ffmpeg_in.so
/usr/lib/gpac/gm_ft_font.so
/usr/lib/gpac/gm_gpac_js.so
/usr/lib/gpac/gm_img_in.so
/usr/lib/gpac/gm_ismacryp.so
/usr/lib/gpac/gm_isom_in.so
/usr/lib/gpac/gm_laser_dec.so
/usr/lib/gpac/gm_mp3_in.so
/usr/lib/gpac/gm_mpegts_in.so
/usr/lib/gpac/gm_odf_dec.so
/usr/lib/gpac/gm_ogg_xiph.so
/usr/lib/gpac/gm_oss_audio.so
/usr/lib/gpac/gm_raw_out.so
/usr/lib/gpac/gm_rtp_in.so
/usr/lib/gpac/gm_saf_in.so
/usr/lib/gpac/gm_soft_raster.so
/usr/lib/gpac/gm_svg_in.so
/usr/lib/gpac/gm_timedtext.so
/usr/lib/gpac/gm_x11_out.so
/usr/lib/gpac/gm_xvid_dec.so
/usr/lib/libgpac-0.4.5.so
/usr/lib/libgpac.so
/usr/man/man1/gpac.1.gz
/usr/man/man1/mp4box.1.gz
/usr/man/man1/mp4client.1.gz
/usr/share/gpac/gpac.mp4

If you encounter the following error during compilation:


scenegraph/vrml_smjs.c:41:20: error: jsapi.h: No such file or directory

make symlinks to jsapi.h and compile again as follows:


cd include/

ln -s ../extra_lib/include/js/* .

cd ..

./configure --prefix=/usr --cpu=i586 --enable-pic --strip --use-ffmpeg=local --use-js=local --extra-cflags=-DXP_UNIX

make

make install

Some programs require the gpac static library libgpac_static.a. This file is not installed by default. However, you can copy it manually:


cp bin/gcc/libgpac_static.a usr/lib


Building OGMRip


Finally, let's build OGMRip. First, make sure you have the following developer libraries:


libdbus-glib-1-dev
libdvdread-dev
libenca-dev
libenchant-dev
libgconf2-dev
libglade2-dev
libgtk2.0-dev
libhal-dev
libnotify-dev
libstdc++6-4.4-dev
libtheora-dev

Optionally, install intltool, gtk-doc and xsltproc for internationalization and documentation. Then, build OGMRip as follows:


./configure --prefix=/usr/local --build=i586-pc-linux-gnu --sysconfdir=/etc --enable-gtk-doc --with-ocr=auto

make

make install

After OGMRip is compiled and installed successfully, the following set of files are generated on system:


/etc/gconf/schemas/ogmrip.schemas
/usr/bin/avibox
/usr/bin/dvdcpy
/usr/bin/ogmrip
/usr/bin/subp2pgm
/usr/bin/subp2png
/usr/bin/subp2tiff
/usr/bin/subptools
/usr/bin/theoraenc
/usr/include/ogmdvd/
/usr/include/ogmjob/
/usr/include/ogmrip/
/usr/lib/libogmdvd-gtk.a
/usr/lib/libogmdvd-gtk.la
/usr/lib/libogmdvd-gtk.so
/usr/lib/libogmdvd-gtk.so.0
/usr/lib/libogmdvd-gtk.so.0.0.0
/usr/lib/libogmdvd.a
/usr/lib/libogmdvd.la
/usr/lib/libogmdvd.so
/usr/lib/libogmdvd.so.0
/usr/lib/libogmdvd.so.0.0.0
/usr/lib/libogmjob.a
/usr/lib/libogmjob.la
/usr/lib/libogmjob.so
/usr/lib/libogmjob.so.0
/usr/lib/libogmjob.so.0.0.0
/usr/lib/libogmrip-gtk.a
/usr/lib/libogmrip-gtk.la
/usr/lib/libogmrip-gtk.so
/usr/lib/libogmrip-gtk.so.0
/usr/lib/libogmrip-gtk.so.0.0.0
/usr/lib/libogmrip-lavc.a
/usr/lib/libogmrip-lavc.la
/usr/lib/libogmrip-lavc.so
/usr/lib/libogmrip-lavc.so.0
/usr/lib/libogmrip-lavc.so.0.0.0
/usr/lib/libogmrip-mplayer.a
/usr/lib/libogmrip-mplayer.la
/usr/lib/libogmrip-mplayer.so
/usr/lib/libogmrip-mplayer.so.0
/usr/lib/libogmrip-mplayer.so.0.0.0
/usr/lib/libogmrip.a
/usr/lib/libogmrip.la
/usr/lib/libogmrip.so
/usr/lib/libogmrip.so.0
/usr/lib/libogmrip.so.0.0.0
/usr/lib/ogmrip/
/usr/lib/pkgconfig/ogmdvd-gtk.pc
/usr/lib/pkgconfig/ogmdvd.pc
/usr/lib/pkgconfig/ogmjob.pc
/usr/lib/pkgconfig/ogmrip-gtk.pc
/usr/lib/pkgconfig/ogmrip.pc
/usr/share/applications/ogmrip.desktop
/usr/share/doc/ogmrip/
/usr/share/gtk-doc/html/ogmdvd-gtk
/usr/share/gtk-doc/html/ogmdvd/
/usr/share/gtk-doc/html/ogmjob/
/usr/share/gtk-doc/html/ogmrip-gtk/
/usr/share/gtk-doc/html/ogmrip/
/usr/share/locale/ca/LC_MESSAGES/ogmrip.mo
/usr/share/locale/cs/LC_MESSAGES/ogmrip.mo
/usr/share/locale/de/LC_MESSAGES/ogmrip.mo
/usr/share/locale/fr/LC_MESSAGES/ogmrip.mo
/usr/share/locale/sv/LC_MESSAGES/ogmrip.mo
/usr/share/man/man1/avibox.1.gz
/usr/share/man/man1/dvdcpy.1.gz
/usr/share/man/man1/subp2pgm.1.gz
/usr/share/man/man1/subptools.1.gz
/usr/share/ogmrip/
/usr/share/pixmaps/ogmrip.png

Now that you've compiled OGMRip, go ahead and test it. Be sure that mplayer, mencoder, ogmtools, vorbis-tools, gpac, faac, lame, mkvtoolnix and gocr (or ocrad) are installed, also.


OGMRip Video Convertor Options

About This Blog

KBlog logo This blog seeks to share useful information on freely available fonts on the Internet. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

CyberChimps Professional WordPress Themes
Powered By Blogger