Tuesday, November 17, 2009

All linux distributions

All linux distributions are found here.

Tuesday, November 10, 2009

Supertux2 cheats

Not really cheats, but a console with scripts to manipulate the program.

It's found here

Console for SuperTux 2

Jump to: navigation, search

SuperTux 0.3.x: This text describes features that can be found in SuperTux 0.3.0 or later

The Console is a panel normally hidden from view. Its usage is twofold:

  • It displays informational, warning and error messages that occur during gameplay, alerting players of things like low diskspace, broken levels, ...
  • It helps debug the engine and test levels by allowing direct execution of Squirrel script commands (see Scripting reference)

The Console pops into view for a short time whenever new messages are printed. To review old messages and enter commands, the console needs to be activated.

To do so, you will have to run supertux using the --console option. The key assigned to opening the console can be changed in the keyboard setup as soon it is activated. (Default of ^) Use --noconsole to disable it again.

To disable or enable the console if you don't want to pass command line parameters, you will have to edit the edit the SuperTux configuration file. Depending on your operating system, this varies:

Operating System Config file location
Linux ~/.supertux2/config
Windows %USERPROFILE%/.supertux2/config
Mac OS X Home/Library/Application Support/SuperTux/config.txt
Mac OS X Leopard %USERPROFILE%/.supertux2/config

You may have to enable viewing hidden files or folders. Anyway, open the file up with a text editor, and

 (console #t)

will enable the console, and

 (console #f)

will disable the console. Find one to change it to the other.

Commands

Following is a list of predefined scripts to run in the console:

flip()Flips the current level vertically. Make sure you have something to stand on!
edit()Puts the level into a state suitable for testing out edits. Tux can't exit the level; if he dies or reaches the end he goes into ghost mode.
play()Goes out of edit mode and restarts the level.
kill()Kills Tux
grow()Grows Tux into big Tux
shrink()Shrinks Tux into little Tux (currently broken)
fire()Gives Tux the fire powerup
ice()Gives Tux the ice powerup
lifeup()Gives Tux 100 more coins
finish()Finish the current level
worldmapfinish()Finish all the levels on the worldmap
functions(x)Gives a list of the functions available in an object or table. If no argument is given, this prints out the functions in the root table.
display(*** object) Displays the string value of object in the Console. Object can be of any data type.
print_stacktrace() Displays contents of the current stack.
load_worldmap(string filename) Loads and runs the worldmap specified in filename. (The path is relative to the data root.)
load_level(string filename) Loads and runs the level specified in filename. (The path is relative to the data root.)
get_current_thread() Returns the currently running thread.
display_text_file(string filename) Displays the SuperTux text file named filename. (The path is relative to the data root, e.g. "/home/joe/src/supertux-trunk/data") See also: SuperTux file format reference, SuperTux texts
wait(float time) Pauses execution of the Squirrel code for time seconds.
wait_for_screenswitch() Pauses execution of the Squirrel code until a new screen is displayed (e.g. menu → worldmap or worldmap → level).
exit_screen() Exits the current screen, returning to the previous one or, if the active screen is the last one, exiting SuperTux.
fadeout_screen(float seconds) Does a fadeout for the specified number of seconds before next screenchange.
shrink_screen(float dest_x, float dest_y, float seconds) Does a shrinking fade towards the destposition for the specified number of seconds before next screenchange.
translate(string text) Returns: translated string. Translates text into the user's locale. Note: This construct is unfortunately not yet recognized by XGetText, so translation files have to be written manually.
import(string filename) Imports and runs the Squirrel script filename. (The path is relative to the data root.)
save_state() Dumps the current state into the user's save game file.
update_worldmap() Update worldmap from worldmap state (state.world variable)
play_music(string musicfile) Changes music to musicfile
play_sound(string soundfile) Plays a soundfile
debug_collrects(bool enable) Enables or disables drawing of collision rectangles.
debug_show_fps(bool enable) Enables or disables drawing of the FPS. (Also affects config file)
debug_draw_solids_only(bool enable) When enabled, only draws solid tilemaps. (No background/foreground tiles)
set_game_speed(float speed) Set speed to run the game at. (Doesn't affect menus/gui)
grease() Speeds Tux's horizontal velocity by a factor of 3.
ghost() Makes Tux a ghost, letting him float around and through objects.
invincible() Make Tux invincible for 10000 units of game time.
mortal() Recall Tux's invincibility or ghost status. (Even when not given with above 2 commands)
restart() Reinitialize and respawn Tux at the beginning of the current level.
whereami() Print out Tux's coordinates to the console.
gotoend() Moves Tux horizontally 2 screens away from the end.
camera() Display the current camera's coordinates. (top-left corner)
quit() Exits the game. (Not recommended for use in levels!)
int rand() Returns a random evenly-distributed integer between 0 and 2147483647, inclusive.



There are many more, see ScriptingGlobals for the full list of utility functions and Scripting reference for all the interesting things you can do.

Console Features

The console currently supports autocomplete, through use of the tab key, line editing with left/right/home/end/delete keys, and viewing past messages using the up, down, page up, and page down keys. To run a command, simply press the enter or return key.

Monday, November 9, 2009

Another ubuntu blogspot

Ubuntu blogspot

Saturday, November 7, 2009

hermans GRUB 2 pages

Here I found hermans GRUB2 pages. They're very usefull when making a dedicated or USB or CD-ROM grub

Wednesday, November 4, 2009

Tonido

Run a cloud on your own computer and share it over your network in ubuntu, mac an win.

read the article here:

Tonido

Tuesday, November 3, 2009

Grub 2 basics install

On this post I read the Grub 2 Basics

The Grub 2 Guide
(formerly Grub 2 Basics)


Note: Most of this information has been incorporated, with a few graphics, into a page in the Ubuntu Help site. I will try to keep this post up-to-date and users are free to continue to post comments here. The help page is located here: https://help.ubuntu.com/community/Grub2

  1. Introduction
  2. First Look Differences
  3. Improvements
  4. Grub 2 Files & Options
  5. Booting Grub
  6. Adding Entries to Grub 2
  7. Removing Entries from Grub 2
  8. Grub 2 Splash Images
  9. Changing Menu Resolution
  10. Booting to LiveCD ISO
  11. Booting to Recovery Mode w/o Menu Option
  12. Uninstalling GRUB 2 > GRUB
  13. Reinstalling GRUB 2 from the LiveCD
  14. Booting from a LiveCD ISO
  15. Booting from the Rescue Mode
  16. Selected Problems
  17. Links
  1. Introduction
    I've written this guide to present some basic information about Grub 2. It is meant for users who may be familiar with basic editing of the original Grub (Grub Legacy) menu.lst and wonder how it carries over to Grub 2 (ver 1.97). I will not cover how to install or uninstall Grub 2 or whether you should convert to Grub 2.

    Grub 2 will be the default in Ubuntu 9.10, Karmic Koala but the plan is not to convert over previous Grub legacy installations to Grub 2.
    Official Announcement / Story

    StartUp-Manager supports Grub 2, but not all options are available. The two most-used items, however, are: setting the default kernel/OS and setting the menu timeout delay. There are plans for a StartUp-Manager 2 that works only for Grub 2 but it is still under development according to its creator. To view a guide on installing and running StartUpManager, view the StartUpManager community doc or the forum post on which it was based: http://ubuntuforums.org/showthread.php?t=818177

    Also note that Grub 2 is still in development. Official documentation at this point is limited and still being created. That is partly the reason for this post. More comprehensive and complete documentation will hopefully be forthcoming from the developers and volunteers. Of the existing documentation, I have have provided several links to the better sources at the end of this post.

    First, before proceeding, confirm the version of Grub you are using. Running this command should provide the version:
    Code:
    grub-install -v
    Which should produce something like this:
    Quote:
    drs305@mycomputer:~$ grub-install -v
    grub-install (GNU GRUB 1.97~beta2)
  2. First Look Differences: GRUB vs GRUB 2
    At first boot, there will not be much difference in what the user sees on the boot menu. The one exception is a clean install of Ubuntu 9.10 with no other installed operating system. In this case, GRUB 2 will boot directly to the login prompt or Desktop without displaying a menu. Other major differences:
    • No ''/boot/grub/menu.lst''. It has been replaced by ''/boot/grub/grub.cfg''.
    • There is no "find /boot/grub/stage1" at the grub prompt. Stage 1.5 has also been eliminated.
    • The main menu file, ''/boot/grub/grub.cfg'' is not meant to be edited, even by 'root'.
    • ''grub.cfg'' is overwritten anytime there is a update, a kernel is added/removed or the user runs `update-grub` *
    • The user can use a custom file, ''/etc/grub.d/40_custom'', in which the user can place his own entries. This file will ''not'' be overwritten.
    • The primary configuration file for changing menu display settings is ''/etc/default/grub''.
    • There are multiple files for configuring the the menu - ''/etc/default/grub'' mentioned above, and all the files in ''/etc/grub.d/'' folder.
    • Other operating systems, such as Windows, should automatically be recognized and added to the menu.
    • No changes made in the configuration files will take effect until the `update-grub` command is also run.


    * To update the GRUB 2 menu, the command sudo update-grub will be used throughout this guide. update-grub actually runs the command "grub-mkconfig -o /boot/grub/grub.cfg" This runs several scripts and incorporates the results into /boot/grub/grub.cfg which detemines what is seen on the screen during boot. Since the GRUB 2 developers do not intend to remove the update-grub 'stub', it will be used for simplicity and ease of use.
  3. Improvements
    GRUB 2's major improvements over the original GRUB include:
    • New configuration file structure
    • Scripting support including conditional statements and functions
    • Dynamic module loading
    • Rescue mode
    • Themes
    • Graphical boot menu support and improved splash capability
    • Easily boot LiveCD ISO images directly from hard drive
    • Non-X86 platform support (such as PowerPC)
    • Universal support for UUIDs (not just Ubuntu)
    • Improved internationalization, including support for non-ASCII characters
    • Note: openSUSE & Fedora have not yet adopted GRUB 2

  4. Booting Grub
    Grub 2 loads before the operating system. It's modular components are loaded on an as-needed basis. Menu display behavior is generally determined by settings in /etc/default/grub. Review the "Grub 2 Files & Options" section for specific entry and formatting guidance.

    The main options for displaying the menu are:
    • Initial Default
      • Grub 2 will boot straight into the default operating system if no other operating system is detected. No menu will be displayed. If another operating system is detected, the Grub 2 menu will display.
    • Timed display.
      • The default delay is 10 seconds. If no user input is made Grub 2 boots to the default entry.
      • The countdown can be stopped by pressing any key. The user must then make a selection manually.
      • The booted entry is determined by the DEFAULT= setting in /etc/default/grub, The first "menuentry" is 0.
    • Hidden
      • The user can interrupt the boot process and display the menu by holding down the SHIFT key until the menu displays. Grub 2 searches for a depressed SHIFT key signal during boot. If the key is pressed or Grub 2 cannot determine the status of the key, the menu is displayed.
      • The time the screen remains blank but available for display is determined by a setting in /etc/default/grub.
      • To provide visual feedback during while the countdown continues, a countdown display can be shown on the screen.
      • At the end of the timeout, the default entry determined in /etc/default/grub will be selected.
    • Saved
      • If the default option is set to "saved", the last kernel/system successfully booted will be selected and run if no input is made.

  5. Grub 2 Files & Options
    Many of the files in /boot/grub will not be recognizable by users of Grub Legacy. Especially noticeable are the multitude of *.mod files. Grub 2 is modular and these files are loaded as necessary by the grub bootloader.

    The Grub 2 user-configurable settings are contained mainly in /etc/default/grub and the files in /etc/grub.d. When update-grub is executed the results are input into the /boot/grub/grub.cfg file.
    • /boot/grub/grub.cfg
      • This is the main Grub 2 file. It "replaces" Grub Legacy's /boot/grub/menu.lst This file contains the Grub menu information but unlike Grub Legacy's menu.lst file, grub.cfg is not meant to be edited.
        • grub.cfg is automatcially generated when "update-grub" is executed:
        • Each section (### BEGIN) is clearly delineated and references the file in the /etc/grub.d folder from which the information was generated.
        • grub.cfg is updated by running the "update-grub2" or "update-grub" command as root.
        • By default, and whenever the "update-grub2" command is executed, this file is made "read-only". This is in keeping with the intent that the file should not be edited manually. If you must edit this file, instructions are provided in Section 2.
      • Sample grub.cfg including Windows and one manual entry (41_srcd):
        Code:
        #
        # DO NOT EDIT THIS FILE
        #
        # It is automatically generated by /usr/sbin/grub-mkconfig using templates
        # from /etc/grub.d and settings from /etc/default/grub
        #

        ### BEGIN /etc/grub.d/00_header ###
        load_env
        set default="0"
        if [ ${prev_saved_entry} ]; then
        saved_entry=${prev_saved_entry}
        save_env saved_entry
        prev_saved_entry=
        save_env prev_saved_entry
        fi
        insmod ext2
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396925
        if loadfont /usr/share/grub/unicode.pf2 ; then
        set gfxmode=640x480
        insmod gfxterm
        insmod vbe
        if terminal_output gfxterm ; then true ; else
        # For backward compatibility with versions of terminal.mod that don't
        # understand terminal_output
        terminal gfxterm
        fi
        fi
        if [ ${recordfail} = 1 ]; then
        set timeout=-1
        else
        set timeout=10
        fi
        ### END /etc/grub.d/00_header ###

        ### BEGIN /etc/grub.d/10_linux ###
        menuentry "Ubuntu, Linux 2.6.31-12-generic" {
        recordfail=1
        save_env recordfail
        set quiet=1
        insmod ext2
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396933
        linux /boot/vmlinuz-2.6.31-12-generic root=UUID=7ebcfe33-6914-42ec-9d2e-0859f7396933 ro quiet splash
        initrd /boot/initrd.img-2.6.31-12-generic
        }
        menuentry "Ubuntu, Linux 2.6.31-12-generic (recovery mode)" {
        recordfail=1
        save_env recordfail
        insmod ext2
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396933
        linux /boot/vmlinuz-2.6.31-12-generic root=UUID=7ebcfe33-6914-42ec-9d2e-0859f7396933 ro single
        initrd /boot/initrd.img-2.6.31-12-generic
        }
        menuentry "Ubuntu, Linux 2.6.31-11-generic" {
        recordfail=1
        save_env recordfail
        set quiet=1
        insmod ext2
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396933
        linux /boot/vmlinuz-2.6.31-11-generic root=UUID=7ebcfe33-6914-42ec-9d2e-0859f7396933 ro quiet splash
        initrd /boot/initrd.img-2.6.31-11-generic
        }
        menuentry "Ubuntu, Linux 2.6.31-11-generic (recovery mode)" {
        recordfail=1
        save_env recordfail
        insmod ext2
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set 7ebcfe33-6914-42ec-9d2e-0859f7396933
        linux /boot/vmlinuz-2.6.31-11-generic root=UUID=7ebcfe33-6914-42ec-9d2e-0859f7396933 ro single
        initrd /boot/initrd.img-2.6.31-11-generic
        }
        ### END /etc/grub.d/10_linux ###

        ### END /etc/grub.d/20_memtest86+ ###

        ### BEGIN /etc/grub.d/30_os-prober ###
        menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
        set root=(hd0,1)
        chainloader +1
        }
        ### END /etc/grub.d/30_os-prober ###

        ### BEGIN /etc/grub.d/40_custom ###
        menuentry "Jaunty 2.6.28-15-custom" {
        saved_entry=${chosen}
        save_env saved_entry
        set root=(hd0,8)
        linux /boot/vmlinuz-2.6.28-15-custom root=UUID=48e03255-22b3-488b-ae7e-9dbe4e2beac7 ro quiet splash
        initrd /boot/initrd.img-2.6.28-15-custom
        }
        menuentry "SystemRescue" {
        saved_entry=${chosen}
        save_env saved_entry
        set root=(hd0,6)
        linux /sysrcd/rescuecd subdir=sysrcd setkmap=us
        initrd /sysrcd/initram.igz
        }
        ### END /etc/grub.d/40_custom ###
    • /etc/default/grub
      • This file contains information formerly contained in the upper section of Grub Legacy's menu.lst and items contained on the end of the kernel line. The items in this file can be edited by a user with administrator (root) privileges.
        Quote:
        # If you change this file, run 'update-grub' afterwards to update
        # /boot/grub/grub.cfg.

        GRUB_DEFAULT=0
        #GRUB_HIDDEN_TIMEOUT=0
        GRUB_HIDDEN_TIMEOUT_QUIET=true
        GRUB_TIMEOUT="3"
        GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
        GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
        GRUB_CMDLINE_LINUX=""

        # Uncomment to disable graphical terminal (grub-pc only)
        #GRUB_TERMINAL=console

        # The resolution used on graphical terminal
        # note that you can use only modes which your graphic card supports via VBE
        # you can see them in real GRUB with the command `vbeinfo'
        #GRUB_GFXMODE=640x480

        # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
        #GRUB_DISABLE_LINUX_UUID=true

        # Uncomment to disable generation of recovery mode menu entrys
      • A few bugs still exist in the hidden menu feature. Hiding the menu, even with the correct "TIMEOUT" settings in /etc/default/grub may not work as described.
      • GRUB_DEFAULT - Sets the default menu entry. Entries may be numeric or "saved"
        • GRUB_DEFAULT=0 - Sets the default menu entry by menu position. As Grub Legacy, the first "menuentry" in grub.cfg is 0, the second is 1, etc.
        • GRUB_DEFAULT=saved - Sets the default menu entry with whatever was selected last. If the menu is displayed during boot, the last entry selected will be highlighted. If no action is taken, this selection will be booted at the end of the timeout or if the menu is hidden.
          • grub-set-default is enabled when this value is set to saved. You can quickly change the default OS/kernel with this command.
            • The format is "sudo grub-set-default X, with X being the menuentry position (starting with 0 as the first entry) or the exact menu string. Examples: sudo grub-set-default 3 or sudo grub-set-default "Ubuntu, Linux 2.6.31-14-generic"
            • To obtain the existing menuentry choice number (starting from 0) or the menuentry "string", run "grep menuentry /boot/grub/grub.cfg"
        • GRUB_DEFAULT="xxxx" - An exact menu entry, including the quotation symbols, may also be used. In this case, location in the menu will not matter. Example: GRUB_DEFAULT="Ubuntu, Linux 2.6.31-9-generic"
        • For an example of how to enable the "saved" option with a custom menu, see the "Custom User Entries" section.
      • GRUB_TIMEOUT=5 - No change from Grub Legacy. This is the number of seconds before the default entry is automatically booted.
        • Setting this value to -1 will cause the menu to display until the user makes a selection.
        • To display the menu on each boot use a value of 1 or higher.
        • This command defers to the GRUB_HIDDEN_TIMEOUT command. If the hidden display is interrupted by a key press, the GRUB_TIMEOUT counter begins its countdown.
        • In addition to editing the file as root, you can also run the following commands the check and change the default timeout value. The first checks the existing timeout, the second replaces the value. Replace T with the new value.
          Code:
          cat /etc/default/grub | grep 'GRUB_TIMEOUT='   # Checks current TIMEOUT value.
          sudo sed 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=T/g' -i /etc/default/grub # Change TIMEOUT value. Replace T with new value.
      • GRUB_HIDDEN_TIMEOUT=0
        • The menu will be hidden unless a # symbol is present at the beginning of this line. ( # GRUB_HIDDEN_TIMEOUT=0 )
        • The default setting initially depends on the presence of other operating systems.
          • Another OS Detected: The menu will be displayed. ( The line will begin with a # symbol. )
          • No other OS Detected: The menu will be hidden.
        • For integers greater than 0, the system will pause, but not display the menu, for the entered number of seconds.
        • 0 The menu will not be displayed. There will be no delay. When this entry is set to 0:
          • The user may force displaying the menu as the computer boots by holding down the SHIFT key.
          • During boot, the system will check the SHIFT key status. If it cannot determine the key status, a short delay will enable the user to display the menu by pressing the ESC key.
        • If enabled, the splash screen designated in 05_debian_theme will be displayed. This setting hides the menu only.
      • GRUB_HIDDEN_TIMEOUT_QUIET=true
        • true - No countdown is displayed. The screen will be blank.
        • false - A counter will display on a blank screen for the duration of the GRUB_HIDDEN_TIMEOUT value.
      • GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
        • Determines the descriptive name in the menu entry. (Ubuntu, Xubuntu, Debian, etc.)
      • GRUB_CMDLINE_LINUX
        If it exists, this line imports any entries to the end of the 'linux' command line (Grub Legacy's "kernel" line) for both normal and recovery modes. This is similar to the "altoptions" line in menu.lst
      • GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
        This line imports any entries to the end of the 'linux' line (Grub Legacy's "kernel" line). The entries are appended to the end of the normal mode only. This is similar to the "defoptions" line in menu.lst. For a black screen with boot processes displayed in text, remove "quiet splash". To see the grub splash image plus a condensed text output, use "splash". This line is where other instructions, such as "acpi=off" are placed.
      • #GRUB_TERMINAL=console
        Uncomment to disable graphical terminal (grub-pc only)
      • #GRUB_DISABLE_LINUX_UUID=true
        Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
      • #GRUB_GFXMODE=640x480
        You can add this line and remove the # symbol to make it active. This entry sets the resolution of the graphical menu (the menu text size). It provides resolutions supported by the user's graphics card (e.g. 640x480, 800x600, 1280x1024, etc). The setting applies only to the boot menu text.
      • From the GRUB 2 menu you can display available resolutions by typing "c" and then at the "grub>" prompt type "vbeinfo"
      • GRUB_DISABLE_LINUX_RECOVERY=true
        Add or uncomment this line to prevent "Recovery" mode kernel options from appearing in the menu. If you want a "Recovery" option for only one kernel, make a special entry in /etc/grub/40_custom.
      • GRUB_DISABLE_OS_PROBER="true" - Enables/disables the os-prober check of other partitions for operating systems, including Windows, Linux, OSX and Hurd.
    • /etc/grub.d/
      • The files in this folder are read during execution of "update-grub" or "update-grub2" commands. The contents are imported into /boot/grub/grub.cfg

        The order of the entries in the grub menu is based on the order of the file names. File named with a starting numeral are run before those beginning with a letter. The order the files are run determines the menu order in grub.cfg.
        Custom entries can be added to the "40_custom" file or in a newly created file.

        Any file created must be executable in order to be included in the grub.cfg file during the "update-grub2" command.
        • 00_header
        • 05_debian_theme: Set background and text colors, themes
        • 10_hurd Locates Hurd kernels
        • 10_linux Locates Linux kernels based on results of the "lsb_release" command.
        • 20_memtest86+: If the file /boot/memtest86+.bin exists, it is included as a menu item.
        • 30_os-prober: Searches for Linux and OS's on other partitions and includes them in the menu.
        • 40_custom: A template for adding custom menu entries which will be inserted into grub.cfg upon execution of the "update-grub2" command. This and any other custom file must be made executable to allow importation into grub.cfg.

  6. Adding Entries to Grub 2
    Menu entries can be added to grub.cfg automatically or manually.
    • Automatically.
      • When "update-grub" or "update-grub2" is executed, Grub 2 will search for linux kernels and other Operating Systems. What and where is looks is based on the files contained in /etc/grub.d folder.
        • 10_linux searches for installed linux kernels on the same partition.
        • 30_os-prober searches for other operating systems.
    • Custom User Entries (/etc/grub.d/40_custom).
      • Entries to grub.cfg can be manually inserted by creating a file in the /etc/grub.d folder.
        • The name of the file determines the order in the menu. 30_os-prober entries will be placed before 40_custom entries, which will be placed before 50_my-sample entries.
        • Any created file must be made executable. This can be done as root by running "sudo chmod +x /etc/grub.d/filename".
        • The files in the /etc/grub.d folder will be read and the contents included in grub.cfg when the "update-grub2" command is executed as root.
      • A sample entry. This file creates a menu item for running the SystemRescueCD (previously installed) from a partition created on sda10. Folders and files must have been copied to the correct location in accordance with the SystemRescueCD if you wish to actually use this entry.
        • Quote:
          #!/bin/sh
          exec tail -n +3 $0
          # This file provides an easy way to add custom menu entries. Simply type the
          # menu entries you want to add after this comment. Be careful not to change
          # the 'exec tail' line above.

          echo "Adding SystemRescueCD" >&2
          menuentry "System Rescue CD" {
          set root=(hd0,10)
          linux /sysrcd/rescuecd subdir=sysrcd setkmap=us
          initrd /sysrcd/initram.igz
          }
        • Note the new partition naming convention. Devices start counting from "0" as done previously. sda is designated as "hd0", sdb is "hd1", etc. However the first partition is now designated as sda1. Counting partitions does not start with "0". sda5 is "5".
        • The line 'echo "Adding SystemRescueCD" >&2' is not required. Including it in the file allows this line to be seen in the terminal when "update-grub2" is executed. It provides visual feedback that the entry has been found and entered. The entry, if in the correct format, will be inserted in grug.cfg whether or not this line is included in the file.
      • Tip: If you want to have your custom entries at the top of the menu (say you want custom titles), create a new file and name it "07_xxxx". Since the files in /etc/grub.d/ are read sequentially, those in "07_custom" will be placed before those of "10_linux". I recommend not naming a custom menu file lower than 06 so that any theme run from 05_debian_theme is allowed to run before any custom menu is created. After creating the file, run sudo update-grub and then check the value of "DEFAULT" in /etc/default/grub. If it doesn't point to the correct menuentry, change the value of DEFAULT to the correct menuentry value.
      • Omitting memtest86+: To prevent "memtest86+" entries in your Grub 2 menu, remove the "executable" bit from /etc/grub.d/20_memtest86+. You can do this via a file browser by selecting "Properties (right click), Permissions", or via the command line:
        Code:
        sudo chmod -x /etc/grub.d/20_memtest86+
      • Omitting Recovery Mode entries: The file /etc/grub.d/10_linux was recently updated to include a check for recovery mode options. Edit /etc/default/grub and add or change this line:
        Quote:
        GRUB_DISABLE_LINUX_RECOVERY=true
        If you have an older version of /etc/grub.d/10_linux and the above does not work after updating grub, you can prevent "Recovery mode" entries in your Grub 2 menu, by editing /etc/grub.d/10_linux. If there are no conditional "if" statements concerning the recovery mode, place a comment symbol (#) in front of the following lines (at approximately line 146) of the old file:
        Quote:
        # linux_entry "${OS}, Linux ${version} (recovery mode)" \
        # "single ${GRUB_CMDLINE_LINUX}"
        If you wish to retain one "Recovery mode" entry for insurance, you can add an entry to /etc/grub.d/40_custom which will appear at the bottom of your grub menu.
      • Building a Totally Customized Menu: Ok, admit you are a control freak and you want to see only what you build yourself - customized titles, no "memtest86+" and no extra kernels. Here is how you do it:
        • Run sudo update-grub to get the current available kernels.
        • Copy the desired "menuentry" listings from /boot/grub/grub.cfg to /etc/grub.d/40_custom The entry begins with the line starting with "menuentry" and ends with a line containing "}".
        • Add any other "menuentry" items you wish to see on the boot menu.
        • Edit the titles of the "menuentry" line if desired (between the quotation symbols). Do not change the lines following the "menuentry" line. Each entry should start with a "menuentry" line and end with a "}" on the last line.
        • Remove the executable bit from /etc/grub.d/10_linux, /etc/grub.d/20_memtest86+ and /etc/grub.d/30_os-prober
          Removing the executable bit from any file in /etc/grub.d will exclude the file from being included in grub updates.
          Code:
          sudo chmod -x /etc/grub.d/10_linux /etc/grub.d/20_memtest86+ /etc/grub.d/30_os-prober
        • Run "sudo update-grub"
        • The updated /boot/grub/grub.cfg file should now contain only sections for "00_header", "05_debian_theme" and "40_custom".
        • The grub.cfg file will not be updated with the addition of a new kernel. To add a new kernel, make "10_linux" executable, run "sudo update-grub" to refresh the available kernels, and repeat these instructions.
      • Incorporating the DEFAULT=save Option: In order to enable the "saved default" option with which Grub 2 preselects the last successfully-used option at boot, the "DEFAULT=save" option must be entered in /etc/default/grub and the 40_custom file must be modified. An example of a 40_custom file follows:
        • Quote:
          #! /bin/sh -e

          prefix=/usr
          exec_prefix=${prefix}
          libdir=${exec_prefix}/lib
          . ${libdir}/grub/grub-mkconfig_lib
          echo "Adding SystemRescueCD & Custom Kernel" >&2

          menuentry "Jaunty 2.6.28-15-custom" {
          save_default_entry | sed -e "s/^/\t/"
          set root=(hd0,7)
          linux /boot/vmlinuz-2.6.28-15-custom root=UUID=12c55255-27b3-488b-hje7e-9dbe4e2esfg5 ro quiet splash
          initrd /boot/initrd.img-2.6.28-15-custom
          }



          menuentry "SystemRescue" {
          save_default_entry | sed -e "s/^/\t/"
          set root=(hd0,6)
          linux /sysrcd/rescuecd subdir=sysrcd setkmap=us
          initrd /sysrcd/initram.igz
          }
        • Manual Windows Entry (with /etc/grub.d/30_os-prober made unexecutable)
          Quote:
          #! /bin/sh -e

          echo "Adding Windows 43_custom" >&2
          menuentry "Windows Vista 43_custom" {
          insmod ntfs
          set root=(hd0,1)
          search --no-floppy --fs-uuid --set CFFCFF9EECFF7F49
          chainloader +1
          }
      • Don't forget to run "sudo update-grub" after making any changes to your /etc/grub.d files.
    • Manual Editing of grub.cfg (Not encouraged)
      Manual editing of /boot/grub/grub.cfg is not encouraged. Think of grub.cfg as a result, not as an initiator. The files that should be edited are contained in the /etc/grub.d folders and the /etc/default/grub file.

      In order to discourage its editing, grub.cfg is read-only. Even attempting to open, edit and save this file using root privileges cannot be done until the 'read-only' status is changed. If you must edit this file:
      Code:
      sudo chmod +w /boot/grub/grub.cfg
      gksudo gedit /boot/grub/grub.cfg
      Note: This file is returned to 'read-only' status anytime the update-grub command is run.

  7. Removing Entries from Grub 2
    Entries should be removed by editing or removing files in the /etc/grub.d folder. The /boot/grub/grub.cfg file is read-only and should not normally require editing.
    • Automatically.
      • Too Many Kernels? Kernels removed via Synaptic or with "apt-get remove" will automatically update grub.cfg and no user action is required.
        • In Synaptic, type the kernel number in the search window at the upper right (for example - 2.6.28-11).
        • Find the "linux-image" and "linux-headers" files for the applicable kernel (example - linux-image-2.6.26-11 or "linux-image-2.6.26-11-generic).
        • Right click and select "Mark for Complete Removal" and then press the Apply main menu button.
        • The kernels will be removed from your system and from the Grub menu.
        • If you are not sure of the kernel you are currently using, in a terminal type "uname -r".
        • Many users keep one previous kernel on the machine which previously ran without problems.
      • Other Operating Systems which have been removed from the computer will also be removed from the menu once "update-grub2" is run as root.
      • To prevent one of the /etc/init.d files from running, remove the "executable" bit.
        • Example: If you don't want to see the "Memtest86+" entries, run this command:
          Code:
          sudo chmod -x /etc/grub.d/20_memtest86+
        • Run the update-grub command to allow the changes to be incorporated in grub.cfg


      User-Created Entries.
      • To remove a user-created menu entry, remove the applicable file from the /etc/grub.d folder.
      • If a custom file contains multiple entries, individual items may be removed and others retained.
      • Once the file has been removed or edited, run "update-grub2" to update grub.cfg.

  8. Grub 2 Splash Images
    Why reinvent the wheel? Visit this site for an excellent presentation on creating Grub 2 images:
    http://members.iinet.net/~herman546/p20/GRUB2%20Splashimages.html

    However, if encrypted disks are not an issue, here are the basics:
    • Manually copy grub splash images into the /usr/share/images/grub folder or install the default grub2 splash images via Synaptic or:
      Code:
      sudo apt-get install grub2-splashimages
    • The grub2's splash images are controlled by /etc/grub.d/05_debian_theme. Open this file for editing:
      Code:
      gksudo gedit /etc/grub.d/05_debian_theme
      Find the following line and edit the highlighted area, replacing it with the grub splash image you wish to use (and located in /usr/share/images/grub):
      Quote:
      for i in {/boot/grub,/usr/share/images/grub}/moreblue-orbit-grub.{png,tga} ; do
      Note: There is a period ( . ) following the filename.
      • At one point Grub 2 splash images were downloaded and stored in /usr/share/images/desktop.base If this is where your grub images are stored, change the address in the previous command accordingly ( ... /usr/share/images/desktop-base} ... ).
    • Save the file, then update grub2:
      Code:
      sudo update-grub2

  9. Changing Menu Resolutions
    If the user wishes to change the resolution of the GRUB 2 screen while using a splash image follow these steps:
    1. Set the desired resolution in /etc/default/grub
      • Change the value of GRUB_GFXMODE= (Example: GRUB_GFXMODE=800x600)
        • If unsure of what resolutions are available to GRUB 2 they can be displayed by typing vbeinfo in the GRUB 2 command line. The command line is accessed by typing "c" when the main GRUB 2 menu screen is displayed.
    2. Select an image of the same size and make the change in /etc/grub.d/05_debian_theme
      • The image name is located in the line beginning with " for i in {/boot"
      • If an image of the correct size is not used, the menu will not be positioned correctly.
      • Use the image editor of your choice to create/resize an image to the correct size.
      • The user may be able to view the image size via Properties in a file browser (check the Properties Image tab in Nautilus).
    3. Run update-grub as root to add the new settings to /boot/grub/grub.cfg

  10. How to Boot to the Recovery Mode w/o a Menu Option
    1. If you have Grub 2 set to boot without displaying the menu at all, hold the SHIFT key down until the menu displays. (In Grub it was the ESC key.)
    2. Press any key once the menu is displayed to 'freeze' it. Then arrow to the kernel you want to boot.
    3. Press E
    4. Scroll to the end of the "linux /boot/vmlinuz...." line. If displayed, remove "quiet" and/or "splash". Add the word "single" to the end of the line.
    5. Press CTRL-X to boot to the Recovery menu.

  11. Uninstalling GRUB 2
    The command line produces a cleaner uninstall and reinstallation. While adding and removing the packages can be accomplished with Synaptic, certain steps must be accomplished in a terminal.
    • Open a terminal: Applications, Accessories, Terminal.
    • Make backup copies of the main GRUB 2 folders & files
      • Code:
        sudo cp /etc/default/grub /etc/default/grub.old
        sudo cp -R /etc/grub.d /etc/grub.d.old
        sudo cp -R /boot/grub /boot/grub.old
    • Remove GRUB 2
      • Code:
        sudo apt-get purge grub2 grub-pc
      • The user will be warned the system will be unbootable without installing another bootloader.
      • Once the packages are removed, many files will still remain in '/boot/grub'
    • Install GRUB 0.97
      • Code:
        sudo apt-get install grub
      • With ''grub'' installed, the user must still create the ''menu.lst'' and ''stage1/stage2'' files.
      • Code:
        sudo update-grub
        • Generates ''menu.lst'' Tab to "Yes" when prompted.
      • Code:
        sudo grub-install /dev/sdX
        • Choose the correct device (sda, sdb, etc), normally the one on which Ubuntu is installed.
        • Creates the ''stage1'' & ''stage2'' files in ''/boot/grub'' and writes to the MBR.
    • Reboot

  12. Reinstalling GRUB 2 from LiveCD
    If you cannot boot from GRUB 2 and need to reinstall it:
    • Boot to the 9.10 Karmic LiveCD Desktop.
    • Open a terminal - Applications, Accessories, Terminal.
    • Determine your normal system partition - `sudo fdisk -l` (That is a lowercase L)
    • If you aren't sure, run `df -Th`. Look for the correct disk size and ext3 or ext4 format.
    • Mount your normal system partition:
      Code:
      sudo mount /dev/sdXX /mnt
      • Note: substitue the correct partition: sda1, sdb5, etc.
      • Note: GRUB 2 counts the first drive as "0", but the first partition as "1"
    • Only if you have a separate boot partition:
      • Code:
        sudo mount /dev/sdYY /mnt/boot
        with sdYY being your /boot partition designation.
    • Mount devices:
      Code:
      sudo mount --bind /dev/ /mnt/dev
    • Chroot into your normal system device:
      Code:
      sudo chroot /mnt
    • Reinstall GRUB 2:
      Code:
      sudo grub-install /dev/sdX
      • Note: Substitute the correct device - sda, sdb, etc. Do ''not'' specify a partition number.
    • Verify the install:
      Code:
      sudo grub-install --recheck /dev/sdX
      • Note: Substitute the correct device - sda, sdb, etc. Do ''not'' specify a partition number.
    • Exit chroot: CTRL-D
    • Unmount devices:
      Code:
      sudo umount /mnt/dev
    • If you mounted a separate /boot partition:
      Code:
      sudo umount /mnt/boot
    • Unmount last device:
      Code:
      sudo umount /mnt
    • Reboot.

  13. Booting from a LiveCD ISO
    This section is under construction. Although I have been able to successfully mount the 64-bit Karmic desktop ISO the results among the other releases is not consistent enough to post.

  14. Booting from the Rescue Mode
    At the grub rescue> prompt, accomplish the following actions to attempt to boot to the latest kernel:
    • ls This will display the known devices and partitions. From this information, the user must determine the device and partition on which the system is installed.
    • set root=/dev/sdXY X is the device/drive, starting with 0. Y is the partition, starting with 1. (Example: (hd0,1) is sda1. (hd3,5) is sdc5.
    • ls /boot Inspect the contents. The user should see varioius kernels, initrd images and the grub folder. If not, use the ls command to inspect the device and attempt to find these files and folders. If necessary, set another device as root.
    • insmod /boot/grub/_linux.mod Load the linux module. Without this module loaded, the user will receive an "Unknown command linux" message when trying to load the kernel.
    • linux /vmlinuz root=/dev/sdXY ro Load the linux kernel, substituting the correct designations for "X" and "Y" (example: sda1). The user will see a message showing the kernel has been loaded. (See graphic above)
    • initrd /initrd.img Load the initrd image. When pressing enter, the user may or may not see a message in the terminal. (See highlighted graphic above)
    • boot

  15. Selected Problems
    If you find you need to remove the following lines manually to get Grub to boot properly:
    Quote:
    recordfail=1
    save_env recordfail
    Open /etc/grub.d/10_linux with admin rights:
    Code:
    gksu gedit /etc/grub.d/10_linux
    Look for this section and comment the lines in bold;
    Quote:
    linux_entry ()
    {
    menuentry "$1" {
    recordfail=1
    save_env recordfail
    Change it to:
    Quote:
    - linux_entry ()
    {
    menuentry "$1" {
    # recordfail=1
    # save_env recordfail
    Save the file, then run
    Code:
    sudo update-grub
    The two lines should no longer appear when you press E to view the selection in the Grub 2 menu. You will see a "save_env save_entry" line but this should not cause the failure if you successfully booted the previous time.

  16. Links
    Grub2 (help.ubuntu.com)
    Grub 2 Title Tweaks
    Grub 2 Introduction
    Grub 2: A Guide for Users (from Kubuntu
    Forums)

    https://wiki.ubuntu.com/KernelTeam/Grub2Testing
    GNU Grub 2 Manual Links
    GNU Grub 2 Manual (in development)
    Grub 2 Wiki
    Herman's Grub 2 Site Comprehensive.

Grub 2 introduction

On this site I read this post:

GRUB 2 Introduction

DON'T PANIC

There is a lot of great information on grub2 on this forum.

I wrote this up to give folks a flying start. This will not make you an expert but it will, hopefully, get you headed in the right direction.

A lot of people have trouble, right after installation, with other OS' being missing from the menu. The first thing to do for this is go to your terminal and;
Code:
sudo update-grub
This is all it takes a majority of the time.
EDIT (10-28-09)
There is another way to update grub;
Code:
sudo grub-mkconfig
This is supposed to be the default and will, I believe, soon replace update-grub altogether.
END EDIT

Grub2 is completely different from grub-legacy. If you are using grub2 be prepared to learn something new.


The menu that you see on the screen when you boot up comes from the /boot/grub/grub.cfg file.


The /boot/grub/grub.cfg file is generated everytime “update-grub” is run. This is run everytime you get a kernal update and many times when you get a grub update. It does not make sence to edit this file.


Grub.cfg is generated by scripts in /etc/grub.d.


00_header gets the ball rolling and gets your timeout and hidden menu information for the menu.


05_debian-theme sets up how your menu looks on the screen.


10_linux is the one that gives you the menu entry for the OS that you are on.


20_memtest86+ is what sets the memtest on your menu.


30_os-prober is what is responcible for finding the rest of your OS'.


40_custom is designed so that you can make custom entries.


Grub2 gets its time out information and sets up a hidden menu for you in /etc/default/grub.


If you need to edit a menu entry that does not work do not mess with grub.cfg. It is silly to do so. It will be over written.


Go to /etc/grub.d and add to the 40_custom file. For instance;
30_os-prober does not generate a functional menu entry for my Mandriva installs. So I have a custom entry that works every time and comes right up on the menu every time. It is not over written because it is regenerated every time that “update-grub” is run.
Code:
 menuentry "linux-nonfb (on /dev/sda12)" {
insmod ext2
set root=(hd0,12)
search --no-floppy --fs-uuid --set c23ad2ca-67a5-4a42-8fcc-3baa6d8e454e
linux /boot/vmlinuz BOOT_IMAGE=linux-nonfb root=UUID=c23ad2ca-67a5-4a42-8fcc-3baa6d8e454e resume=UUID=59fe476e-6d4f-e390-ced9-f29328538dfc
initrd (hd0,11)/boot/initrd.img
}
As you can see the partition is defined as being in two different places in this entry. It will not boot. The entry below will boot very well indeed.



Code:
        menuentry "Mandriva-Gnome" {
linux (hd0,12)/boot/vmlinuz
initrd (hd0,12)/boot/initrd.img
}
This also works very well for your non-grub2 Ubuntu OS'.


I use a slightly different entry for grub2 Ubuntu installs;
Code:
 menuentry "Kinky-Grub2-A2 on sda10 2.6.31-11-generic" {
set root=(hd0,10)
linux /vmlinuz root=/dev/sda10 so quiet splash
initrd /initrd.img
}
This entry works even if you change the OS on the partition.


Your custom entries must be in the proper form. The first thing to do is start your favorite text editor (I use gedit). Go to preferences and set it so that there is NO test wrapping.


Then, in your 40_custom file put in an entry such as;
Code:
 echo "Adding Kinky-Grub2-A2 on sda10 (2.6.31-11-generic)" >&2
cat << EOF
menuentry "Kinky-Grub2-A2 on sda10 2.6.31-11-generic" {
set root=(hd0,10)
linux /vmlinuz root=/dev/sda10 so quiet splash
initrd /initrd.img
}
EOF
That is the entire entry for that OS. It is the one that I use for experimenting on grub2. The part that does the work is between the { }s. Make sure that they are where they belong.


If you save this file as 06_custom it will appear at the top of menu you see on the screen. If you save it as 40_custom it will appear at the bottom of menu you see on the screen.


Now, what is the advantage of this rigamarole compared to grub-leagacy.


Well, if you have three OS' on your drive and you set up a custom menu you do not need any other menu entries at all. So you change the permissions on 10_linux, 20_memtest86+, 30_custom so that they are not executable. They will not run when “update-grub” is run and so the onoy thing on your menu is your custom entries. There is nothing that can mess with these entries except you.


You must remember to run;
Code:
 sudo update-grub
Everytime you do anything that is to change your menu. This will overwrite your /boot/grub/grub.cfg file and thus the menu that shows up on your screen.


Here are some links, some more useful than others, that I have collected.

Some grub2 links;


http://members.iinet.net/~herman546/p20.html

http://ubuntuforums.org/showthread.php?t=1195275

http://grub.enbug.org/

http://grub.enbug.org/Manual

http://grub.enbug.org/CommandList

https://wiki.ubuntu.com/Grub2#Adding...0to%20Grub%202

https://wiki.ubuntu.com/Grub2#Recove...20via%20LiveCD

http://members.iinet.net/~herman546/p20/GRUB2%20CLI%20Mode%20Commands.html#cli_loopback

http://members.iinet.net/~herman546/p20/GRUB2%20Splashimages.html

http://ubuntuforums.org/showthread.php?t=1287602

http://ubuntuforums.org/showthread.php?t=1287967

In case grub2 is just too much, you may want to take a look at this;

http://ubuntuforums.org/showthread.php?t=1247994

Some other links that are just interesting and may help or inspire some one;

http://ubuntuforums.org/showpost.php...9&postcount=16

http://ubuntuforums.org/showthread.p...98#post8100252

http://ubuntuforums.org/showthread.php?t=1288604

Monday, November 2, 2009

GRUB2 title tweaks

This site: Grub 2 Title Tweaks Thread is interesting. I quoted it here:

Grub 2 Title Tweaks

or the


I Don't Want It to Say "Microsoft Windows Vista Home Edition" Thread



Purpose
This thread offers tweaks to the Grub 2 10_linux and 30_os-prober files in /etc/grub.d. The purpose is to change the way Titles are displayed on the Grub 2 menu.

With the exception of the "But First" section, the tweaks in this thread are outside the normal options currently available in Grub 2's /etc/default/grub. As Grub 2 options are incorporated by the developers these scripts will be annotated or removed.

If you are looking for an introduction on how Grub 2 works, please visit Grub 2 (Ubuntu Community Help doc), Grub 2 Basics or Grub 2 Introduction elsewhere on the Ubuntu Forums. This thread also does not discuss custom configuration files such as /etc/grub.d/40_custom although these tweaks could be incorporated therein.

Feel free to post your tweaks but please limit this thread to posts concerning the Grub text you see in the menu. Also suggest improvements to the ones I posted - I'll edit them to keep them udpated. See the end of this post for some suggestions.

Hopefully as the capabilities of Grub 2 are expanded or become better understood many of these tweaks will become unnecessary. In the meantime those truly anal among us who can never leave things alone will have a place of refuge.

Background
Grub 2 displays, unlike Grub, are not controlled by a single file but rather by the settings in /etc/default/grub and a series of script files located in /etc/grub.d/ . These scripts determine, in part, how the menu options are transferred into /boot/grub/grub.cfg and the menu you see on boot.

See Grub 2 Basics for a general overview of Grub 2 and for links to other Grub 2 resources.

Before You Start
  1. Make copies of the system files you will be altering.
    Note: If you leave the .bak files executable and in the /etc/grub.d folder they will be run by update-grub.
    Code:
    sudo cp /etc/grub.d/10_linux /etc/grub.d/10_linux.bak
    sudo cp /etc/grub.d/30_os-prober /etc/grub.d/30_os-prober.bak
    sudo chmod -x /etc/grub.d/*.bak
  2. Make sure you are working in the correct file, and in the applicable section of that file.
  3. Run "sudo update-grub" to incorporate the changes into Grub 2's menu.
  4. When defining variables, the ` symbol is not a straight quote symbol but a 'grave'. It is often found near the top left of the keyboard.

But First: Popular "Built-In" Tweaks for the / System Partition
  • Turn Off "MEMTEST86+"
    There is no setting to turn off the "memtest86+" option in /etc/default/grub but you can eliminate these entries by turning off the script that searches for them. The following command removes the "executable" bit from the /etc/grud.d/20_memtest86+ file. To restore the setting, change the "-" to a "+":
    Code:
    sudo chmod -x /etc/grub.d/20_memtest86+
    • This effects only the system partition. If you have multiple partitions with Linux installations there is a tweak later that will turn off memtest86+ on them as well.
    • In the Tweaks section there is an explanation of how to boot into the "Recovery Mode" even without a menu option.
  • Turn Off Recovery Mode
    If you don't want to see the Recovery Mode Options for any item, change the setting in /etc/default/grub. While it may be a good idea to have the "Recovery" mode option displayed, if you don't want it, here is how to get rid of it. You can do this by opening the file as 'root' with any text editor and removing the # symbol from the beginning of the line, or by running the following command.
    Code:
    sudo sed s/'#GRUB_DISABLE_LINUX_RECOVERY="true"'/'GRUB_DISABLE_LINUX_RECOVERY="true"'/g -i /etc/default/grub

Grub 2 Files
The basic configuration settings are made in /etc/default/grub. This thread will not deal with those settings.
The two primary files altered by tweaks in this thread are:
  • /etc/grub.d/10_linux
    • This file contains instructions and scripts which deal with linux kernels on the default system partition.
  • /etc/grub.d/30_os-prober
    • This file contains instructions and scripts to deal with kernels and other operating systems found on other partitions.
    • The file contains four sections. Changes must be made in the correct section, as changes in one section will not effect the scripts in the other sections.
      • The four sections are for Windows, other Linux installations, OSX, and Hurd.


1. /etc/grub.d/10_linux - Changing Ubuntu/Linux Titles (on default partition)

Code:
gksu gedit /etc/grub.d/10_linux
  • Defined Variable Examples: ${OS} Ubuntu, Kubuntu, etc.; ${version} 2.6.31-11, 2.6.31-11-generic, etc.
    Added Variable Example: ${codename} karmic
  • Add new variable codename. This list of variables begins at approximately line 87.
    • Code:
      while [ "x$list" != "x" ] ; do
      linux=`version_find_latest $list`
      echo "Found linux image: $linux" >&2
      basename=`basename $linux`
      dirname=`dirname $linux`
      rel_dirname=`make_system_path_relative_to_its_root $dirname`
      version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
      alt_version=`echo $version | sed -e "s,\.old$,,g"`
      linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
      # User-added variable
      codename="`lsb_release -cs`"
      Original Menu Entry: Ubuntu, Linux 2.6.31-11
      This should be located at approximately line 113.
      Code:
      linux_entry "${OS}, Linux ${version}" \
      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
      quiet
      New Format: Ubuntu 2.6.31-11
      Change the original line above to look like the following by removing ", Linux":
      Code:
      linux_entry "${OS} ${version}" \
      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
      quiet
      New Format: Karmic 2.6.31-11
      Ensure the variable ${codename} has been added into the file's variable list.
      The codename returned in this script will always be the current codename of your present Linux OS (i.e. karmic, jaunty, etc.).
      Change the original line above to look like the following:
      Code:
      linux_entry "${codename} ${version}" \
      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
      quiet
  • Run "sudo update-grub" to update the Grub 2 Menu.

2. /etc/grub.d/30_os-prober - Changing Windows or Other Detected OS Titles (including Linux)
  • This file is divided into sections for various types of operating systems. The first section is for Windows (OS), the second Linux (linux), the third OSX (macosx), and finally Hurd (hurd).

    Code:
    gksu gedit /etc/grub.d/30_os-prober
    A. Changing Windows Entries
    • Changes made via this method are best done to OS or kernels which the user does not expect to change. If the system detects a title change the entry in #3 may no longer be correct.

      Original Menu Entry: Microsoft Windows XP Home Edition (on /dev/sda1)

      1. Run this command to get the current Grub 2 menu entries:
      Code:
      sudo cat /boot/grub/grub.cfg | grep "menuentry" | cut -d '"' -f 2
      New Format: Whatever (on /dev/sda7)
      2. This section appears around line 83 of the file. Replace the section in red with the content in #4.
      Code:
      for OS in ${OSPROBED} ; do
      DEVICE="`echo ${OS} | cut -d ':' -f 1`"
      LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
      LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
      BOOT="`echo ${OS} | cut -d ':' -f 4`"

      if [ -z "${LONGNAME}" ] ; then
      LONGNAME="${LABEL}"
      fi
      3. Copy the exact title you wish to change (Example: Microsoft Windows XP Home Edition ) and place it between the quotes in the first line below.
      4. Enter the desired title between the quotes in the second line below - in this example, "Windows XP" would replace "Enter Desired New Title Here".
      Code:
      # Original
      # if [ -z "${LONGNAME}" ] ; then
      # LONGNAME="${LABEL}"
      # fi

      if [ "${LONGNAME}" = "Enter Exact Title You Just Copied" ] ; then
      LONGNAME="Enter Desired New Title Here"
      elif [ -z "${LONGNAME}" ] ; then
      LONGNAME="${LABEL}"
      fi
      5. Multiple entries can be made in the same section:
      Code:
        if [ "${LONGNAME}" = "Enter Exact Title You Just Copied" ] ; then
      LONGNAME="Enter Desired New Title Here"
      elif [ "${LONGNAME}" = "Enter Second Title You Copied" ] ; then
      LONGNAME="Enter Desired Second Title Here"
      elif [ -z "${LONGNAME}" ] ; then
      LONGNAME="${LABEL}"
      fi

    B. Changing Other Linux Installations
    1. Included in the first codeblock below are all the user-defined variables used in this section of the guide. They apply to the "linux" section of /etc/grub.d/30_os-prober file.
      It is only necessary to insert the ones you wish to use. For simplicity and space-saving, they have all been included in the first codeblock below.
    2. Defined Variables Examples: ${LONGNAME} Microsoft Windows XP Home Edition, Ubuntu 9.04 (9.04); ${DEVICE} sda1, sdb6, etc; ${LLABEL} Ubuntu, linux 2.6.31-11
    3. Find the linux section of the file at approximately line 120 (before other additions).
    4. Add the variables you wish to use from the examples below. Following the added variables are examples of possible returned value:
      ${newtitle} Ubuntu 9.04 ;${shortkernel} 2.6.28-15 ; ${nomemtest} memtest86+ ; ${nosingle} single ; shortdevice (sda5) ; ${hidekernel} 2.6.26
      Code:
          ;;
      linux)
      LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"

      for LINUX in ${LINUXPROBED} ; do
      LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
      LBOOT="`echo ${LINUX} | cut -d ':' -f 2`"
      LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
      LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`"
      LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
      LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"
      # User-added variables
      newtitle=`echo ${LONGNAME} | cut -d " " -f 1-2`
      shortkernel="`echo ${LKERNEL} | cut -d "-" -f 2-4`"
      shortdevice="`echo ${DEVICE} | cut -d "/" -f 3`"
      nomemtest="`echo ${LLABEL} | cut -d " " -f 1`"
      nosingle="`echo ${LPARAMS} | sed 's/^.* //'`"
      hidekernel="`echo ${LKERNEL} | cut -d'-' -f2`"
      Original Menu Entry: Linux, Ubuntu 9.04 2.6.28-15 (on /dev/sda7)
      Modify the entry in red for each section you want to change (approximately line 135 in original file):
      Code:
              cat << EOF
      menuentry "${LLABEL} (on ${DEVICE})" {
      EOF
      New Format: Ubuntu 9.04 2.6.28-15 (on /dev/sda7)
      Code:
              cat << EOF
      menuentry "${newtitle} ${shortkernel} (on ${DEVICE})" {
      EOF
      New Format: Ubuntu 9.04 2.6.28-15
      Code:
              cat << EOF
      menuentry "${newtitle} ${shortkernel}" {
      EOF

    C. Eliminating or Changing "(on /dev/sdX)"
    • There are specific sections for Windows (OS), Linux (linux), and OSX (macosx). Users must find the section(s) they wish to change or do a universal search/replace.
    • Defined Variables: ${LONGNAME} OS title; ${device} Partition location (e.g. sda1, sdb6, etc)
    • Modify the entry in red for each section you want to change.

      Original Menu Entry: Windows XP Home (on /dev/sda7)
      Approximately line 100.
      Code:
      menuentry "${LONGNAME} (on ${DEVICE})" {
      New Format: Windows XP Home (sda1)
      Code:
      menuentry "${LONGNAME}" (${shortdevice}) {
      New Format: Windows XP Home
      Code:
      menuentry "${LONGNAME}" {
      Original Menu Entry: Linux, Ubuntu 9.04 2.6.28-15 (on /dev/sda7)
      Approximately line 136.
      Code:
      menuentry "${LLABEL} (on ${DEVICE})" {
      New Format: Linux, Ubuntu 9.04 2.6.28-15 (sda7)
      Code:
      menuentry "${LLABEL}" (${shortdevice}) {
      New Format: Linux, Ubuntu 9.04 2.6.28-15
      Code:
      menuentry "${LLABEL}" {

    D. Removing MEMTEST+86 and Single User Entries (from other partitions)
    • Grub 2 provides the ability to hide memtest86+ and recovery mode (single user) entries for the default partition without modifying the 10_linux or 30_os-prober files (see later in this section) . I have not found a similar ability to inhibit the display of these entries found by 30_os-prober on other partitions.
    • Refer to the previous section for information on inserting variables. The two variables associated with hiding the memtest86+ and recovery mode (single-user) are ${nomemtest} and ${nosingle}.
    • The conditional statement below tells Grub to skip an entry if it is either a memtest86+ or recovery mode option. While a bit inelegant, when inserted in 30_os-prober it will effectively prevent the applicable options from appearing in the Grub 2 menu.
    • To remove memtest86+ and recovery mode/single user entries for other partitions found by 30_os-prober:
      • Insert the code in green just after the linux variable definitions and before the first "menuentry" in the linux section (approximately line 130 before any additions).
        Code:
                LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
        LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"
        # User-added variables
        newtitle=`echo ${LONGNAME} | cut -d " " -f 1-2`
        shortkernel="`echo ${LKERNEL} | cut -d "-" -f 2-4`"
        shortdevice="`echo ${DEVICE} | cut -d "/" -f 3`"
        nomemtest="`echo ${LLABEL} | cut -d " " -f 1`"
        nosingle="`echo ${LPARAMS} | sed 's/^.* //'`"
        hidekernel="`echo ${LKERNEL} | cut -d'-' -f2`"



        if [ -z "${LLABEL}" ] ; then
        LLABEL="${LONGNAME}"
        fi


        if [ ${nomemtest} = "Memory" ] || [ ${nosingle} = "single" ]; then
        break
        fi


        cat << EOF
        menuentry "${LLABEL} (on ${DEVICE}" \
        EOF
      • The entry above hides both recovery mode and memtest86+ entries in one line. If desired, they can be divided into 2 separate sections or used singly by removing the applicable conditional statement and the || characters.
    • To inhibit the display of recovery options on the system partition, uncomment or add this line to /etc/default/grub:
      Quote:
      GRUB_DISABLE_LINUX_RECOVERY=true
    • To inhibit the display of memtest86+ entries from the system partition, make the /etc/grub.d/memtest86+ file non-executable by running this command:
      Code:
      sudo chmod -x /etc/grub.d/20_memtest86+
    • Run "sudo update-grub" to incorporate these changes into the Grub menu.


    E. Removing a Specific Kernel (from other partitions)*
    • This section discusses how to hide a specific kernel while allowing os-prober to search other partitions.
      There are two components necessary for this option:
      • The Variable: hidekernel="`echo ${LKERNEL} | cut -d'-' -f2`"
        • Entered into the linux section of /etc/grub.d/30_os-prober. See previous section for location.
      • The Conditional Statement: if [ ${hidekernel} = "X.X.XX" ]; then
        • X.X.XX or X.X.XX-XX example: 2.6.28 or 2.6.28-12
    • To Hide All Instances of a Kernel (Example: 2.6.26):
      • hidekernel="`echo ${LKERNEL} | cut -d'-' -f2`"
      • if [ ${hidekernel} = "2.6.26" ]; then
    • To Hide a Specific Kernel (Example to hide 2.6.26-11):
      • hidekernel="`echo ${LKERNEL} | cut -d'-' -f2-3`"
      • if [ ${hidekernel} = "2.6.26-11" ]; then

      1. Add the variable to the linux variable list (approximately line 130).
      Code:
              hidekernel="`echo ${LKERNEL} | cut -d'-' -f2`"
      2. Determine the kernel you want to hide (Example: 2.6.26 ) and include it in linux section of /etc/grub.d/30_os-prober, at approximately line 140).
      Code:
              if [ -z "${LLABEL}" ] ; then
      LLABEL="${LONGNAME}"
      fi


      if [ ${hidekernel} = "2.6.26" ]; then
      break
      fi


      cat << EOF
      menuentry "${LLABEL} (on ${DEVICE}" \
      EOF
    * Note: os-prober can be disabled in various ways to prevent Grub 2 from searching any secondary partitions for bootable operating systems. See Grub 2 Basics for more information.

    F. Troubleshooting
    If the tweaks in this section do not work there are several things to check.
    • Are you working with the correct file? Make sure you are making the changes to the file which deals with the item you are trying to hide. Check the grub.cfg file to see which section the entry is appearing in (10_, 30_, etc).
    • Is the variable producing the correct result? The easiest way to check is to either echo the variable results for viewing while update-grub is running or insert the variable in the grub.cfg file for review.
      • Example: The memtest86+ option keeps appearing in the menu, even though you have inserted "nomemtest="`echo ${LLABEL} | cut -d " " -f 1`" into 30_os-prober.
        • Check that the undesired 'memtest86+' menu item is in the 30_os-prober section of grub.cfg
        • Find out what value 'LLABEL' and 'nomemtest' are returning.
        • Alter the following line:
          Code:
           cat << EOF
          menuentry "${LLABEL} (on ${DEVICE})" {
          to
          Code:
           cat << EOF
          nomemtest=${nomemtest} LLABEL=${LLABEL}
          menuentry "${LLABEL} (on ${DEVICE}" \
          A sample entry would now look like this, showing you the values:
          Code:
          nomemtest=memtest86+ LLABEL=Debian GNU/Linux, kernel memtest86+
          menuentry "Debian GNU/Linux, kernel memtest86+" (sda8) {
          Now for each entry, you will have a line directly above displaying the values of nomemtest and LLABEL just before that menu entry was created. With that knowledge, you should be able to tweak the variable to ensure it returns the correct value for the current situation.

3. CUSTOM MENU TWEAKS!
Naming your /etc/grub.d custom folder 06_custom will place the custom menu entries at the top of GRUB 2's menu. Menu items placed in 40_custom will appear the the bottom.

If you use a numbered filename less than 30 you may want to check the "DEFAULT=" line in /etc/default/grub after running sudo update-grub to ensure the correct menuentry item is identified.

  1. This custom entry is based on ranch hand's post #26. It provides an entry for the latest kernel on the system and will remain current even after a kernel update. UUIDs may be used to identify root if desired.

    Code:
    menuentry "Latest Kernel" {
    set root=(hdX,Y)
    linux /vmlinuz root=/dev/sdXY ro quiet splash
    initrd /initrd.img
    }
4. POST YOUR TWEAKS!

Thread Recommendations
  • Tweaks that only alter the text on the Grub 2 Menu.
  • If possible, on the first line post the existing title and how it will change.
  • Original Menu Entry: Microsoft Windows XP Home Edition on sda1 >> New: XP

    To achieve this on the first line, copy/paste the code from the last line of this post and then alter it.


    [size="3"][b]Original Menu Entry: [color="DarkRed"]Microsoft Windows XP Home Edition on sda1[/color] >> New: [color="DarkGreen"]XP[/color][/b][/size]
    [/size]

Sunday, November 1, 2009

FSTAB automatically edited

A nice tutorial for automatically editing FSTAB using PySDM

Here a quote of that website:

GUI Fstab Editing with PySDM

Storage Device Manager - Worry-Free Fstab Configuration
Storage Device Manager provides an easy, non-technical GUI method to make changes to mounting options without manually editing any files. It does for mounting partitions what StartUp-Manager does for editing grub's menu.lst. Storage Device Manager (PySDM) allows the full range of options available to those who manually edit fstab while simplifying the steps so that even beginners will feel comfortable making the same changes through Storage Device Manager. You no longer have to wonder if relatime is really the correct spelling.

Note that pySDM is an older application that hasn't been updated recently. It has some limitations. For one, it does not make a back up copy of the /etcfstab file. Secondly, it uses the older method of identifying partitions with "sdXX" in the fstab file. The preferred method, using UUIDs or labels, must be done outside of the pySDM application if desired.

Before proceeding, please note that there are some excellent references for further information regarding fstab located at the bottom of this guide.

Sections:
5 Minute Guide --- Installing & Starting --- Fstab Backup --- Using PySDM
When You Will Need Fstab --- Notes --- Partition Commands --- Links
Quote:
The 5 Minute Guide - I Don't Have Time for All The Rest of This Stuff !

Stop the Presses! If you only need to configure an NTFS drive, have you considered ntfs-config? "sudo apt-get install ntfs-config", then start it via System Tools, NTFS Configuration Tool. This app will set up NTFS partitions to allow read/write access, if that is all you are looking for. Now back to our regular programming...

If you run into problems, read the rest of this guide. Let's get started:

A. Permanent Drives
1. Install Storage Device Manager (pysdm) via Synaptic or : sudo apt-get install pysdm
2. Make a backup of fstab (you may be in a rush, but you aren't reckless!): sudo cp /etc/fstab /etc/fstab.bak
3. Start PySDM: System > Administration > Storage Device Manager or gksu pysdm &
4. The devices are listed in the left panel (sda, sdb, etc). If you click on the white triangle to the left of one of the devices (sda, sdb, etc) it will expand to show each partition on the device (sda1, sda2, etc).
  • Expand the device by clicking the white triangle to the left and select the partition you wish to set up. If there is no previous SDM setup for this partition, a 'Configure Now' window appears. Select 'OK' to continue. Hit 'Refresh' if you don't see the device. If it's an external drive there is a good chance it will be listed last. If you aren't sure, see Section 5 for some hints for locating the correct partition.
5. Type the name of a mountpoint in the 'Name' window. The mountpoint you name will create and/or select your mountpoint in /media
  • Example: If you enter my-data in the window, it will be mounted on /media/my-data
    If you want a mountpoint other than /media, click on the 'folder' icon and select another folder.
6. Into the Options window, copy/paste the bold portion of the applicable line (there should be no spaces). The copy/paste information replaces the default entry of Defaults
  • ext2/3 data partitions:
    Code:
    root partition ( / ):    relatime,errors=remount-ro
    home partition (/home): nodev,nosuid,relatime
    other partitions: defaults,users
    After mounting, if necessary you can run chown and chmod on mounted ext3 mountpoints.
    • sudo chown -R username:groupname /media/yourmountpoint
      • Example: sudo chown -R drs305:mygroup /media/my-data
    • chmod -R 755 /media/yourmountpoint (Run previous command first or preceed command with 'sudo')
      • chmod -R 755 /media/my-data
  • ntfs/vat partitions :
    Code:
    auto,users,uid=1000,gid=1000,utf8,dmask=027,fmask=137
    • uid 1000 is owner - 1000 is the first user (created at install). Adjust to another uid if desired.
    • group is uid 1000's group (rw for directories, r for files), others have no access. Group id can be set to any existing group. Common groups include 0 root, 46 plugdev (removable drives), 100 (often set to 'users'), and 100X (1000 is normally first user's group, 1001 second, etc).
    • Ownership of ntfs and fat32 partitions is set at mounting - chown and chmod will not 'stick'.
    • NTFS Note: An ntfs partition fstab entry should work with a simple 'ntfs-3g defaults' entry. The mountpoint will be owned by root, as will subfolders and files. However, the user can write and save these files. If the uid/gid etc are added to fstab, the mountpoint will still be owned by root but the subfolders and files will show they are owned by the user (uid=).
7. Click on "Assistant" and uncheck "Mount file system in read-only mode".
8. Hit 'Apply'. Fstab has just been updated.
9. Hit the Unmount, then Mount Button. The device/partition should now reflect your selections.
10. Done.

Note: Fsck will not be run on this partition. Consider editing fstab to add this option for ext2/3 partitions. See Section 4.

B. Removable Drives. (Skip this paragraph if you are trying to keep under 5 minutes! ) These drives should work without an entry in fstab. They are not mounted automatically but are mounted by going to Places > Removable Media and selecting the removable device you wish to mount. There is a reason these devices are not normally listed in fstab - their designations are dynamic. As an example, the same removable device could be sdc one time and and sdg another. Fstab would not recognize the changed designation.

If you want to include a removable or external drive in fstab:
Since their designations (dev/sdXX) are not fixed entering them in fstab takes a little more work. Your fstab entry should identify the device with either a UUID or a label. This ensures that the fstab setting will still be valid whether the device is mapped as sdc, sdh, etc. Create the fstab entry via SDM (steps 1-8), then manually edit fstab to 'lock in' the device label by replacing the sdXX with either a label or UUID.
  • By UUID:
    Find the UUID: sudo blkid | grep 'UUID'
  • By Label:
    Check for a label: sudo blkid | grep 'LABEL'
    If no label exists, install labeling apps: sudo aptitude install ntfsprogs e2fsprogs
    If making a new label, save yourself some trouble by NOT using a label name with spaces! (my-data or my_data, not 'my data')
    • ntfs: sudo ntfslabel /dev/ LABELNAME Example: sudo ntfslabel /dev/sdg1 my-data
      ext2/3: sudo tune2fs -L # Example: sudo tune2fs -L /dev/sdg1 my-data
      fat32: Labeling a fat32 device with data on it will put us over 5 minutes -sorry. Go to Label fat partitions
Run Steps 1-9 above. When you have completed Step 9 the fstab file will be updated to include the partition. However, it will be defined as /dev/sdXX. You now must change this designation to a label or uuid listing:
  • Open fstab: gksu gedit /etc/fstab
    Change '/dev/sdXX' to 'LABEL=LABELNAME' or 'UUID=123-abc'
    Example of change:
    /dev/sdg1 /media/my-data ... to UUID=123-abc /media/my-data ...
    or
    LABEL=LABELNAME /media/my-data ...
1. Installing & Starting Storage Device Manager (PySDM)
Storage Device Manager is accessed via System > Administration > Storage Device Manager. From the command line, start it with "gksu pysdm". Root privilege is required since PySDM makes changes to system files. gksu is the cousin of sudo and should be used with graphical apps.

If Storage Device Manager is not in your menu, install it via synaptic ( System > Administration > Synaptic Package Manager ). If you don't see 'pysdm' listed in synaptic or the following command line method is not successful, go to Synaptic > Settings > Repositories > Ubuntu Software and make sure the 'universe' repository is checked. Hit the 'Reload' button to refresh the package list and then select pysdm. You can also install it via command line with:
Code:
sudo aptitude install pysdm
2. Backup Fstab
Before modifying any system file, it is good practice to make a backup copy. If you intend to make multiple changes
within a short time, I'd recommend assigning each backup a unique number (fstab.bak1, bak2, etc). To make a backup:
Code:
sudo cp /etc/fstab /etc/fstab.bak1
3. Using PySDM
The PySDM interface consists of 3 sections: the Partition window for selecting the partition, the General Configuration window for setting fstab options, and the Dynamic configuration rules window for modifying hot-plug device and removable settings.

Partition List
When Storage Device Manager starts, it reads the devices/partitions available to it and displays them in the far left window. Starting with Hardy, Ubuntu no longer refers to devices as hda even for IDE drives.

Select the partition which you want to mount by expanding the drive (sda, sdb, etc) and clicking on the triangle to the left of the individual partition (sda, sdb, etc). Until you select a partition the right side of PySDM will be grayed out and unavailable for input. If you don't know which partition you want to select, go to the Which Partition? section at the bottom of this page for help. The first time PySDM works with a partition, even if an entry already exists in fstab, it will ask 'Configure Now? - click OK.

General Configuration
  • Name
    Name is the mountpoint you wish to use, by default a subfolder of /media and named the same as the partition (e.g. 'sda3'). You can choose a more descriptive name, such as 'my-data' or whatever you wish. The folder will be created if it does not exist. The folder created and/or selected should be empty - do not select a folder already containing files or subfolders.
  • Mountpoint
    If you do not want to use /media as the base mountpoint you can choose a different folder by clicking on the folder icon and navigating to another folder. If you wish to make a new folder while navigating your system, click the 'new folder' at the top right of the navigation window. If you get 'lost' while navigating the folders, 'File System' in the left window will get you back to / .
  • Type
    Take a breath and relax - you don't have to make a decision here. Type is just informing you the type of partition you are working with (e.g. ext3, ntfs, vfat).
  • Options
    Here's the meat of the program. Initially 'Options' is set to 'defaults'. Clicking the 'Set Defaults' button also resets this window to 'defaults'. Selecting 'defaults' sets the following options: rw, suid, dev, exec, auto, nouser, async. Starting with Hardy, 'relatime' is also a default on native linux (i.e. ext2/3) partitions. For information on each of these settings, refer to the links at the bottom of this guide. If you add or change any options, 'defaults' will not be shown but will apply to any setting not overridden. One other note, in addition to automatic entries, anything you type in this window will be input in the options section of fstab. For instance, there is no option to set dmask or fmask but you can add them to the options line and they will be applied along with the other settings. All options are joined by commas with no spaces in the entire section.
  • Assistant
    This section could also be called 'More Options' since it is the section in which you can change settings from 'defaults'. Most of the settings are self-explanatory. The setting options presented vary with the type of partition selected (ext3, ntfs, fat32, etc). I will comment on a few of the options you may wish to consider changing. Any change you make in these sections will remove the 'defaults' option from the main window and non-default options will be displayed. Default settings will still apply to those settings which are not overridden.

    Auto-selected items are colored blue. Black Bold items are the actual designations that appear in the fstab options section when selected. Default options are underlined. They will NOT appear in fstab but apply unless the associated non-default option is entered.
    * Items which should be considered. Author recommendations are listed in green.
    • Mounting Tab
      • * Mount read-only *. ro The Read-Only option is OFF (rw) for linux ext2/3 partitions and ON* (ro) by default for VFAT/NTFS partitions. For VFAT/NTFS partitions, this option must be unchecked to enable read/write. For non-linux partitions, the PySDM umask (and dmask/fmask manual entries) setting can allow RW access for non-linux partitions even if RO is enabled.
      • Allow group mount. group= Allow any group member to mount. Enter group id.
      • * Allow any user to mount. users Normally the option would allow a user to click on a partition icon or use the 'mount /dev/sdXX' option to mount the partition without root privileges. If this option doesn't work for NTFS partitions try mounting via terminal. If you get an 'Unprivileged user' message, see the section at the bottom of the page on NTFS-3g errors.
      • * Allow a user mount. nouser/user
      • File system mounted at boot time. auto/noauto
      • Owner of device can mount. owner
      • Owner user of filesystem . uid= Enter uid in window. Whoever mounts the device owns it. Your uid is normally 1000 if you are the primary user. To check, run the following command in terminal: id. You may wish to select this option.
      • Support extended attributes. --/user_xattr (Linux partitions only).
      • * Check file system on mount time. (Linux partitions only). This command is no longer supported and may produce an error message. Do not select it. Fsck checks are no longer included in the options section; they are now handled by the last digit on the line (normally 0, 1 or 2).
      • * Umask. 000 (Non-linux partitions only). This is an entire subject in itself. The PySDM menu does not offer dmask and fmask value inputs for ntfs/fat partitions. You can manually enter them them in the Options window if you wish.
        On NTFS partitions, if the fstab options are left at "defaults" the mountpoint and all folders/files will be owned by root but readable/writable by the user. If uid/gid options are used, the mountpoint is still owned by root but all subfolders and files are owned by the user specified by "uid=".
        Refer to the Permissions link at the bottom of the page for more information. Here are some common umask settings you may wish to consider:
        000 (Permissions 777) - Default PySDM setting. Anyone can do anything!
        022 (Permissions 755) - Owner read/write/execute (rwx), group (rx), others (rx).
        027 (Permissions 750) - Owner rwx, group rx, others can't access partition.
        077 (Permissions 700) - Only the owner can rwx, group and others cannot access partition.
        * Instead of umask, dmask & fmask can be used but must be entered manually on the Options line. Two useful settings would be:
        dmask 027,fmask137 - Owner has rwx for directories, rw for files. Group has rx for dirs and r for files.
        dmask 000,fmask111 - Owner rwx dirs, rw files. Group rwx dirs, rw files. Others rwx dirs, rw files.
        Deselect umask if dmask/fmask settings are entered in the Options window.
      • Owner group of filesystem. gid=
    • Special Files
      • Permit execution of binaries. exec/noexec If unchecked, this option prevents execution of program files within the partition. This may be desirable for a storage or data partition which nevertheless contains executable files. Unchecking this box will also disable the warning message in nautilus and other applications which asks if you want to run the file or open it. If not checked, the file will open without the query.
      • Permit executables to change user/group identity. suid/nosuid Relates to scripts. Note: If you need to know about this, you probably don't need PySDM!
      • Interpret character or special block devices. dev/nodev See note in previous entry!
    • Journaling (Linux partitions only)
      • Specify a journaling mode. /data= Ordered, journal or writeback.
      • Update journal or specify the inode where it is. journal=
      • Do not load journal on mounting. noload
    • Performance
      This section deals with recording data access times and synchronization matters. User input is not normally required. Many items apply to linux partitions only.
      • Update directory time for each access. diratime/nodiratime
      • I/O to file system should be done synchronously. async/sync
      • All directory updates should be done synchronously . nodirsync/dirsync
      • Update file time for each access. atime/noatime
      • Specify what to do in case of errors=. remount-ro/continue/panic Really, panic is an option..
      • Do not attach buffer_heads to file pagecache.
      • Get group id from the directory for a new file.
      • Synchronize data and metadata every specified seconds. commit=
      • Use a especific block as superblock. sb=
      • Use old new inode allocator.
    • Miscellaneous
      This section deals with network file systems, default character encoding, UFT-8 file name conversion, upper/lower case interpretation, and escape sequences. The default character set is the older iso8859-1. If your system is having trouble reading the directory or file names, changing these settings may help.
      • File system requires network. _netdev
        Linux partitions (ext2/ext3) only:
      • User allowed to use reserved space. resuid=
      • Group allowed to use reserved space. resgid=
      • Support POSIX access list.
      • Disables 32 bit user and group id.
      • Print debugging info.
      • Minix behavior for stat information.
        Non-Linux only:
      • * Character set to use for file names. nls=iso8859-1 The english-speaking standard of iso8859-1 is the default and checked, The mount man page uses the iocharset=8859-1 . If this is listed in the Options window, I recommend changing nls= to iocharset= I personally turn it off by deselecting it..
      • * Use UTF-8 for converting file names. utf8 Select this for ntfs and vfat (fat16/32) partitions.
      • Update file time for each access. posix
      • Use escape sequences for unknown characters. uni_xlate=
  • Mount Button
    You can mount and unmount the selected partition by clicking on this button. Cycling Unmount > Mount will allow the options you have designated to take effect. It is equivalent to running the 'sudo umount' and 'sudo mount' commands on the particular partition.
  • Apply Button
    Finallly! Clicking this button applies the changes. In fstab, the revised or new entries are placed at the bottom of the file. PySDM at present does not use UUID's or LABEL designations. If you have entries in fstab that use either of these designations, they will either remain unchanged or become comments. The '/dev/sdXX' line generated by PySDM will appear below previous entries in the /etc/fstab file. In this case, even though there are multiple entries for the same partition, the PySDM lines will be loaded last and thus will take precedence over earlier lines.

Dynamic Configuration Rules
This section enables you to set udev rules. Click on the 'New' button and you can set the conditions of Name, Model, Vendor, and bus type.
After setting specifications to identify the device, you can set the user, group, device file name, and specify user's rights. You can also create a link with a name of your choosing. The settings are stored in /etc/udev/user.rules. For more information about udev configuration refer to the man page ( man udev) or the link at the bottom of this guide.


4. When You Will Need Fstab (and How to Do It)
While PySDM offers an easy and safe way to change or create partition mounting instructions, there are several reasons why you might wish to edit fstab manually. Before modifying any system file, it is good practice to make a backup copy.
Code:
sudo cp /etc/fstab /etc/fstab.bak
gksu gedit /etc/fstab
  • Refer to the instructions in the '3 Minute Guide' Removable Drives section for how to make the following changes.
  • UUIDs. PySDM currently does not use UUIDs. If your fstab contains a UUID entry and you attempt to create a new listing for the same partition PySDM will create a "/dev/sdXX" entry at the bottom of the file. PySDM will either place a comment (#) symbol at the start of the original line and/or will override the UUID entry by placing the PySDM-generated entry at the bottom of fstab. A technique if you would like to retain the UUID entry would be to generate an fstab entry with PySDM, copy the options to the UUID line, and then delete the remainder of the PySDM entry. Remember that since PySDM does not use UUIDs, it will not update them if they are changed due to repartitioning.
  • LABELS. PySDM currently does not use labels. Read the previous entry on UUIDs. The same technique applies for labels.
  • /dev Designations. Some users prefer not to use /dev designations. In the past some updates/upgrades changed the letter designations of partitions. Since Hardy now uses the /dev/sdXX designation, there should be no more unrequested changes from /dev/hdXX to /dev/sdXX or vice versa. If you don't want to use the /dev designations run PySDM and then replace the /dev/sdXX designation with the UUID or label. (see commands below for determining these)
  • FSCK Entries. The last digit in an fstab entry is provides instructions for fsck (disk checking).
    The last digit relays the following instructions to fsck:
    0 - Do not check. (This should always be the setting for non-linux partitions.)
    1 - Check first. (Root)
    2 - Perform check with a lower priority than 1 (when running during the same session).
    PySDM always creates a listing with the FSCK option set at '0'. If you want to change this you will need to edit fstab and change the setting.

5. Notes & Additional Information

How Do I Know Which Partition to Choose?
When adding a new device or after partitioning a drive, you may not be sure which partition you want to select. One method you can try is to watch the list as the device is plugged in. If it may be mounted, run "sudo umount -a". There will be some busy messages but it won't hurt anything. Then plug in the device and see if it mounts by watching the Partition List window to see if it appears. Normally PySDM will place this 'new' device at the bottom of the list, even if the letter designation is lower than some already displayed. You can use some of the commands listed later in this section to help you investigate your system's partition information. Some of the following characteristics may help you determine the partition:
  • Size - Approximate size of the partition: df -h
  • Formatting - Type of formatting: df -T | grep "/dev/"
  • Bootable - Bootable Partitions: sudo fdisk -l | grep "*"
  • View Everything - sudo fdisk -l && sudo blkid && df -Th && cat /etc/fstab && mount

'Unprivileged User' NTFS Errors
NTFS-3g was incorporated in Hardy and is enabled by default. Nevertheless, it is possible to get an error message when trying to mount an NTFS partition as a specific user. The error message is:
  • Unprivileged user can not mount NTFS block devices using the external FUSE library. Either mount the volume as root, or rebuild NTFS-3G with integrated FUSE support and make it setuid root. Please see more information at http://ntfs-3g.org/support.html#unprivileged
    To correct this condition:
    Code:
    sudo chown root $(which ntfs-3g)
    sudo chmod 4755 $(which ntfs-3g)
6. Useful Partition Commands (Results in italics)

What partitions are currently mounted?
mount
/dev/sda5 on / type ext3 (rw,errors=remount-ro)

What is contained in my fstab (to exclude commented lines, add [ | grep -v "#" ]?
cat /etc/fstab
# Entry for /dev/sda5 :
UUID=4d33bfe6 / ext3 defaults,errors=remount-ro 0 1


What is the UUID / LABEL of my partition?
sudo blkid -c /dev/null
/dev/sda1: UUID="CEECFF9EECFF7F51" TYPE="ntfs"

What partitions are on my computer (note the switch is a small L)?
sudo fdisk -l
/dev/sda5 * 2804 4078 10241406 83 Linux

How much space do I have on my partitions?
df -Th
/dev/sda5 ext3 9.7G 3.9G 5.4G 42% /

How do I make a label for my NTFS partition? (Install ntfsprogs first)
sudo ntfslabel

Saturday, October 31, 2009

GRUB2

Here is a regularly updated posting about Grub 2

A good tool to have is an (empty grub.cfg) grub2 cdrom so that
you can use this to boot to any OS if you have any problem. To get it,
type at terminal

grub-mkrescue grubrescue.iso

where grubrescue.iso is name of iso which will be
created at ~/ if your command is at home. Burn that iso and you will
have a bootable grub2 cdrom for you to boot your system with.


The sidux site with detailed grub2 info
More Ubuntu info about Grub2 is found here
Grub2 title tweaks are found here
A Grub2 wiki from ubuntu including recovery information is found here

Sunday, October 25, 2009

CAPTCHA in Google Gmail

Google has a mecanism for preventing robots to login into Gmail. It's very usefull. Only when didn't remember exactly your password when configuring an email client its rather nasty, because you cannot login anymore except with your webmail. Another reason for the invalid credentials or web login requires error to happen is too frequent mail checking. Gmail says that you shouldn't do that more than once every 10 minutes.

If you’re very sure that you’re using a correct password and username (with @gmail.com after the user name), and not checking email in Gmail’s Inbox too frequently, you may need to clear and unlock the CAPTCHA. To unlock CAPTCHA for Gmail account, go to the following URL:

https://www.google.com/accounts/DisplayUnlockCaptcha

Note: For Google Apps user, visit https://www.google.com/a/yourdomain.com/UnlockCaptcha instead, with yourdomain.com as the valid domainname.

Type in the email address, password for the Gmail address, and fill in the correct Captcha validation. Click on “Unlock” button to fix the IMAP failure error.

For user who still faces the problem after clear the Captcha can try to use an alternative IMAP server instead, which is imap.googlemail.com on SSL port 993.

Wednesday, October 14, 2009

Adobe Air in Linux Mint and Linux Ubuntu

Adobe Air is installable in Ubuntu and Mint. It's used to use a lot of programs in a browser that formerly worked only on Windows and Mac. E.G. the albelli.nl software.

Look here for more info:

http://maketecheasier.com/install-adobe-air-for-linux-in-ubuntu-intrepid/2008/12/19

Tuesday, October 6, 2009

Fix screen resolution

A Dutch site explains how to change Ubuntus screen resolution. Its written by Leo Cardinaal.

Read it here

Wednesday, September 30, 2009

Element OS

I found an interesting project for the PC Element OS. Its a linux disto, still in pre alpha phase, to cover all multimedia needs in one distro.

Look here for more info:

http://www.elementmypc.com

11 ubuntu derivatives

On this site I found a list of 10 derivatives.
http://digitizor.com/2009/09/05/10-best-derivatives-of-ubuntu/

I added an eleventh:

1. Kubuntu
Of all the Ubuntu derivatives, Kubuntu is perhaps the most popular. It is maintained by Canonical, the same company behind Ubuntu. Kubuntu uses KDE as the graphical environment instead of GNOME which is used in Ubuntu. It follows the same release cycle as Ubuntu.
Website: Kubuntu linux for human beings
Download: How Can You Get Kubuntu? Kubuntu
2. Xubuntu
Xubuntu is also another Canonical Project. In Xubuntu, the graphical environment used is Xfce in place of GNOME. It is a distribution meant for systems with limited (read lesser) system resources. Xubuntu also follows the Ubuntu release cycle.
Website: Xubuntu Home Page Xubuntu
Download: Get Xubuntu Xubuntu
3. Edubuntu
Edubuntu is yet another Canonical maintained derivative of Ubuntu. Unlike the previous two distributions, it does not use another graphical environment. It uses GNOME, same as in Ubuntu. Rather, Edubuntu is Ubuntu for students and teachers and has been enhanced with educational tools and applications. And yes it also follows the Ubuntu release cycle.
Website: Welcome to Edubuntu! edubuntu
Download: Download Edubuntu edubuntu
4. Ubuntu Studio
Ubuntu Studio is an Ubuntu distribution which is meant for multimedia production. It is an officially recognised Ubuntu distribution. It includes a Linux kernel which has been modified for graphical, audio and video works. Unlike other Ubuntu distributions, it does not fit in a CD and comes in a DVD.
Website: Home Ubuntu Studio
Download: Downloads Ubuntu Studio
5. nUbuntu
nUbuntu is a remastered version of Ubuntu for security testing. It combines the ease of use of ubuntu with a host of tools necessary for penetration testing of servers and networks. It is not a Canonical supported project. Its latest version is 8.12 which is in beta stage.
Website: nUbuntu
Download: nUbuntu – Download
6. Linux Mint
Linux Mint is another non-Canonical supported derivative of Ubuntu. Like Ubuntu, Linux Mint also uses GNOME as its default graphical environment but its interface has a distinct look from Ubuntu unlike other distributions mentioned here. It also comes with media codecs which are excluded with the default Ubuntu installation. Linux Mint also comes with variations with KDE and Xfce also.
Website: Linux Mint Main Page
Download: Linux Mint Download
7. Super OS
Super OS, formerly known as Super Ubuntu, is a remastered version of Ubuntu. It contains various enhancements over Ubuntu while still remaining compatible with it. It is prepackaged with mp3 and video-DVDs support.
Website: Super OS
8. Poseidon Linux
Poseidon Linux is a Ubuntu 8.04 LTS based OS which is mainly meant for scientists. It contains many free softwares used for scientific analysis like 2D/3D/4D, statistical tools, mapping tools etc. Originally created in Portugese language, it has now been extended to many languages due to its popularity among the scientific community.
Website: Poseidon Linux
Download: Download (Poseidon Linux – The Scientific GNU/Linux)
9. Mythbuntu
Mythbuntu is a media center OS based on Ubuntu and has the MythTV Media Center Software as its main function. It uses Xfce graphical environment by default although other environments can also be installed. Although not a Canonical supported product, it follows the Ubuntu release cycle very closely.
Website: Mythbuntu
Download: Download ISO Mythbuntu
10. Ubuntu Netbook Remix
Ubuntu Netbook Remix is a collaborative effort between Canonical and Moblin Project to optimise Ubuntu for netbook usage, i.e. lower hardware requirements, longer battery life and better display on smaller screen. There are also variants of Ubuntu Netbook remix which are made for certain netbook vendors.
Website: Ubuntu Netbook Remix Canonical
Download: Download Ubuntu Netbook Remix Ubuntu
11. OpenGEU
OpenGEU, previously known as Geubuntu, is a complete and fully functional Operative System based on the popular Linux Distribution Ubuntu. OpenGEU, a project started and designed by the Italian artist Luca D.M. (aka TheDarkMaster), is perfect for any Desktop, Laptop PC or even for a Virtual Machine. OpenGEU mixes the power and simplicity of Ubuntu and parts of the Gnome Desktop with the wonder and astonishing eye-candy of Enlightenment DR17.
Website: OpenGEU
Download: Download OpenGEU

Sunday, September 27, 2009

NVIDIA troubles with legacy card

Issues I had to install my graphic card in linux Mint and in Ubuntu -Nvidia Rivia TNT2-

I can tell you installing the "right" driver for your graphic will boost your Ubuntu speed and also its appearance and it really becomes faster !

First of all I make a back up of my Xorg.conf like a good boy !
So here is how I installed my Nvidia TNT2 graphic card :
I first backed up my Xorg.conf using this command (you should really do that before installing any graphic driver program )
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
then I installed the driver using the menu , system--> adminstrator --> restricted driver manager ,then it automatically installed my graphic card.


How to make sure if the Graphic driver is installed and enabled ?

try this in a Terminal
sudo nvidia-glx-config enable
and also this :
glxgears
this should show a 3D animation and also some numbers in the terminal like

1100 frames in 5.0 seconds = 219.997 FPS
1384 frames in 5.0 seconds = 276.788 FPS
1385 frames in 5.0 seconds = 276.896 FPS
1385 frames in 5.0 seconds = 276.849 FPS
1382 frames in 5.0 seconds = 276.397 FPS

if those numbers which I marked in red, are less than 1000 (like 150 , 300...) then you have not enabled / installed it right !

Ah , Low Screen Reolution Problem !
but after installing I found out my screen resolution is 800*600 and it doesn't let me change it . some others also have the same problem , and a bug is listed in launch pad for this !

the problem is the Ubuntu fails to detect the monitor Horizontal and Vertical Refresh Rate numbers, (on Ubuntu site they have explained this fix in detail) .
to fix this problem I do this (I have made backup of the xorg.conf ! okay?)
sudo gedit /etc/X11/xorg.conf
(if you are in not graphic mode , you should use nano instead of gedit)

now find the Section "Monitor"
and add these lines just before EndSection :
HorizSync 30-96
VertRefresh 50-160

mind that those numbers (30-96 and 50-160) are default numbers which should work with most monitors ,but your monitor may be different , so google for it to find the right numbers.
for your own monitor .

now save the file and then restart your Ubuntu !

If you messed up your graphic in Ubuntu...
You no longer see any graphic but a black page with terminal (command prompt) ?
Don't get scared (terminal is not gonna bite you) , it is easy to recover , fix everything using commands .
cd /etc/X11/
Then
dir
this shows list of files in that folder
mv xorg.conf.backup xorg.conf
If your backup file name is different change xorg.conf.backup , for example
mv xorg.conf.backup20070404 xorg.conf

To find out the name of the back up file just look at the list of files which "dir" command gave you.

Monday, September 21, 2009

Photofun

Want to make a nice avatar. Visit http://www.photofunia.com/

uninstall

I use Linux Mint because the system doesn't get corrupted by installing a lot of programms. Sometimes I need MS Windows. I still use XP. Now I found this uninstall programm:
http://www.revouninstaller.com/revo_uninstaller_free_download.html

It's nice and neat. And also is usable in Linux for uninstalling programms that are installed in Wine.

Undelete files on flash memory

Allthough not in windows, but too interesting fore not mentioning here:

Download on: http://www.pcinspector.de/Sites/file_recovery/info.htm?language=46

Other free programms to undelete files in win XP or Vista:

- Recuva (made by CCleaner). Download: http://www.recuva.com/download
- Undelete +. Download http://www.undelete-plus.com/download.html
- SoftPerfect File Recovery. Download http://www.softperfect.com/products/filerecovery/

Wednesday, September 9, 2009

Allmyapps

A new website to be used for installing apps in Ubuntu and mint

Allmyapps
I quote fullcircle magazine page 21:

I get frustrated each time an iPhone owner talks about how cool the Apple AppStore is. Technically, the Apple AppStore is nothing but a package repository like those we've enjoyed for ages in the Linux world! Our goal is to unleash the true power of Linux package repositories, and show it to the world. With allmyapps, we want to give users the best
application installation tool in terms of eyecandy and usability. Indeed, allmyapps
leverages on the power and the depth of our package repositories to provide users
with a tool that is fun, easy, and, of course, secure! We have tried to make allmyapps
visually appealing, so that people will enjoy browsing applications on it. In the same
spirit, we have also focused a lot on usability to help people find the applications they need,
either by browsing categories or by performing a free search. Finally, as allmyapps relies on
the apt package management system (through apt-url), it is completely safe for users to
use. A lot of people asked us why we decided to implement allmyapps as a Web application
and not as a traditional desktop application. The main reason is that we want
allmyapps to be visible to all users (not only Linux users). This is also why, beyond
traditional social features like screenshots, reviews, and ratings, allmyapps gives you
the ability to create lists of applications that you can share with others via email or a Web
widget. The goal here is to help spread the word and make people realize how easy and
fun it is to install applications on Linux!

ten ubuntu related sites

On maketecheasier I found these links:

1) Ubuntuforums

Needless to say, the best place to go for Ubuntu support is none other than the popular Ubuntu Forums. This is the only place where you can find all kind of advices, tips and tricks, hacks and solutions related to Ubuntu. If there is a Ubuntu-related problem that you can’t solve, most likely it has already been discussed in the forums. Simply do a search in the forums or post your question and you will receive plenty of help from the community.

2) Ubuntu Guide

As its name implies, UbuntuGuide is a wiki where you can find plenty of guide, tips and tricks for Ubuntu. It covers information from Ubuntu Dapper to Jaunty and is available in multiple languages. While UbuntuForums is a great means to get solutions for your problems, UbuntuGuide is the place to go to find new tricks and apply them in your system.

3) Ubuntu Hardware Support List

While Ubuntu supports a wide range of devices, there are still times when you can’t get a particular hardware to work. The Hardware Support page shows a hardware compatibility list that you can refer to before you make any hardware purchase. This hardware support page is maintained by the community and anyone can add/modify the entry.

4) Ubuntu Documentation

It is no doubt that Ubuntu is an easy to use and user-friendly distro. However, if you are still having difficulties navigating around and get it to perform simple daily tasks, you can head on to Ubuntu Documentation and read about everything you need to know about Ubuntu. It won’t make you an expert, but at least it can help you to get started (and perhaps show your friends how geeky you are).

5) Launchpad

Launchpad is the place for you to discover new open-source applications or retrieve source code/installation instruction for third party apps that are not found in the Ubuntu repositories.

6) Gnome-look.org

If you love eye-candy, beautiful wallpapers, login screen, splash screen and everything about your Ubuntu system, then gnome-look.org is the place to visit. It contains a great collection of artworks and themes contributed by the community. They are free to download and use.

Kubuntu and Xubuntu users can check out kde-look.org and xfce-look.org respectively.

7) Ubuntu Brainstorm

Ubuntu Brainstorm is a Digg-like site where you can submit your ideas/suggestions/stuffs to be included in future version of Ubuntu and let others vote for it. Popular ideas (those that received a lot of votes) are reviewed by the Ubuntu team and possibly include them in the future release.

8) Full Circle Magazine

Full Circle Magazine is the only website that is dedicated to publish a free Ubuntu magazine (in pdf format) every month. Being a loyal subscriber, I have found their magazines very informative, yet doesn’t get too technical in detail. It is great for new users who wanted to learn more about Ubuntu.

9) Ubuntu Seach Engine

A Google custom search engine dedicated to search only Ubuntu-related stuffs. Currently it indexes 169 Ubuntu-related sites, including UbuntuForums, Ubuntu Wiki and Ubuntu Guide.

Other dedicated Ubuntu search engine that you can go to include Ubuntu-Search and Ubuntu Wire.

10) Planet Ubuntu

Planet Ubuntu is a blog written and updated regularly by Ubuntu developers and contributors. This is where you can get the latest and updated news about your system.

Tuesday, August 18, 2009

Make your own DVD

The program 2manDVD is a perfect tool for creating DVD menus and converting .mpg and .avi files into the DVD structure.
Read here more about it.

Download a debian installer here.

here is a copy of the text I mentioned above:

How to convert DivX/XviD/MPEG to DVD with menu using manDVD PDF Print E-mail
I consider myself a rather old Linux user. I remember playing around with Slackware and failing to complete the installation, then getting a copy of Corel Linux (yes, it did exist!) before using Redhat, then SuSE and finally ending up with Ubuntu since version 4.10. During those years the growth of Linux desktop has been amazing. From fighting with the command line or trying for hours to play a video file, nowadays Linux is the desktop leader in features and effects with projects like Compiz that generate amazing 3D effects much better than the ones in the much advertised Windows Vista.

Of course not only Linux matured but the applications that run on the platform did as well. I remember I used to boot my Windows partition almost only to use video tools, like ConvertXToDVD or Nero as I couldn't find a working choice on Linux. However this is no longer the case. There are many great video applications for Linux, some of them even better than commercial ones for Windows, all of them not just free but open source as well! This guide is the first one in a series of guides we will add about Linux video programs. The program we will use is ManDVD, a frontend for many command line tools. Let me tell you beforehand that this program is simply amazing. The amount of the tasks it can achieve is enormous, the GUI is simple and the control you have over the DVD you are creating is almost perfect.

{mostip image=info}You can download ManDVD for various Linux distributions from here. It needs quite a few programs and depends in many KDE libs so downloading a deb or rpm is preferred over compiling the source. For your information I am running Ubuntu in the PC I used for the guide.

Step1
ManDVD01

When you open ManDVD you will see this screen. Here you should first of all set the Destination folder (1). Make sure it has at least 5GB of free space. Then you should select between PAL and NTSC and set the resolution (better use the default 720 one) (2) or open a saved project file (3). Finally click Confirm to start using the program.


Step2
ManDVD02

This is the main manDVD window. The first step is to add your files. Obviously selecting "Add a video to your project" (1) will allow you to select a file to add to the DVD. The Add file dialog is explained below. Looking at the other options (2) - "Modify title" changes the video's title for the menu and "Remove selected video" removes it from the project. The "Create a slide show" is an amazing option that lets you add a slide show in the DVD among your videos. It will be further explained in a future guide.

Then we have the editing options (3). "Cut a part of this film" is pretty obvious that allows you to cut parts that you don't want from the file, "Define chapters" sets the chapters of the video (this is where the DVD player stops when you press "Next" in your controller), and "Subtitle management" allows you to add external subtitles to your film. Finally there is the "Video effects" option which allows you to apply some interesting effects like Delogo (remove a logo from a certain area of the video - for example a TV station logo from the corner) or denoise (that could improve video quality). You can also change the brightness of your video if you find it to be bad.

In the Other (4) section you can add an introduction video that will play before the menu and "Force reencode" of MPEG videos that ManDVD may think that are already DVD ready but generate problems.

When you are done with adding all your video you can click Next. See below for an explanation of the add file dialog before moving to the next step.
ManDVD03

This is the dialog you will see after selecting which file to add. First of all you should set a title (1) for this video. This title will show within ManDVD but in the DVD menu as well. Another cool option is the ability to add a button to the menu using an image from the video. (2) To do so select "Extract an image from the video". A small media player will start playing your video. Click the camera icon you can see in the bottom right corner when you find the image you want. Then it will be saved and loaded here as the button for that video. You can also "Edit with The Gimp" - if The Gimp is installed of course - in case you need to add some effects to it or put some text in there to make your menu look better.

Finally before clicking OK and adding the video you can add some delay to the video or the audio in case they don't match (3) (usually you won't have to use that option at all).


Step3
ManDVD04

In this step you can customize the DVD menu. Your first choice is the background (1). You can either add a picture, just a color or a video for an animated background. From my experienced a nice background image makes a good menu as adding a video makes it too messy while a simple color makes it look too poor. After adding an image you can change some simple settings (2) like rotating it or changing the colors. Next stop is the font settings (3). Here you can choose which font to use, its size as well as the color of the text by default, when selected and when clicked. Finally you can add a song as a background (4) and select if it will play once or loop for ever.

When you are done with... pimping your menu click Next and go to Step 4.


Step4
ManDVD05

Next comes the button placement. First you need to double click on the video you want to add to the menu (1). Note that if you generated an image button in Step 2 that image will appear, if not just a text with the title of the video. Next you should set the size of the button using the sliders (2) as well as its place using the other two sliders on the top and left side. When you are done placing your button select "Confirm button position" (3).
Each video in your project must have a menu entry, and then you can click Next and move to the next step.


Step5
ManDVD06

You are finally able to create your video. First of all you can set the Execution priority (3). Set it to full if you plan not to use the PC or just do light tasks, lower it if you want to use the PC normally (it takes more time though). Next select the video format (4) between 4/3 and 16/9. You may also want to have a look at the Options (5) even though the defaults work fine. The options window is explained below.
Now you can encode your video by selecting "Generate DVD structure" (1). This can take from a few minutes to a few hours depending on the length of your DVD and the speed of your computer.

{mostip image=info}Keep in mind that when you have a 64bit CPU, using an AMD64 distro can give you a huge performance gain. As I have both 32bit and 64bit versions of Ubuntu installed and an AMD Athlon64 X2 4200+ I did a small benchmark, encoding the same project (about 90 minutes of XviD) in both environments. The i386 platform took one hour and 5 minutes while in AMD64 I was finished in 40 minutes. Quite a huge difference if you encode videos often don't you think?

After the DVD is created you have a few extra options (2). First of all you should "Watch the result" to make sure everything is OK. Afterwards you can burn using ManDVD, move your project to burn it with K3b (if it is installed of course) or create an ISO image to burn later. Burning right away works fine so the rest options are there just to give you a choice, for example K3b offer much more options than ManDVD itself in burning. In the screen below I am burning my DVD using ManDVD:
ManDVD08
Finally here is the options window:

ManDVD07

These are some options you can change before encoding, most importantly the video bitrate. (1). 5000kb/s is a good default setting. Change it only if you want to fit more video than 2+ hours on the DVD. Next your can select some options for the subtitles (2). Something that you may need if you are using special characters in your subtitles is to change the charset to utf8 (for example for Greek or Kyrilic letters). Finally you can select if you want to deinterlace the video (use it if you see horizontal lines in the encoded video - in 99% of the cases you shouldn't need it though) and if the DVD player will display the menu or start playing the first video when the disc is loaded.

I hope that after reading the guide you feel as excited as I was when I first tried ManDVD. In case you need any help please use our new Linux forum to ask, just remember to add your distro info as well as the console output that you can see when you click "Show/hide console" when converting. Stay tuned for more Linux guides!

Thursday, August 13, 2009

Ubuntuzilla

On Maketecheasier I found this handy tutorial:

Have you ever feel frustrated when Mozilla releases a new build for their software (especially Firefox) and you are still stuck at the previous older version, simply because Ubuntu did not (and do not intend to) add the newer version of software packages to the repository?

The truth of fact is, Ubuntu does not update its repositories for newer version of software packages, with the exception of security fixes, until the next release of Ubuntu. For example, the default version of Firefox for Ubuntu Jaunty is Firefox 3.0 and it won’t be upgraded to Firefox 3.5 at least until Ubuntu 9.10. In most cases, especially when it comes to browsers and various Web application, it is always better to upgrade to the newest version due to the new features and security improvement. This is where Ubuntuzilla comes into play.

Ubuntuzilla is a python script that checks your system for Mozilla software (Firefox, Thunderbird, or Seamonkey) and update them to the latest version released from Mozilla server. It also comes with an update checker that periodically performs automatic checks and updates to keep your system up-to-date with possible changes in the Mozilla website and release servers.

Install Ubuntuzilla

Download the deb file to your desktop. (64-bit users go to this site and download the ubuntuzilla-x.x.x-0ubuntu1-amd64.deb package.)

Double click on the deb file to load the graphical installer. Click on the Install Package to install it in your system.

ubuntuzilla-install-deb

Running Ubuntuzilla

Once you have finished the installation, close all instance of your Firefox (if you are using Thunderbird or SeaMonkey, close them as well).

Open up a terminal (Applications -> Accessories -> Terminal) and type

ubuntuzilla.py

It will now prompt you a series of questions:

The first question is to ask if you want to upgrade to the latest version of Firefox. No doubt, the answer is ‘y‘.

ubuntuzilla-install-firefox

Next step is to choose the language for your Firefox.

ubuntuzilla-firefox-lang

It will then proceed to download and install the latest stable build of Firefox in your system.

At the end of the installation, it will ask you if you want to schedule a periodical check of the latest release of the software.

ubuntuzilla-schedule-check

Remove Firefox

For some reasons that you are not happy with the latest release of Firefox and wanted to switch back to the previous version, you can easily remove the latest build by running the following command in the terminal:

ubuntuzilla.py -a remove -p firefox

Firefox 3.0 will be restored in your system.

Sunday, August 2, 2009

DirSyncPro

Another file and directory synchronisation program that runs on every system with java is found here:

LINK

It's fast and seems to work OK.

Monday, July 27, 2009

mount a networkdrive in a save way

Arrow Map Windows Shares Permanently with GVFS

This tutorial is written bij NTolerance at
http://ubuntuforums.org/showthread.php?t=1186877

I copied the text for the case that that forum will be removed.

Concept


The file manager in MS Windows has a nice feature called "Map Network Drive". This allows you to permanently assign Samba shares to a drive letter which any program can access. It can be made persistent across reboots. This feature is tremendous when you have a Samba server on your network that has files you need to continuously access.

Applicable Systems

This guide will explain how to do the same using an up-to-date Ubuntu Intrepid or Jaunty. This guide will not work on Hardy unless this bugfix is backported to Hardy.

Comparison to Other Methods

There is an ages-old method which produces a similar result and involves editing /etc/fstab. I don't like this method for a number of reasons, such as the fact that it's difficult, it involves storing your Samba password in plain text, and it exposes a nasty bug that can cause your system to hang on shutdown.

Procedure

1. Select the "Network" option from the "Places" menu.

2. Select the "Windows Network" icon.

3. Select the workgroup that your share resides in.

4. Select the PC on your network that contains the share you want to access. You will now see an authentication prompt. Enter the correct username and password. IMPORTANT: Make sure to select the radio button that is labled "Remember forever". This will permanently save your password in the GNOME keyring.

6. Select the "Connect" option. You will now see a folder for each share that is available on the selected PC.

8. Select the folder you want to access. You will now see a prompt regarding the keyring. Select the "Always Allow" option. The share is now temporarily mounted (will not survive a reboot) and your password is permanently saved and accessible in the GNOME keyring.

9. The share should be visible in the "Places" menu on the left of the Nautilus file manager. Select the eject icon to the right of the share to unmount it.

10. Now we will test out a command which will go into a script. Open the Terminal from the "Accessories" submenu in the "Applications" menu.

11. Run this command in the Terminal while filling in the appropriate information within the <> symbols.
Code:
gvfs-mount smb:///
Example:
Code:
gvfs-mount smb://desktop/sharedfolder
The share should now be mounted again and will appear in the "Places" menu on the left side of the Nautilus file manager. Select the eject icon to the right of the share to unmount it.

12. Now we will put that command in a script to be executed during startup. In the Terminal, run this command to create the script:
Code:
gedit ~/sharemount.sh
If you'd like to change the path or the filename of the script, feel free to do so.

13. Paste this into the GEdit window while filling in the appropriate information into the <> symbols.
Code:
#!/bin/sh
gvfs-mount smb:///
Example:
Code:
#!/bin/sh
gvfs-mount smb://desktop/sharedfolder
14. Make the script executable by running this command in the Terminal:
Code:
chmod +x ~/sharemount.sh
15. Now let's add the script to GNOME startup. Choose the "Startup Applications" option from the "Preferences" submenu located in the "System" menu.

16. Select the "Add" option. Type a name of your choice in the "Name" field, browse to the path of the script in the "Command" field, and optionally add a comment to the "Comment" field. Press the "Add" button to save your settings.

17. Now log out and log back in or restart your PC. Check the "Places" menu and the shares should be automatically mounted.

Usage Notes

The shares are mounted using GVFS. From the GNOME GUI, shares are accessible via the "Places" menu in Nautilus and the smb:// path in the address bar. Command-line programs can access these shares via the ~/.gvfs path.

Uninstallation

If you'd like to remove these changes, follow the these two simple steps:

1. Choose the "Startup Applications" option from the "Preferences" submenu located in the "System" menu. Select the sharemount.sh script and press the "Remove" button.

2. Delete the script with the Terminal:
Code:
rm ~/sharemount.sh


I have a lot of links to my previous fstab mounts in various applications, so I decided to ease the transition by deleting the mount point folders (mine were in /mnt) and creating symbolic links to the hidden gvfs share directories:

Code:
sudo ln -s ~/.gvfs/'sharename on server' /mnt/sharename
Of course you could do the same thing in your home directory:

Code:
ln -s ~/.gvfs/'mp3s on server' ~/Music/shared
The next thing that I really need to verify is that files that I create on these shares are accessible to other users (I had to force 777 permissions on my NAS drives in fstab before).

Wednesday, July 8, 2009

Some interesting tutorials

1) best samba server howto
2) mount windows/samba shares with CIFS + unicode
3) best FTP server howto
4) NFS server/client howto
5) Easy cross-platform LAN file sharing with FTP
6) Fix samba browsing!!!
7) Fix Pulse audio

Friday, July 3, 2009

Install Firefox 3.5 in Jaunty or Linux Mint 7

Installing outside of a package manager

Complete instructions for installing Firefox outside of package management may be available at your distribution's support website.


Before you install Firefox, make sure that your computer has the required libraries installed. Missing libraries will cause Firefox to be inoperable.


The following instructions will install Firefox into your home directory, and only the current user will be able to run it.

  1. Download Firefox from the Firefox download page to your home directory.
  2. Open a Terminal and extract the contents of the downloaded file.
    cd ~
    tar xjf firefox-*.tar.bz2
  3. Close Firefox if it's open.
  4. To start Firefox, run the firefox script in the firefox folder.
    ~/firefox/firefox

Firefox should now start. You can then create an icon on your desktop to run this command.



In dutch:


De volgende instructies zullen Firefox in uw thuismap installeren, en alleen de huidige gebruiker zal het kunnen uitvoeren.
  1. Download Firefox van de Firefox-downloadpagina naar uw thuismap.
  2. Open een Terminal en pak de inhoud van het gedownloade bestand uit.
    cd ~
    tar xjf firefox-*.tar.bz2
  3. Sluit Firefox af als het is geopend.
  4. Voer het script firefox in de map firefox uit om Firefox te starten.
    ~/firefox/firefox

Firefox zou nu moeten starten. Daarna kunt u een pictogram op uw bureaublad aanmaken om dit commando uit te voeren.

bericht “firefox niet geïnstalleerd” of verkeerde versie van Firefox start op

U moet Firefox starten met het commando

~/firefox/firefox
Als u Firefox probeert te starten met het commando
firefox
zal dit de versie starten die door de pakketbeheerder is geïnstalleerd, of u vertellen dat het programma niet is geïnstalleerd.

Monday, June 29, 2009

Commercial NTFS driver for Linux for free

On the site of paragon they offer their proprietary linux NTFS driver for free. Download it here.
Nota that this software is developed using reverse engenering, and without any help of Microsoft.

Saturday, June 27, 2009

Linux as a Bastion host

On cybercity I found an interesting article on how to make a dedicated linux box as a bastion host (super firewall) for your entire network.

read all about it here.

Here is the text for the case the above link wouldn't work.

Configure Linux As Bastion Host

What is bastion host? How do I configure bastion host under Linux? How do I create a firewall for a bastion host under any Linux distribution?

A bastion host is high risk host on your network. It can be a dedicated Linux running netfilter or OpenBSD box running PF or a Cicso PIX device. This device is designed to protect your network from external threats.

The Internet
\\
\\
Bastion Host
//
//
Your Network

Usually bastion host placed outside your corporate firewall or in the DMZ itself.

The Internet
\\
+---------------+
| Bastion Host | <--- Outside firewall +---------------+ // +---------------+ | DMZ | <---- Inside firewall +---------------+ \\ || +---------------+ | LAN1 LAN2 | +---------------+

In most cases it has access from the Internet or untrusted parties / computers. In some case a bastion host can be a:

  1. Web server
  2. DNS Server
  3. FTP Server
  4. Proxy Server
  5. Honey pots
  6. Email Server etc
WARNING! These examples needs a dedicated Linux box.You MUST know how to install programs on your computer, how to navigate file system, list open ports, configure iptables, write a firewall script and other advanced admin tasks.

Bastion Host and Screened Subnet

Bastion host adds an extra layer of security to the screened host architecture. It isolate your internal network form the Internet. The end result is that your bastion host is the primary target of Internet attacks. If someone beaks into the bastion host, your internal hosts are safe as the bastion host is isolated by the perimeter network. The bastion host firewall configuration has more security. Usually following is done on bastion hosts:

  1. Firewall works in close all ports and opened required port mode only.
  2. Intrusion detection system (IDS/IPS) such as as snort.
  3. Security settings to avoid Denial of Service (DoS), spoofing, and flood attacks.
  4. Undergo regular auditing.
  5. Runs upto date software.
  6. May run special kernel security patches.
  7. All user accounts are locked down except admin account.
  8. Encryption used for logging (ssh) or disk storage.
  9. Remove all end user software and other network servers such as Apache, MySQL and so on.
  10. TCP/IP stack tuned for network traffic including network buffers.
  11. /etc/sysctl.conf customized to improve server security

Usually, the bastion host does act as proxy server. It allows and denies connection as created by your security policy.

How Do I Build Linux As a Bastion Host?

A Linux based bastion host can be build using the following steps:

  1. Grab Debian / CentOS CD or your favorite Linux distribution.
  2. Install minimum operating system. Avoid installing desktop software or other apps such as MySQL, Apache and other software.
  3. Reboot the server.
  4. Patch server.
  5. Install grsecurity kernel patch and reboot the system.
  6. Install additional software such as snort IDS and configure it.
  7. Install Advanced Intrusion Detection Environment (AIDE) Software.
  8. Make sure all security patches are installed.
  9. Disable all network services except ssh.
  10. Disable all other daemons.
  11. Network tuning vis sysctl.conf
  12. Configure firewall (see sample script below).
  13. Remove centralized authentication such as LDAP.
  14. Remove as many utilities and system configuration tools as is practical for your setup. No need to have gcc compilers and other unwanted tools. Use rpm/yum and dpkg command to list all packages.
  15. Logging of all security related events and turn on auditing.
  16. Write protect all log files and only allow them in append only mode using chattr command (e.g. chattr +a /var/log/messages or chattr +i /etc/shadow).
  17. Encrypt all database passwords including file systems if possible.
  18. Create system recovery DVD or tape.

Above all are generic and recommended steps to configure bastion host.

Sample Linux Iptables Bastion Host Rules

You need at least two network interface one is connected to the Internet via public IP and another private to your Lan.

#!/bin/sh
# The bastion host firewall for bhost.lan.nixcraft.net.in
# The bastion host is also:
# (a) Mail server to relay mail to postfix.lan.nixcraft.net.in
# (b) DNS server send zone trasfer to ns1.lan.nixcraft.net.in and ns2.lan.nixcraft.net.in
# (c) Allow incoming ssh / http / https to bhost.lan.nixcraft.net.in from LAN SUBNET sothat
# we can manage bhost.lan.nixcraft.net.in via ssh, and read snort stats via ACID web interface.
#---------------------------------------------------------------------------------------------------
### Set vars ###
IPT=/sbin/iptables
SYSCTL=/sbin/sysctl
### Set interfaces ###
EXT_IF="eth0" # The Internet
LAN_IF="eth1" # Lan
LOOP_BACK="lo"

### Block RFC 1918 private address space range ###
### Block reserved Class D and E IP ###
### Block the unallocated address range et all ###
SPOOFDIP="127.0.0.0/8 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8 169.254.0.0/16 0.0.0.0/8 240.0.0.0/4 255.255.255.255/32 168.254.0.0/16 224.0.0.0/4 240.0.0.0/5 248.0.0.0/5 192.0.2.0/24"

### Set Lan Subnet ###
LAN_SUBNET="192.169.1.0/24"

### Set DNS Server IPs ###
NS1_SERVER_IP=192.168.1.130
NS2_SERVER_IP=192.168.1.131

### Set Postfix Server IP ###
SMTP_SERVER_IP=192.168.1.132

### Set port numbers ###
SSH_PORT=22
SMTP_PORT=25
HTTP_PORT=80
HTTPS_PORT=443
DNS_PORT=53

### Clean out old fw ###
$IPT -F
$IPT -X
$IPT -t nat -F
$IPT -t nat -X
$IPT -t mangle -F
$IPT -t mangle -X
$IPT -P INPUT ACCEPT
$IPT -P OUTPUT ACCEPT
$IPT -P FORWARD ACCEPT

### Turn on SYN flooding protection ###
$SYSCTL -w net/ipv4/tcp_syncookies=1

### Block out eveything ###
$IPT -P INPUT DROP
$IPT -P OUTPUT DROP
$IPT -P FORWARD DROP

### Allow full access to loopback ###
$IPT -A INPUT -i ${LOOP_BACK} -j ACCEPT
$IPT -A OUTPUT -o ${LOOP_BACK} -j ACCEPT

### Block the RFC 1918 private address space ranges ###
for rfc in $SPOOFDIP
do
$IPT -A INPUT -i ${EXT_IF} -s ${rfc} -j LOG --log-prefix " SPOOF DROP "
$IPT -A INPUT -i ${EXT_IF} -s ${rfc} -j DROP
done

### Drop bad stuff ###
$IPT -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
$IPT -A INPUT -p tcp --tcp-flags SYN,FIN,PSH SYN,FIN,PSH -j DROP
$IPT -A INPUT -p tcp --tcp-flags SYN,FIN,RST SYN,FIN,RST -j DROP
$IPT -A INPUT -p tcp --tcp-flags SYN,FIN,RST,PSH SYN,FIN,RST,PSH -j DROP
# FIN-Only
$IPT -A INPUT -p tcp --tcp-flags FIN FIN -j DROP
$IPT -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
$IPT -A INPUT -p tcp --tcp-flags ALL SYN -j DROP
$IPT -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
$IPT -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP

# FIN
$IPT -A INPUT -p tcp --tcp-flags FIN,ACK FIN -j DROP

# NULL packets
$IPT -A INPUT -p tcp --tcp-flags ALL NONE -j DROP

# XMAS
$IPT -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP

# Fragments
$IPT -A INPUT -f -j DROP

# sync
$IPT -A INPUT -p tcp ! --syn -m state --state NEW -j DROP

### Allows the bastion host to query remote DNS servers ###
$IPT -A INPUT -i ${EXT_IF} -p udp --dport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A INPUT -i ${EXT_IF} -p tcp --dport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${EXT_IF} -p udp --sport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${EXT_IF} -p tcp --sport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT

### Allow internal DNS i.e. zone trasfer between the bastion and 2 LAN ns1 & ns2 ###
$IPT -A INPUT -i ${EXT_IF} -p udp -s ${NS1_SERVER_IP} --dport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A INPUT -i ${EXT_IF} -p udp -s ${NS2_SERVER_IP} --dport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A INPUT -i ${EXT_IF} -p tcp -s ${NS1_SERVER_IP} --dport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A INPUT -i ${EXT_IF} -p tcp -s ${NS2_SERVER_IP} --dport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT

### Allow outgoing DNS and Zone transfers btw the bastion host and two 2 LAN ns1 & ns2 ###
$IPT -A OUTPUT -o ${EXT_IF} -p udp -d ${NS1_SERVER_IP} --sport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${EXT_IF} -p udp -d ${NS2_SERVER_IP} --sport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${EXT_IF} -p tcp -d ${NS1_SERVER_IP} --sport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${EXT_IF} -p tcp -d ${NS2_SERVER_IP} --sport ${DNS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT

### Allow LAN workstation to get into the bastion host via SSH but no access from the Internet ###
$IPT -A INPUT -i ${LAN_IF} -p tcp -s ${LAN_SUBNET} --dport ${SSH_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${LAN_IF} -p tcp -d ${LAN_SUBNET} --sport ${SSH_PORT} -m state --state ESTABLISHED -j ACCEPT

### Allow LAN workstation to get into the bastion host via HTTP to read SNORT stuff via web interface but no access from the Internet ###
### Read ACID stats ###
$IPT -A INPUT -i ${LAN_IF} -p tcp -s ${LAN_SUBNET} --dport ${HTTP_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${LAN_IF} -p tcp -d ${LAN_SUBNET} --sport ${HTTP_PORT} -m state --state ESTABLISHED -j ACCEPT
$IPT -A INPUT -i ${LAN_IF} -p tcp -s ${LAN_SUBNET} --dport ${HTTPS_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${LAN_IF} -p tcp -d ${LAN_SUBNET} --sport ${HTTPS_PORT} -m state --state ESTABLISHED -j ACCEPT

### External SMTP Rules ###
$IPT -A INPUT -i ${EXT_IF} -p tcp --dport ${SMTP_PORT} -m state --state NEW,ESTABLISHED - j ACCEPT
$IPT -A OUTPUT -o ${EXT_IF} -p tcp --sport ${SMTP_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT

### Internal SMTP Rules ###
$IPT -A INPUT -i ${LAN_IF} -p tcp -s ${SMTP_SERVER_IP} --sport ${SMTP_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -o ${LAN_IF} -p tcp -d ${SMTP_SERVER_IP} --dport ${SMTP_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT

### Add your other rules below ###

### End no editing below ###

### Log ###
$IPT -A INPUT -m state --state INVALID -j LOG --log-prefix " INVAID DROP "
$IPT -A INPUT -m state --state INVALID -j DROP

$IPT -A INPUT -i ${EXT_IF} -j LOG --log-prefix " INPUT DROP "
$IPT -A OUTPUT -o ${EXT_IF} -j LOG --log-prefix " OUTPUT DROP "

Above script is basic and can be modified as per your requirements. You can also use firewall distributions such as pFsense or IPcop to automate lost of stuff.

Fig.01: pFsense in Action

Fig.01: pFsense in Action (click to enlarge)

References:

  1. Thinking about firewalls
  2. An overview of network Firewall
  3. Linux DMZ tutorial using iptables
  4. Snort - A free lightweight network intrusion detection system for UNIX and Windows.
  5. Refer your Linux distribution documentations to perform required steps.
  6. man page sysctl, and iptables

Sunday, June 14, 2009

Open Virtual Desktop

Although not a ubuntu issue, I found an interesting project at Ulteo.com. The Open Virtual Desktop. Their main website and downloads are found on this site.

There is another program that allows you to run linux applications in windows. It's calles Andlinux and is based on CoLinux. An article about is is found here. The direct download site here.