Monday, November 28, 2011

Openwrt for x86 - part 2

This section requires knowledge of bash. Please get a professional to help if you are unsure.
The root partition of the official x86 OpenWrt image is not very big, about 50 MiB.  Many find it too small after installing a few add-on packages.  Here I will cover the steps to expand it.  The resultant image can be used in a live USB (see Easy Live USB for x86 OpenWRT) or copied to a hard disk.

Procedure Outline

  1. Get an uncompressed disk image.
  2. Pad image to desired size
  3. Attach the image file to a loop device
  4. Edit image partition table to enlarge the root partition
  5. Resize the file system in root partition
  6. Detach the image from the loop device.
All commands below are run in Bash.

Uncompress Image File

Use whichever method you like to download an image file from OpenWrt (http://downloads.openwrt.org) and uncompress it using gzip.  For example, these two commands download and uncompress the 10.03.1-rc6 disk image.
bash$ wget --quiet http://downloads.openwrt.org/backfire/10.03.1-rc6/x86_generic/openwrt-x86-generic-combined-ext2.img.gz
bash$ gunzip openwrt-x86-generic-combined-ext2.img.gz
Alternative, you can just copy an image file from a live USB flash drive.  This will save you the trouble of restoring custom configurations.

Pad Disk Image

The next step is to use “dd” to increase the size of the disk image.
bash$ dd if=/dev/zero bs=1M count=50 >> openwrt-x86-generic-combined-ext2.img
This command appends 50 MiB of zeros to the end of the disk image:  “if=/dev/zero” tells dd to copy data from /dev/zero; “bs=1M” sets the block size to 1 MiB (1024*1024 bytes); “count=50” tells dd to copy 50 blocks.

Attach to Loop Device

Note:  All commands from this point to the end need to be run by a user with root privilege.
These commands find an unused loop device and attach it to the image file.
bash$ loop_dev=`losetup -f`
bash$ echo $loop_dev
/dev/loop3
bash$ losetup $loop_dev openwrt-x86-generic-combined-ext2.img
The first command uses “losetup -f” to find an unused device and stores the result in the shell variable loop_dev.  The “echo” command shows the device found.  Finally “losetup” attaches the device to the disk image.

Edit Partition Table

To expand a disk partition, it needs to be deleted first.  A new, larger partition is then created to take its place.  This new partition must start from the same sector as the old to prevent loss of data.
fdisk is used to manipulate the disk partition table.
bash$ fdisk -u=sectors -c=dos $loop_dev
The -u option asks fdisk to list partitions in sectors.  The -c option tells fdisk to operate in DOS compatibility mode.  $loop_dev is the loop device attached to the image file.
To see the existing partitions, type “p” at the fdisk prompt.
Command (m for help): p

Disk /dev/loop3: 107 MB, 107437568 bytes
16 heads, 63 sectors/track, 208 cylinders, total 209839 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

      Device Boot      Start         End      Blocks   Id  System
/dev/loop3p1   *          63        9071        4504+  83  Linux
/dev/loop3p2            9135      107855       49360+  83  Linux
fdisk shows /dev/loop3 has 209839 sectors.  It also lists two partitions.  The first one, /dev/loop3p1, is a small boot partition.  The second, /dev/loop3p2, is the root partition.  The root partition starts from sector 9135.  Make a note of this number.
Now delete the root partition and create a new one that covers all available space.
Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 2): 2
First sector (9072-209838, default 9072): 9135
Last sector, +sectors or +size{K,M,G} (9135-209838, default 209838): 209838

Command (m for help): w
The partition table has been altered!

The “d” command asks fdisk to delete a partition, and “2” selects the
 second partition for deletion.  The “n” command asks fdisk to create a
new partition.  “p” specifies a primary partition, and “2” selects the
second primary partition.  The first sector of this partition is sector
9135, same as the deleted partition.  Its last sector is sector 209838,
the default choice.  This is also the last sector on /dev/loop3. 
Finally, the “w” command writes the new partition table through
/dev/loop3 to the disk image.

Resize Root File System

The following commands will expand the root file system to the size of the root partition.
bash$ kpartx -a $loop_dev
/dev/mapper/loop3p1: mknod for loop3p1 failed: File exists
The “kpartx -a” command creates device nodes for the partitions in the disk image.  The output of “kpartx –a” (“mknod for loop3p1 failed”) seems to be a bug in my system.  As far as I can tell, the creation and deletion of loop3p1 occur normally.
Another thing worth noting:  kpartx and fdisk use different naming conventions.  kpartx uses “/dev/mapper/device_name”, for example ”/dev/mapper/loop3p1″.  fdisk uses “/dev/device_name”, such as “/dev/loop3p1″.  This is because kpartx works with the device mapper.
Now run “fsck” to check the file system before resizing it.  In fact, some file systems can’t be resized until they are checked.
bash$ fsck -f /dev/mapper/loop3p2
fsck from util-linux 2.19.1
e2fsck 1.41.14 (22-Dec-2010)
Filesystem did not have a UUID; generating one.

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/mapper/loop3p2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/mapper/loop3p2: 957/6000 files (0.2% non-contiguous), 8173/49152 blocks
The “-f” option forces a run even when the file system seems clean.
Finally, resize the root file system.
bash$ resize2fs /dev/mapper/loop3p2
resize2fs 1.41.14 (22-Dec-2010)
Resizing the filesystem on /dev/mapper/loop3p2 to 100352 (1k) blocks.
The filesystem on /dev/mapper/loop3p2 is now 100352 blocks long.

bash$ kpartx -d $loop_dev
After resizing, “kpartx -d” reverses the changes made by “kpartx -a”.

Detach From Loop Device

The final step is to detach the image file from the loop device.
bash$ losetup –d $loop_dev

That’s it.  The disk image is now ready to be used in a live USB or copied to a hard disk.

From: http://macbruins.wordpress.com
After creating my OpenWRT live USB (Easy Live USB for x86 OpenWRT), I wanted to use it on an older PC but ran into a problem:  its BIOS does not support booting from USB.  I had two choices.  One was to boot up Linux from CD then switching to USB drive.  The other was to get a CD bootloader that can read USB drives.  Not wanting to do more work, I went searching and found Plop Boot Manager.  It is very impress.  Compact but full of features.  It handles multiboot.  It works with many bootloaders.  It can boot OS on USB or CD without BIOS support.  It even has a great GUI reminiscent of video arcade games.  And it’s free.  Do take a look.
But if you just want to get down to business, I have a ready-to-use CD image (plpbt_hiddenusb.iso on my SkyDrive).  Just insert  the CD and plug in your USB drive.  Plop Boot Manager will do the rest.

Saturday, November 26, 2011

Openwrt for x86 - part 1

Installing OpenWrt x86

This is a great project to put an old pc back to work. Openwrt is a cousin so to speak of DD-WRT that  is installed on many brand name routers to increase their capabilities. Openwrt will also allow a pc to act as an expensive router without the big price tag. Of course, you could easy use some of the router distros such as ipcop and many others (see http://en.wikipedia.org/wiki/List_of_router_or_firewall_distributions). openwrt is so much more upgradeable and expandable.

Did this with the original image on a pentium2 and it worked well. If you want the gui, you may need to install the web add-on.

Installing OpenWrt x86 on a PC. (Try this at your own risk!!!)

Requirements:
An X86 compatible pc (i386) or greater with at least 16MB of RAM, 2 network cards, and a hard drive. With newer versions of openwrt require higher hardware requirements. Check openwrt.org for more details.

OpenWrt binary file, for x86.
Old:
http://downloads.openwrt.org/kamikaze/8.09.2/x86/openwrt-x86-ext2.image
Newer:
http://downloads.openwrt.org/snapshots/trunk/x86/openwrt-x86-generic-combined-ext4.img.gz (need to gunzip first) to openwrt-x86-generic-combined-ext4.img
($ gunzip openwrt-x86-generic-combined-ext4.img.gz)

Installation:

For M$ Windows, please also get physdiskwrite. [http://m0n0.ch/wall/physdiskwrite.php]

For Linux just use dd.
Grab the latest binary code from OpenWrt download site.
dd if=openwrt-x86-2.6-ext2.image of=/dev/hda (where hda and image name must be changed)
or
dd if=openwrt-x86-2.6-ext2.image of=/dev/sda (where hda and image name must be changed)

Coming soon: Installing openwrt on usb to make it portable.
----------------------------------------------------------------------------------------------------------------------
Appendices: 

Howto get OpenWrt up and running with a web interface given the base image is running.
Edit the network configuration '/etc/config/network' (this assumes a static IPv4 address):
# Copyright (C) 2006 OpenWrt.org

config interface loopback
        option ifname   lo
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0

config interface lan
        option ifname   eth0
        option type     bridge
        option proto    static
        option ipaddr   192.168.0.126
        option netmask  255.255.255.0
        option gateway 192.168.0.254
option dns 192.168.0.16 192.168.0.2
Load the updated lan network configuration
# ifup lan
Edit /etc/ipkg.conf. Add the last line (bold)
(use the version for your openwrt. Latest version is 8.x)
src release http://downloads.openwrt.org/kamikaze/7.09/x86-2.6/packages
src packages http://downloads.openwrt.org/kamikaze/packages/i386
dest root /
dest ram /tmp
src X-WRT http://downloads.x-wrt.org/xwrt/kamikaze/7.09/x86-2.6/packages 
(use the version for your openwrt. Latest version is 8.x)
 Update and install webif
root@OpenWrt:~# ipkg update
root@OpenWrt:~# ipkg install webif
Update
 # ipkg update
Downloading http://downloads.openwrt.org/kamikaze/7.09/x86-2.6/packages/Packages
Updated list of available packages in /usr/lib/ipkg/lists/release
Downloading http://downloads.openwrt.org/kamikaze/packages/i386/Packages
Updated list of available packages in /usr/lib/ipkg/lists/packages
Downloading http://downloads.x-wrt.org/xwrt/kamikaze/7.09/x86-2.6/packages/Packages
Updated list of available packages in /usr/lib/ipkg/lists/X-WRT
Done.

Install webif

# ipkg install webif
Installing webif (0.3-12) to root...
Downloading http://downloads.x-wrt.org/xwrt/kamikaze/7.09/x86-2.6/packages/./webif_0.3-12_i386.ipk
Installing haserl (0.8.0-2) to root...
Downloading http://downloads.x-wrt.org/xwrt/kamikaze/7.09/x86-2.6/packages/./haserl_0.8.0-2_i386.ipk
Configuring haserl
Configuring webif
Linux OpenWrt 2.6.22 #2 Sun Sep 30 21:02:32 CEST 2007 i586 unknown
Committing new firmware id ...
Device: PC Engines WRAP
Committing new device id ...
SUCCESS! Webif^2 installation appears OK. Welcome to X-Wrt!
You may need to do a hard REFRESH to clear old CSS style from your browser.
Reinitializing httpd ...
Done.

Wednesday, November 23, 2011

Thank you for visiting us.

Happy holidays and thank you for visiting us.

Breakdown by area:


Breakdown by operating system.



Monday, November 21, 2011

Get your mac back, Jack!

VMware Fusion users can now install Leopard, Snow Leopard in VMs!! as per:

http://arstechnica.com/apple/news/2011/11/vmware-fusion-users-can-now-install-leopard-snow-leopard-in-vms.ars?utm_source=rss&utm_medium=rss&utm_campaign=rss



The new file cabinet.

The new file cabinet or what is called network-attached storage (aka nas) is very useful for a business. Network-attached storage is a computer(s) that are dedicated to acting like an external hard drive for your computer network. Not that you could not share files from your local machine, the nas allows more than one person access under certain rules load and save files to the unit. It is basically a computer dedicated to serving out files. Just a new name or buzz word for a traditional file server. Nas units are generally oriented to the home or small business where management or administration of the file server is or can be reduced.

You can get a nas in what is called a turnkey package off the shelf from your local electronics store. Generally you might pay a premium for such a setup. But then you know it should be supported well from the manufacturer. Hewlett Packard is a prime example of those units. Now everyone under the sun is selling some sort of system billing themselves as a nas unit. Not saying that is bad, but you do need to compare the features.

Could you use a spare machine to do the same thing? You certainly can. In fact, using a spare machine can save you money and maybe even time. There are a lot of commercial packages you can purchase to get the job done. Any brick and mortar computer store can tell you what they recommend. Being a supporter of open source, I would recommend using linux , but if you are not familiar with Linux that can as much work as some of the commercial solutions (unless your an IT specialist).



What do I use? Definitely use linux as you can add many other services that the traditional nas may or may not offer. What i like is something call FreeNAS. It is based on FreeBSD and is a cousin sort of to linux. Even the Apple osx is based loosely on BSD. As in the name it is free, so there is no shelling out of hundreds of dollars to make a pc a file cabinet (unless you want to contribute to the project). You can find FreeNAS at http://www.freenas.org/.

What is so great about FreeNAS? They have two versions, one for newer computers (version 8) and the also have a version for legacy computers (version 7). It can be set up in minutes by a knowledgeable user. It can even be run from a cdrom or even a simple thumb drive. You could easily turn an existing machine into a nas. I think I set up mine in a total of ten minutes. Another advantage is that you can use already existing drives without reformatting them. For example, we took a drive from an old Microsoft windows machine with lots of files and plugged it in (with the machine turned off)  and FreeNAS was able to immediately recognize the drive and immediately put to use the existing files so they could be shared on the network.

Now if you want more advanced features (such as a commercial nas may offer) of a nas such as a raid (redundant array of independent disks), you will need to use drives that can be erased or wiped. So you would need to back up the MSWindows formatted drive we used first. Raid depending on what level you use can allow you to replace a failed drive on the fly and the system will repair it self.

In recent years, FreeNAS has added other feathers such as a web server, the ability to support iscsi (independent small computer system interface) devices, and many other features. FreeNAS is more than a one trick pony.  More on that at a later time. The main advantage of FreeNAS, I like is that you can manage it remotely via a web interface. All a simple point and clicky type environment.

Only you can decide what file cabinet is best for you, but FreeNAS should be included in your decision making process.  


Sunday, November 20, 2011

Business data using spreadsheets.

Statistics can be very important especially for a business. I like to know how the instructables are dong. Which are the top viewers, so it gives me an idea of what project to do next and trending of views over time. You can do the same thing with the products you may or may not want to keep in inventory. If it does not sell why keep it on hand. Though the instructables do not cost me anything, I have on occasion deleted what I thought was a dead instructable. Lost a few views, but it overall gives a better picture. (Have a program that gets all the data from the site, so the figures do not have to be typed in manually.)









What's in your wallet (i mean computer)?



What happens when computer people get together much like old car talk. What's in you machine? You want to say more than I don's know. The newest devices such as the touchpads, some netbooks, and etc. today are pretty much unfortunately throwaways. As for desktop computers,  at least for a while you can upgrade them. It is very useful to know what equipment and and in some cases what software is on the inside. For insurance purposes, you would be well advised to have such a list tucked away in a safe deposit box or where ever. So I went on a little research expedition to find out what might be used to find out what is in my computer.

OS/X: (textedit to view)
You can go to the system profiler and output a text list of the hardware.
More info at: http://www.intego.com/services/systemProfiler.html and
http://macosx.com/forums/howto-faqs/26204-howto-list-your-installed-applications.html

Microsoft windows: (notepad to view)
A script for older systems: http://richardspowershellblog.wordpress.com/2007/07/21/hardware-reporting-script-vbscript-and-powershell-versions/
For MSWindows 7, I am told you can use the Devcon utility to print out to a file of the hardware. More information at:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544746%28v=vs.85%29.aspxhttp://superuser.com/questions/278035/windows-7-device-manager-in-text-mode
Software list:  http://answers.microsoft.com/en-us/windows/forum/windows_vista-windows_programs/savingprinting-installed-programs-list/3f4a5253-d362-4765-a673-a4d552a67e7d


Debian based Linux: ([g or k]edit to view) (Other linux systems would be similar)
Wrote a batch file to get the information and save it to a file. A lot of the lines are commented out that would probably be used only for debugging. Additional files may have to be installed. Uncommenting those lines will create a humongous file.

usage: sudo ./hwinfo2file.sh filename


$ sudo ./hwinfo2file.sh My_desktop_computer_info
=================================
oesrvr104
getting stats and saving as My_desktop_computer_info.txt.
No LSB modules are available.
$ _

Cut and paste what is between the [code][/code] lines into a text file and then
$ chmod +x hwinfo2file.sh

hwinfo2file.sh
[code]
echo "================================="
cat /etc/hostname
echo "getting stats"
file=$1.txt
# file="system.txt"
echo " " > $file
echo "=====================================" >> $file
echo  get computername >> $file
cat /etc/hostname >> $file
echo "=====================================" >> $file
echo  get current ip connections >> $file
sudo ifconfig >> $file
echo "-------------------------------------" >> $file
echo  get linux version >> $file
lsb_release -a >> $file
echo "-------------------------------------" >> $file
echo  get memory specs >> $file
free >> $file
echo "-------------------------------------" >> $file
echo  get file storage statistics >> $file
df -h >> $file
echo "-------------------------------------" >> $file
echo  get mounted file system list >> $file
cat /etc/fstab >> $file
echo "-------------------------------------" >> $file
echo  get pci specs >> $file
sudo lspci >> $file
echo "-------------------------------------" >> $file
echo  get loaded modules >> $file
sudo lsmod >> $file
echo "-------------------------------------" >> $file
echo  get current usb attachments. >> $file
sudo lsusb >> $file
echo "-------------------------------------" >> $file
echo get repos >> $file
cat /etc/apt/sources.list >> $file
# echo "-------------------------------------" >> $file
# echo  get installed software >> $file
# sudo dpkg --get-selections >> $file
# echo "-------------------------------------" >> $file
# echo  get hardware info >> $file
# sudo lshw >> $file
# echo "-------------------------------------" >> $file
# echo  get scsi devices >> $file
# sudo lsscsi >> $file
echo "-------------------------------------" >> $file
echo  display /etc/issue >> $file
cat /etc/issue >> $file
# echo "-------------------------------------" >> $file
# echo  get boot up info >> $file
# dmesg >> $file
echo "-------------------------------------" >> $file
echo  get users >> $file
cat /etc/passwd >> $file
echo "-------------------------------------" >> $file
echo  get current users on system >> $file
who >> $file
# echo "-------------------------------------" >> $file
# echo  get system messages >> $file
# cat /var/log/messages >> $file
# echo "-------------------------------------" >> $file
# echo  get rootkit checker log >> $file
# cat /var/log/rkhunter.log >> $file
# echo "-------------------------------------" >> $file
# echo  get syslog >> $file
# cat /var/log/syslog >> $file
echo "-------------------------------------" >> $file
echo  get scheduled events >> $file
cat /etc/anacrontab >> $file
cat /etc/crontab >> $file
[/code]

Friday, November 18, 2011

Using a simple Google API.

Preface: There is a computer programming language that is oriented towards new developers. That language is called Python. It is available for most every platform. (i.e. MSWindows, OS/X, BSD,. Linux and etc.  Though there are no fancy graphics in what was done in this project, you could surely add that feature. Just wanted to show a bare bones project that anyone could use to start with.

One of the reasons I like to do page scraping is to get the data I need without having to take time to use a web browser such as Firefox and or a newsreader to get the specific data I need. Letting the computer get the data for me and making a summary file of the data I need is therefore letting the computer be my secretary and or research assistant.
Have been doing some page scraping, but i was not able to get the weather from their (Google) site. Then read they have it sort of hidden. Was able to get a page of the xml they use to show the data. Aha!   Then found a short piece of code of how to use the api.

The xml shorted version (using http://www.google.com//ig/api?weather=huntsville) :

<xml_api_reply version="1">
...
<forecast_information>
<city data="Huntsville, AL"/>
<postal_code data="huntsville"/>
<latitude_e6 data=""/>
<longitude_e6 data=""/>
<forecast_date data="2011-11-18"/>
<current_date_time data="2011-11-18 21:50:00 +0000"/>
<unit_system data="US"/>
</forecast_information>

<current_conditions>
<condition data="Clear"/>
<temp_f data="55"/>
<temp_c data="13"/>
<humidity data="Humidity: 29%"/>
<icon data="/ig/images/weather/sunny.gif"/>
<wind_condition data="Wind: SE at 8 mph"/>
</current_conditions>
...
</xml_api_reply>

So then it was a matter of just plugging in variables. Almost cut and paste. Anything in single quotes was extracted from the xml sort of.  I also make it so that you did not have to redo the code of a different location. This also could be done in a gui environment, but for simplicities sake that part was not included.

weather.py:
[code]
import sys
import  pywapi
import string

google_result = pywapi.get_weather_from_google(sys.argv[1])

print "\nThe weather report for " + sys.argv[1] + "  on " + google_result['forecast_information']['current_date_time'] + " in: " +  google_result['forecast_information']['city'] + " \n"


print "Sky condition: " + string.lower(google_result['current_conditions']['condition'])
print "Temperature: " + google_result['current_conditions']['temp_f'] + "F"

print google_result['current_conditions']['humidity']

print google_result['current_conditions']['wind_condition']
[/code]

usage: python weather.py zipcode or python weather.py "city state"

$ python weather.py 10001

The weather report for 10001  on 2011-11-18 21:51:00 +0000 in: New York, NY

Sky condition: clear
Temperature: 44F
Humidity: 37%
Wind: N at 0 mph


$ _

Note: I had to install the pywapi
$ sudo apt-get pywapi

This was a lot easier than page scraping. Anyway enjoy.

Thursday, November 17, 2011

Screen resolution update


This is probably a better look at the change in resolution. I did a text scrape of a spreadsheet I wrote.

Before:



 After:

 

A bit bigger(or smaller as the case may be).....

Linux screen resolution

Note: This also works for the graphics mode.


Do this at your own risk as I will not be responsible for any issues:

One of the biggest complaints I get is the text screen is too small. I generally agree. More recent computers actually have the ability to use a higher resolution, but do not take advantage of it in the default mode. This article is for more advanced users. Please get help before starting this project if you are at least the little bit. unsure.

You will need to have the documentation for both your video card and for your monitor. You will see numbers like 640x48 800x600 1024x768. Take those numbers and use the lower of the two from the video card and the monitor settings. If you can only use 640x400 then stop here. The 640x400 is the default. There is a 320x200, but I have not see that in years,

In my case the highest resolution for the monitor was 800x600. Still a boost over the default 640x400 screen.

Lastly you need to find out what your linux system uses to boot, Lilo(we will not consider it), Grub (aka Grub1) or Grub 2.

For our purposes we will be using Grub 2 for the images. Pictures at this point, are the original screen shots.

--------------------------------------------------------

Grub 1:

This is the easiest setup. as you only have to edit one file and then reboot.

$ sudo vim /boot/grub/menu.lst

or if you do not have vim

$ sudo nano  /boot/grub/menu.lst'


# (0) Arch Linux
title  Arch Linux
root   (hd2,2)
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/1069fde9-8696-49a8-bbec-b8f35458f4d9 ro
initrd /boot/kernel26.img


We need to choose the number for our monitor and graphics card. we need to look at the table to get a number that linux understands. We are just going to use the 256 line as colors are not critical for our test setup. In our case it is 800x600, so we would use 0x303.


640x480 800x600 1024x768 1280x1024
256 0x301 0x303 0x305 0x307
32k 0x310 0x313 0x316 0x319
64k 0x311 0x314 0x317 0x31A
16M 0x312 0x315 0x318 0x31B

You will need to translate the hexadecimal numbers to decimal. Using a search engine can convert it for you. We need to append vga=771 to the kernel line.

# (0) Arch Linux
title  Arch Linux
root   (hd2,2)
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/1069fde9-8696-49a8-bbec-b8f35458f4d9 ro vga=771
initrd /boot/kernel26.img

Check you woirk. Some times it might be a good idea to copy the original lines, so in case the numbers do not work you can always still get into the system.

# (0) Arch Linux
title  Arch Linux
root   (hd2,2)
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/1069fde9-8696-49a8-bbec-b8f35458f4d9 ro vga=774
initrd /boot/kernel26.img
# (1) Arch Linux
title  Arch Linux default resolution
root   (hd2,2)
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/1069fde9-8696-49a8-bbec-b8f35458f4d9 ro
initrd /boot/kernel26.img

Check your work, save your work, and reboot. You should not ge able to do the new resolution.
---------------------------------

Grub2

Grub2 is a little more complicated and you need to be extra careful.

First we need to edit the /etc/default/grub file. At least you no longer have to do the hex conversion.

$ sudo vim /etc/default/grub go down to this part of the file and add GRUB_GFXMODE=800x600 leaving the original line as is.

# 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
GRUB_GFXMODE=800x600

Save that. Now we need to edit /etc/grub.d/00_header

$ sudo vim /etc/grub.d/00_header

Go down where it says: set gfxmode=1280x800 and on the very next line put set gfxpayload=keep.
 My file looked a bit different, but just ignore it and just add the one line.

set gfxmode=1280x800
set gfxpayload=keep
insmod gfxterm
insmod vbe


Mine:
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
  set gfxmode=${GRUB_GFXMODE}
  set gfxpayload=keep
  load_video
  insmod gfxterm
fi


Save your work. Now the files are edited we need to tell the system of the changes.

$ sudo update-grub

IGenerating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-5-686
Found initrd image: /boot/initrd.img-2.6.32-5-686
done
$ _

If there are no error messages, you should be ready to reboot.
$ sudo reboot

---------------------------------------------------------------------------------------


Like almost getting a new monitor for free. Even the spreadsheet had 10 additional lines to work with. If we were able to go to 1024x768, you would really see the difference!!!  Most monitors but not all will easily do that and better if your video card supports it.  Good luck!

Wednesday, November 16, 2011

A bit of news.

Happy twentieth birthday Vim aka (Vi improved). Sort of the Linux command line version of Notepad. Vim leaves notepad in the dust for features. http://linuxhelp.blogspot.com/2011/11/vim-celebrates-20-years-happy-birthday.html

Thank you to Barnes and Noble for having the guts to stand up to Micro$oft. http://lxnews.org/2011/11/16/microsofts-dirty-patent-tricks/

Free Satellite Tv

Free OTA TV is a good thing and maybe I have harped on it a bit much, but soon we plan to go to the next step of Free Satellite Tv. You have to be real careful because there is a lot of misinformation and people who would like to take advantage of you for that. A site called www.ftalist.com has shed light on the right way to get into FTA. We have been using it as a guide on how to set things up. One of the biggest drawbacks to technology is that things are changing all the time.


To get into FTA (Free to Air) tv does require and investment of several hundred dollars and if the technology changes that equipment is worthless.  To offset any start up costs of FTA, we have been looking around at resale places for the equipment one might be able to use. So far the investment has been less than twenty dollars for two receivers. The only thing left is the dish and the responder(s).  Updates coming...

Tuesday, November 15, 2011

DSL and Dish versus Cable

I haven’t posted much in the last month as I just went through a move. I ended up going from a small city of 20,000 to a rural town of a 1,000. Lucky for me DSL was available here, I hate the thought that I might of had to use Hughes Net Satellite at home as I do at work.

I had cable at the old place because Dish could not install a dish on that house due to extensive tree coverage.
Of course Time Warner Cable has great features and is trouble free, except that irritating bill that shows up each month.

I have had DSL and Dish for 2 weeks now and the first bill that came was a credit for $42.00. I could use some more bills like that! The whole system for phone, internet, and TV with 2 DVRs is half of what Time Warner charges by the month.

So far things are pretty good, the TV line up is not quite as good as cable and the DVR does not have “Start Over” but there is much more HD than on cable. The DSL internet seems to work just as good for me, however I am just a surfer and not a power user, no online games or large file transfers.

There was a few small glitches getting the DSL running, seems they had to re-patch their system to find my router. But their tech people are in Ohio, not in India and they don’t just repeat “Canned dialog” that takes 4 hours to get you to re-boot your modem.  They were easy going and did not sound all stressed out, and had a real name, unlike the tech guy in India for Hughes Net I talked to who’s name is Moses, and he could not part the Red Sea.

At this point I would recommend them as an good economical alternative to cable. I’ll let you know if my opinion changes.

My brother has posted about free TV many times and has shown you how to build your own HD antennas and how to find local channels. However for me we are way too far from a major city, and have too many hills to get anything over the air.

Do not depend on them.

It is time for the United States to become more inventive. We need to stop depending on other countries for our needs. We also need to stop being bullies about patents and software copyrights. It is killing the U.S. in that it is not allowing the U.S. to compete against the world in the marketplace.

In my own situation, there was a tool I needed. I looked everywhere in the stores locally for a brace as I believe it is called. I just call it a hand drill/screwdriver. What I needed was to be able to work late at night building things without making a lot of noise. I also needed a hand tool I could use if the power was out. You still have to be able to work on computer equipment even when the power is down. Ironically, you can get most any other hand tool from a local store. You can get the brace from the web, but most likely it will have been made overseas. Not good enough.

Do not know who said it, but I think it makes real sense. If you can dream it, you can draw it. If you can draw it, you can build it. So it was time to do a bit of brain storming. What does an brace look like I thought to myself. Sort of a upside down U with long extensions. And need some parts that can swivel easily. Let me go to the hardware store and see if anything fits the bill. Looked at piping, but it was way to expensive. I really did not need anything that sturdy for what I was doing. Maybe I need to make a drawing, having something in mind now.


Good, let us use good old Tux paint. Then I realized, I need a drill chuck. Looked around and there was one for a very reasonable price at a local tool store that specialized in such things.  Now back to the hardware store for the other parts. Low and behold hit me like a ton of bricks. Why not use pvc pipe, It is cheap and easy to cut.  Here was the list.

Parts;
1 - 2 foot section of 1/2 inch pvc pipe. (B, D, F, H, i) (1 - 1 inch and 4 - 4 inch)
4  - 1/2 inch elbows pvc  (C, E, G,  P) (ignore the cursor in C, I forgot to move the mouse)
1 - 1/2 inch cap pvc  (J)
1 - 1 inch tee pvc with the center part threaded.   (M)
1 - 1 inch extension pvc  (K)
1 - 1 inch cap for extension pvc  (L)
1 - 1 inch screw in cap for tee pvc (N)
1  - Drill chuck replacement and 2 inch mounting bolt.  (I used a 1/2 inch chuck) (A, O)
Glue

Came home and proceeded to get out the hack saw and ruler and started working on the project. Before long this is what I came up with:


Yes, the ultimate geek drill and screwdriver still works. For a little ingenuity and a few bucks, I did not have to depend on some other country to get me what I needed. It really is true that:  If you can dream it, you can draw it. If you can draw it, you can build it.  What can you do for yourself?

Sunday, November 13, 2011

Resizing Desktop icons continued

Resizing desktop icons is a lot easier than it used to be. In this first video, we will see what it took to do it on MSWindows XP.



In the last article, Robert showed you how to change the icon size in Microsoft Vista. Now we will look at how to do it with Ubuntu 10.02 LTS with the Gnome desktop.


That's all for now.

Re-size desktop icons

I have a really bad habit of leaving my computer on all the time, and we have a few cats. Most of the time the cats try their typing skills; that ends up looking like this,

This morning my little kitten decided to take a nap on the keyboard and change some desktop setting on my Windows Vista.

All the icons ended up getting very very small, after a quick search on Google I found a fast fix.

It was as simple as clicking on the desktop and hitting "Ctrl" and using the mouse wheel to increase or decrease the size of all the desktop icons at once. This should also work on Windows 7?

I thought this was pretty cool, and it could come in handy even if you don't have a cat/hack.

Flash for Mobile - Heading for HTML5 Instead

Adobe haas announced they are discontinuing flash development on mobile devices: Adobe Kills Flash for Mobile . I could not resist posting this link to a web comic commemorating this event. Flash’s Swan Song (Comic)

Friday, November 11, 2011

Hard drive shortage?

According to this news report from
https://www.computerworld.com/s/article/9221717/PC_makers_should_brace_for_drive_shortages, hard drives will be in short supply for about a year. How can you get around that? There are several ways to do it. Some of which I have talked about a little before. Well you operate the computer without a hard drive. At first that seems ludicrous. but it is actually very viable. There are two ways that this can be done. Both are based on what is known as the PXE or pre-execution environment where the hardware in the network interface card can load all or part of an operating system into a computer from the network.


A major advantage of using diskless clients is that all software management can be one from virtually just one point. All software maintenance and upgrades are done on the server(s). That means, you do not have to send out a software technician to a user's desk to maintain the software on their system. Reduced Information technology support costs. Secondly. You also have reduced hardware or infrastructure costs. No hard drives to go out and replace. Less down time for users if any not to be productive.  Thin clients are usually much less expensive than brand new computers. Also no time is wasted backing up client machines. A big savings on storage more or less. Even too older computers can be converted to thin clients therefore reducing the need to get rid of old hardware and be a bit more green. 



Originally, what would happen is that either from a floppy or firmware built into a network card could listen to the network to see if there were packets that could be used to load into a machine. You needed a domain name server commonly known as a DNS server and what was called a tftp server to send out the partial operating system  to the machines. That partial operating system allowed the computer getting the packets to act like a terminal server client. Sort of like the old days with the mainframes and the dumb terminals. The server does all the heavy lifting of running the software. Couple of open source examples are LTSP or Linux terminal server project (ltsp.org) and clonezilla/drbd (clonezilla.org). Both projects have advanced dramatically. Major school systems and even businesses are using such projects.  We use both ltsp and drbd in our setup. Each have their advantages. More information about setting up ltsp and xrdp can be found a www.instructables.com/member/computothought. AOE and ISCSI instructables are coming.



Next generation pxe or what is called gPxe. With gpxe the client computer nic can look to a web server to boot from. The traditional tftp server is no longer needed and therefor less system administration costs. The advantage of this is if you have access to a web server, you can boot from almost anywhere you have internet access. Also too instead of just being able to load in enough software to act as a thin client, you can act as a fat or full client. AOE (ATA over ethernet) and ISCSI (Internet small computer system interface) is now being used in many businesses to achieve this. The hard disks are pooled to have greater storage in what is called a SAN (Storage Area Network). The hard disk is on the cloud so to speak. Then you do not have to worry about hard drives with valuable data being stolen or confiscated.  A real security plus, but then sending data over the web unless secured in some way can have even bigger issues.



Just last night I set it up so that the cloning software could be loaded from anywhere that had access to our web server. So If I needed to back up client computers, I would point the settings of the gpxe capable network card to the web server and vuola you have an instant back up at your fingertips. No more going out and purchasing backup software for each system.  Of course the process can be automated also say late at night or during the day when the computer is at a lower usage. Perfect for a business.

Update: gpxe has been superceded with IPxe. Since I have not really used it yet, I can not really talk about it. More later....

So now a business can take the hard drives out of client machines and use them for backups. Less trips to purchase replacement hard drives. Or can I say, "What hard drive shortage?".

Red October network discovery.

The basis of this article is based on the dialog from the movie known as "The hunt for the Red October". In the movie, one of the key lines was I think "One ping and one ping only". Pinging was a method by submarines equipped with sonar to detect what is around them. Normally you would use more than one ping. In computing we also have a program called ping that does the same thing to detect what is around on the network. There is a very powerful program called nmap that usually automates such activity. That usually takes some kind of administrative power to implement. We will be using a simple linux batch file (could be easily converted to other platforms) to detect what is around us. This tool is perfect for the home network. It will probably not detect what is known as "Man in the middle devices", but at least you can see the visible systems on your network.

The code.

ping.sh: (do not forget "chmod +x ping.sh)
[code]
for i in {1..254}
do
ping 192.168.1.$i -c1 -w1 -v | grep "icmp_seq=1"
done
[/code]

If you have a different network, you will have to change "192.168.1" accordingly, here again we are using the good old "grep" command to extract data from the return stream. it is our sonar scope. Let's run it.

$ ./ping.sh
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.852 ms
64 bytes from 192.168.1.31: icmp_seq=1 ttl=64 time=0.260 ms
64 bytes from 192.168.1.99: icmp_seq=1 ttl=255 time=2.75 ms
64 bytes from 192.168.1.109: icmp_seq=1 ttl=64 time=0.261 ms
64 bytes from 192.168.1.115: icmp_seq=1 ttl=64 time=0.064 ms
$ _

Ok, there are five devices on the network. We need to know more. There is what is call DNS or "Domain naming service". We can use the router to tell us what the ipaddresses maybe are known as.

The code.

nslookup.sh: (Do not forget to make it executable with chmod +x nslookup.sh")
[code]
for i in {1..254}
do
nslookup 192.168.1.$i | grep name
done
[/code]

Let's run it.
$ ./nslookup.sh
1.1.168.192.in-addr.arpa name = my_network.
10.1.168.192.in-addr.arpa name = router2.
20.1.168.192.in-addr.arpa name = router3.
31.1.168.192.in-addr.arpa name = oesrvr1.
115.1.168.192.in-addr.arpa name = oesrvr104
$_

Notice the ipadresses are backwards, but we still can identify units on the network from the list. Two devices show up known as router2 and router3. I know that they are not connected to the network at this time. They just have reserved names in the router. The unit at 99 is actually the print server and should have a reserved name in the router, I can take care of that later. 109 is a temp machine I have set up to test some software. Now if there were any unknown numbers, they would need to be investigated immediately. Again you would need to change "192.168.1." to work with your network.

There you are, two simple tools to check on your network.

Thursday, November 10, 2011

Exacto knife.

One nice thing is that if you find a page with a tool that you need, under certain circumstances, you can save the page for later use. In some cases, if it is going into an educational environment, the advertisements have to go away. That is what was done with this web page.


Before:




After editing the source code:


So there are more uses for knowing html, javascript, and css than for just creating your own web page.  One of many sites to get free code: http://www.free-javascripts.com.



Sunday, November 6, 2011

Quick cartoon


▞▀▖       ▗    ▌            ▐          
▙▄▌ ▞▀▌▌ ▌▄ ▞▀▖▌▗▘ ▞▀▖▝▀▖▙▀▖▜▀ ▞▀▖▞▀▖▛▀▖
▌ ▌ ▚▄▌▌ ▌▐ ▌ ▖▛▚  ▌ ▖▞▀▌▌  ▐ ▖▌ ▌▌ ▌▌ ▌▗▖
▘ ▘   ▌▝▀▘▀▘▝▀ ▘ ▘ ▝▀ ▝▀▘▘   ▀ ▝▀ ▝▀ ▘ ▘▝▘




---------------------------------------------------------------------
From user Friendly:
Generation gap even between geeks.


 
-----------------------------------------------------------------------

Ascii radar interpretation.


Tuesday, November 1, 2011

Evolution of a script

-------------------------------------------------------------------------------------------------------------
Notice: Comments are correct the scripts need to be updated.
-------------------------------------------------------------------------------------------------------------
 Do not have time to do it now , but it isin the queue......


Someone had written a script to grab the weather from the web. A script is like a todo list for the computer. Even if you are not a programmer, you will see the added lines give the script more potential or power. Everything becomes less and less cryptic to use. How you interact with it is sometimes considered what is called the user interface.

lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=Woonsocwa


That yielded:

National Weather Service
     __________________________________________________________________

                               Woonsocket, RI
                        Current Local Conditions at:
                                 Smithfield
                  Lat: 41.91 N   Lon: 71.4 W   Elev: 440 ft
                     Last Update: 10/31/11, 11:35 PM EDT
                                Weather: Fair
                          Temperature: 36°F (2°C)
                               Humidity: 93 %
                             Wind Speed: E 5 MPH
                             Barometer: 30.36 in
                           Dewpoint: 34°F (1°C)
                          Wind Chill: 32°F (0°C)
                            Visibility: 10.00 mi.
     __________________________________________________________________

            [BUTTON Input] (not implemented)_____________________


That is great if you live in Woonsocket, RI. What if you live somewhere else. I had no idea What a warning zone was... Had to check it out.  Found where I could get the zones in county form but not city form.  But that meant a lot of lookups and manual work.


There had to be a better way. After a lot of research, trial, and error I came up with this script. Stripped out the remarks for sake of space.

$ ./gwp7.sh Polk FL

National Weather Service
__________________________________________________ ________________

Polk , FL
Current Local Conditions at:
Gilbert Field
Lat: 28.05 N Lon: 81.75 W Elev: 144 ft
Last Update: 11/01/11, 08:53 AM EDT
Weather: Fair
Temperature: 63°F (17°C)
Humidity: 87 %
Wind Speed: N 9 MPH
Barometer: 30.14 in. (1020.5 mb)
Dewpoint: 59°F (15°C)
Visibility: 10.00 mi.
__________________________________________________ ________________


Code:
if [ $# -lt 2 ] ;  then 
 echo "You wrote: $0 $*"
 echo "Please use the format: $0 County ST"
 exit
fi
state=$2
county=$1
county="$county "
statecode="$stateZ"
echo
lynx -dump  http://alerts.weather.gov/cap/$state.php?x=2 | grep "$county" > x  
grep -e "$statecode"  x > y  
grep -e $county y > z 
thecode=$(tail -1 z | sed 's/^.*\(......\)$/\1/')
lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=$county&site=BOX&State=$state&warnzone=$thecode"
# # Voice playback
# lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=$county&site=BOX&State=$state&warnzone=$thecode" | festival --tts

Now you could at least type in the county and state to get the weather without looking it up. But what about a new user? They may not be familiar with that trick. So I did a minimal amount of window dressing to make it just a bit easier.


              Weather printout

Enter the State: LA
          County: Cameron
-------------------------------------------------

                          National Weather Service
     __________________________________________________________________

                                Cameron , LA
                        Current Local Conditions at:
                        Lake Charles Regional Airport
                  Lat: 30.12 N   Lon: 93.22 W   Elev: 15 ft
                     Last Update: 11/01/11, 09:53 AM CDT
                                Weather: Fair
                         Temperature: 62°F (17°C)
                               Humidity: 58 %
                             Wind Speed: E 5 MPH
                      Barometer: 30.22 in. (1024.1 mb)
                           Dewpoint: 47°F (8°C)
                            Visibility: 10.00 mi.
     __________________________________________________________________


Code
clear
echo
echo "              Weather printout"
echo 
read  -p "Enter the State: " state
read  -p "          County: " county
echo "-------------------------------------------------"
echo
# state=TX
# county=Galveston
county="$county "
statecode="$stateZ"
lynx -dump  http://alerts.weather.gov/cap/$state.php?x=2 | grep "$county" > x  
grep -e "$statecode"  x > y  
grep -e $county y > z 
thecode=$(tail -1 z | sed 's/^.*\(......\)$/\1/')
lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=$county&site=BOX&State=$state&warnzone=$thecode"
# lynx -dump "http://mobile.weather.gov/port_mp_ns.php?select=3&CityName=$county&site=BOX&State=$state&warnzone=$thecode" | festival --tts

So now what started as a one line program that was hard to deal with has become almost usable.. We could use zenity to make some fancy gui interface, but I think you get the idea.

Note: Yes, I know I left out the shell type, but that changes with the turn anyway. Also these scripts may not work for California and other places where they do not use counties as the basis for reports.

Lastly,  http://mobile.weather.gov is a great source for looking to find web pages to get weather data from. You can even get weather (radar) pictures to and add them to your script. That will make things even more user friendly. For Tallahasse, Florida.

$ wget http://radar.weather.gov/ridge/Thumbs/TLH.png --2011-11-02 03:22:12-- http://radar.weather.gov/ridge/Thumbs/TLH.png Resolving radar.weather.gov... 209.234.250.138, 209.234.250.202 Connecting to radar.weather.gov|209.234.250.138|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 29455 (29K) [image/png] Saving to: `TLH.png' 100%[======================================>] 29,455 --.-K/s in 0.05s 2011-11-02 03:22:12 (561 KB/s) - `TLH.png' saved [29455/29455]

$ convert TLH.png TLH.jpg

Convert to ascii

$ jp2a -i TLH.jpg > tlh.txt
$ cat tlh.txt

Add cat tlh.txt to your script to get the radar picture.

Update: Found an image converter I like better.

$ sudo apt-get install caca-utils

Get the pic

getpic:
[code]
DAY=$(date +"%m%d%y%H%M%S")
picfn="pic$DAY.png"
# echo $picfn wget http://radar.weather.gov/ridge/Thumbs/HGX.png -O hgx$DAY.png
[/code]

Convert

$ img2txt -W 80 -f utf8 img2txt -W 80 -H 25 -f utf8 hgx110711051503.png > hgx110711051503.txt

Display

$ cat hgx110711051503.txt

From:


To: