Sunday, November 18, 2007

Debian Etch Base Image (public AMI) for Large Instance

Published a new public AMI for Large Instance:
Debian Etch Base Image for Large Instance

Update: It has been reported that I left my AWS key in the history. That does not work anymore. Thanks to the concerned citizen.

Wednesday, September 05, 2007

Windows XP optimization

These are some of the tweaks that I do to speed up my Windoze:

- Display Properties > Themes > Windows Classic Theme

- System Properties > Advanced > Performance > Adjust for best performance

- System Properties > System Restore > Turn off

- Disable File Indexing: From My Computer > right-click on the C: Drive > select Properties. Uncheck "Allow Indexing Service to index this disk for fast file searching." Apply changes to "C: sub folders and files," and click OK.

- Clean Up Prefetch, temp, and cache files: Download CleanUp!

- If VM, turn off Screen Saver. If VMWare, install VMWare Tools.

- Defrag disks.


Tuesday, September 04, 2007

SSH reverse tunnel

# ssh -nNT -R

The "-n" option prevents reading from STDIN. Redirection from /dev/null to STDIN.
"-N" tells ssh that the tunnel is not for executing remote commands.
"-T" tells ssh not to allocate a pseudo-tty on the remote system.
"-T" disables pseudo-tty allocation.

Rough diagram: <---

To avoid timeout:

In /etc/ssh/sshd_config on the server:
TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 99999

To enable binding address in ssh -R:
GatewayPorts yes

Man page docu for -R switch:
-R [bind_address:]port:host:hostport

Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side. This works by allocating a socket to listen to port on the remote side, and whenever a connection is made to this port, the connection is forwarded over the secure channel, and a connection is made to host port hostport from the local machine.

Port forwardings can also be specified in the configuration file. Privileged ports can be forwarded only when logging in as root on the remote machine. IPv6 addresses can be specified by enclosing the address in square braces or using an alternative syntax: [bind_address/]host/port/hostport.

By default, the listening socket on the server will be bound to the loopback interface only. This may be overriden by specifying a bind_address. An empty bind_address, or the address "*", indicates that the remote socket should listen on all interfaces. Specifying a remote bind_address will only succeed if the serverâs GatewayPorts option is enabled (see sshd_config(5)).

Debian apt GPG keys and repos

# wget -O - | sudo apt-key add -
# wget -O - | sudo apt-key add -
(replace 2006 with current year)
deb unstable main contrib non-free
Other keys:
mdebian:~# gpg --keyserver --recv-keys A70DAF536070D3A1
mdebian:~# gpg --keyserver --recv-keys B5D0C804ADB11277
mdebian:~# gpg --armor --export A70DAF536070D3A1 | apt-key add -
mdebian:~# gpg --armor --export B5D0C804ADB11277 | apt-key add -

Monday, September 03, 2007

Motorola MOTOKRZR K3 and Smart 3G

Word of Warning: I am a Linux user and very keen in buying a Motorola Razr (specifically v3xx) because it is known to work in Linux. But for some stupid reason I bought a newer model and it is NOT based on this chipset anymore:

# lsusb

Bus 001 Device 002: ID 22b8:6402 Motorola PCS
# dmesg
[30549.844000] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
[30549.844000] usbcore: registered new interface driver cdc_acm
[30549.844000] drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control
Model driver for USB modems and ISDN adapters
I have not tried yet making it work in Linux but might write a dev driver for this if time permits.

For Smart 3G Internet on the phone, I first sent the following message to 211:
You will receive a browser message. This is a bit noob but only after some fiddling I manage to figure out that I need to see the Options of that message and Install. This message essentially contains the Smart 3G-related browser settings. I previously used a Globe SIM so the default set Web Sesssion is Globe Internet (Menu > Web Access > Web Sessions). Make Smart Internet as the default web session.

To use it as a modem on Windoze, install the Motorola Phone Tools, then Click Internet. It will automagically create a new Connection (with default Smart provider settings that comes with MPT).

Important Note: It takes some time after the 3G registration for the service to be activated.

I got the following actual bandwidth stats using at about 3am in the morning (the other endpoint is a Bayantel server in the Phil):
277kbps downlink (~35 kbytes/second)
109kbps uplink (~14kbytes/second)
Not bad!

At 9pm, uplink 47kbps (~6 kbytes/second), downlink 223 kbps (~28 kbytes/second).

If you have questions, post it as a comment.

Friday, August 17, 2007

Acer Aspire 4310, Acer CrystalEye webcam (064e:a101) on Ubuntu Linux

The Ubuntu Linux version is:

$ cat /etc/
Ubuntu 7.04

The Linux kernel version is:
$ uname -a
Linux xxx-laptop 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux

The fresh install will detect the webcam:
dmesg | grep Crystal
[ 22.116000] uvcvideo: Found UVC 1.00 device Acer CrystalEye webcam (064e:a101)

Camorama and other applications that do not support v4l2 will not work. The webcam driver uvcvideo (linux-uvc) supports v4l2 only. v4l1 is officially deprecated.

To test, you can use Ekiga softphone or to take webcam snapshots use luvcview.
Source code:

You will also need libsdl1.2-dev (for SDL libraries) and build-essential (for building tools like gcc and make utility).
$ sudo aptitude install build-essential libsdl1.2-dev
$ wget
$ tar zxvf luvcview-20070512.tar.gz
$ cd luvcview-20070512
$ make
$ make install

To make it user-friendly, create a Custom Application Launcher pointed to this script:
# will place snapshots in Desktop
cd ~/Desktop
# will produce pnm: Netpbm PPM "rawbits" image data,
# instead of default MJPEG format that the webcam does not support
luvcview -f yuv

If you have questions, post them at and point them from here.

Wednesday, August 15, 2007

Acer Aspire 4310, Broadcom (bcm43xx) chipset on Ubuntu Linux

The Ubuntu Linux version is:

$ cat /etc/
Ubuntu 7.04

The Linux kernel version is:
$ uname -a
Linux xxx-laptop 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux

The fresh install will detect the WLAN hardware but will fail on initialization (use dmesg to see kernel messages):
$ dmesg
bcm43xx: Error: Microcode "bcm43xx_microcode5.fw" not available or load failed.
atkbd.c: Unknown key pressed (translated set 2, code 0xd4 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e054 ' to make it known.

The first line looks for the Broadcom firmware. The second and third lines is a response to pressing the Bluetooth key.

Update: This forum [*] reports that there is a Bluetooth key for turning it on/off, but there is no Bluetooth chip!


The following is the output of lspci:
$ lspci
00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)
00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 3 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 82801GBM/GHM (ICH7 Family) Serial ATA Storage Controller AHCI (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5787M Gigabit Ethernet PCI Express (rev 02)
03:00.0 Network controller: Broadcom Corporation Dell Wireless 1390 WLAN Mini-PCI Card (rev 01)
0a:06.0 FireWire (IEEE 1394): O2 Micro, Inc. Firewire (IEEE 1394) (rev 02)
0a:06.2 Generic system peripheral [0805]: O2 Micro, Inc. Integrated MMC/SD Controller (rev 02)
0a:06.3 Mass storage controller: O2 Micro, Inc. Integrated MS/xD Controller (rev 01)

First, install bcm43xx-fwcutter. fwcutter is a tool which can extract firmware from various source files. It's written for BCM43xx driver files.
$ sudo aptitude install bcm43xx-fwcutter

You will get the following error message:
Preconfiguring packages ...
Selecting previously deselected package bcm43xx-fwcutter.
(Reading database ... 88014 files and directories currently installed.)
Unpacking bcm43xx-fwcutter (from .../bcm43xx-fwcutter_1%3a006-1_i386.deb) ...
Setting up bcm43xx-fwcutter (006-1) ...
=> `wl_apsta.o'
Connecting to||:80... connected.
HTTP request sent, awaiting response... 404 Not Found
22:15:57 ERROR 404: Not Found.

dpkg: error processing bcm43xx-fwcutter (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up bcm43xx-fwcutter (006-1) ...
=> `wl_apsta.o'
Connecting to||:80... connected.
HTTP request sent, awaiting response... 404 Not Found
22:15:58 ERROR 404: Not Found.

dpkg: error processing bcm43xx-fwcutter (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:

Just proceed and download the firmware/driver:
$ wget

Extract the firmware from the driver:
$ sudo bcm43xx-fwcutter -w /lib/firmware ~/Desktop/bcmwl5.sys

This will create lots of new files in the /lib/firmware directory, this is the firmware part of the driver that will make your card work with ubuntu!

Also put the driver in the kernel folder:
$ uname -r
$ sudo bcm43xx-fwcutter -w /lib/firmware/2.6.20-15-generic ~/Desktop/bcmwl5.sys

Your WLAN card should now work!



If you have questions, post them at, and point them from here.

Sunday, June 03, 2007

freenx on Debian etch, IBM Power5 ppc64

There is still no package in the repos for freenx unlike OpenSUSE. You can retrieve the sources from here (thanks to Fabian Franz for the pointer!):

You can download additional packages (source code) (e.g. for nxagent, nxauth) not included in the previous tgz from here:

For consistency's sake, I packaged all sources (sans Fabian's) that I have downloaded but I cannot assure you that they are the latest stable (as of this time). I've done a lot of minor tweaks. It will be cumbersome to document them. Post your questions here if you encounter a problem.

After the installation and configuration, I got this error in the client (version 2.x):

NX> 1000 NXNODE - Version 1.5.0-60 OS (GPL)
NX> 1004 Error: NX Agent exited with exit status 1.
NX> 105 NX> 596 Session startup failed.
NX> 1006 Session status: closed

The possible fixes are documented in this wiki. But apparently the error in my case is something related to a missing shared library being used by nxagent. Make sure you check that all libraries are resolved using the command ldd /usr/NX/bin/nxagent and fulfill the missings. Also make sure that you are using the most updated node.conf using the command nxloadconfig --userconf.

Saturday, June 02, 2007

IE's Unknown Runtime Error in prototype.js Line: 697 Char: 9

IE sucks again! Without a decent debugger (like Firebug), I have to read prototype.js (version: 1.4.0_pre11) and spend hours trying to pinpoint the fault. This alien error appears to be this block:

    if (receiver) {
if (this.options.insertion) {
new this.options.insertion(receiver, response);
} else {
receiver.innerHTML = response;

Particularly this line:

receiver.innerHTML = response;

I am trying to rewrite a tbody of a table but IE does not like that. This link is insightful (RobG):

...don't use innerHTML to modify tbody, tr, th or td elements, use DOM (they actually refer to a 'table object model', but DOM is a better bet).

If you are going to use innerHTML near a table, write the entire table or just cell content, no in between.

Thursday, May 24, 2007

Debian 4.0 r0 (Etch) installation on IBM System p5 510 inside LPAR

For some reason, the usual CD/DVD installation does not work in LPAR. I tried both Debian 4.0r0 (netinst and complete cd-1) and OpenSUSE 10.2 (dvd). The errors are known. I reported the OpenSUSE bug here [1], and the Debian bug has been reported here [2]. Update: This workaround should also work in OpenSUSE. Select the logical volume where the installer was disk dumped (dd) as the installer media. This can be done in the Main Menu (4>1>3).

There is a workaround documented by Gottfried Scheckenbach in debian-boot list [3]:

Of interest for users of VIO (via HMC or IVM):
I have found a way around burning a new disc (because I'm not physical near to the machine): I downloded the iso onto the VIO server and putted it via dd into a newly created virtual disc aka LV on the VIO. I attached this virtual disc as secondary hard disc to the LPAR and booted the LPAR using the defictive cdrom. After running into the missing files problem on initializaton of the installer I remounted /cdrom from this second hard disc.

I clarified the 'dd' command from him and he pointed me to the command `oem_setup_env`:
the padmin user has it's own PATH environment - there you see no dd (nor the other usual AIX stuff). But if you switch to root (with oem_setup_env), you can use all normally available AIX commands. And you must be root to write into the LV device. If you look inside /dev you find two devices witch contain the name of your lv - you have to use the block device, not the character one.

To use AIX commands like dd, login as root using the command `oem_setup_env`. This is another helpful documentation in disk dumping the cd-1 ISO image [4].

This is a step by step documentation on the workaround:

0. The assumptions are: you already are inside the VIO server as root, you already have created storage pools (one of which is the rootvg where VIO is located), also you have already created the partition where to install Linux, via IVM.

1. We create the logical volume from one of the storage pools. In this example, we create a logical volume named 'vdiso' from a storage pool named 'LinuxPoolvg'. Since the cd iso is about 700mb, I'll peg the size of the logical volume to 1gig.

$ mklv -lv vdiso LinuxPoolvg 1G

2. Copy the cd iso (debian-40r0-powerpc-CD-1.iso) to the VIO server. I used ftp. (Default user/password: padmin/padmin)

3. Disk dump the ISO to the logical volume as documented by Gottfried and here [4]. If you look inside /dev you find two devices which contain the name of your logical volume. Make sure you use the block device, not the character one.

$ oem_setup_env
# ls -l /dev/*vdiso
crw------- /dev/rvdiso
brw------- /dev/vdiso
# dd if=debian-40r0-powerpc-CD-1.iso of=/dev/vdiso bs=8M

4. Attach the logical volume to the concerned partition via IVM. This is a resourceful guide in managing your partitions using IVM [5]. The attached logical volume will be seen as /dev/sdb1 (you can verify the device name later by using `dmesg` to check for kernel messages on the attached device).

5. Create a virtual terminal (vt) connection to a partition. In this example, the id of the partition is 2:

# exit
$ mkvt -id 2

To remove the vt:

$ rmvt -id 2

To exit the vt and go back to the shell:

(tilde period)

6. Activate the partition using IVM. You should see the boot process from the newly created virtual terminal connection. You should also see yaboot bootloader. Type `install64` to load the 64-bit kernel of the Debian installer and initiate an installation.

7. The installation should fail as reported by Gottfried [2], a failure to read from the cd media. Go back to the Debian installer main menu and scroll down to 'Execute a shell'. You will be given a busybox ash shell. Verify the Linux device name of logical volume (mentioned earlier in step 4) using `dmesg`. Mine is /dev/sdb1.

8. Unmount the cd media mounted in /cdrom and replace it with the logical volume created in step 1:

Busybox ASH:
# umount /cdrom
# mount /dev/sdb1 /cdrom
# exit

9. You should be brought back to the main menu. Re-start the installation from the step 'Load installer components from CD'. Select all components.

10. There will be a problem detecting the PPPoE concentrator. I just skipped this step and continued.

11. Gottfried reports here [3] that there will be a problem with ext3 reformatting, so we use reiserfs instead.

12. Please read Gottfried's other notes (e.g. yaboot placement) for other possible errors. I encountered a minor problem with the default boot sequence but it's as simple as specifying the newly-installed partition in the SMS menu.

If you have other problems, you can drop a comment here or report it as a bug to the concerned Debian list.

[1] link1
[2] link2
[3] link3
[4] link4
[5] link5

Tuesday, May 22, 2007

Resetting admin password in IBM System p5 510 Express ASMI

These are the steps in resetting the admin password:

0. Re-route stored static in your body via an ESD wrist strap to a
metallic element.

1. Look for the 2 toggle switches and service processor batt. The batt
should be in front of the Power Supply 1 and Power Supply 2 (codes: E1
and E2, see Rear Location Codes on the cover plate). The "very tiny"
toggle switches should be in the area of P1-C14 slot.

I forgot the exact sequence but it should be a combination of the ff. step (2):

2. Remove the battery, toggle the switches to the opposite direction.
Allows some time for the caps to discharge.

3. Move back the toggle switches and put back the batt in its place.

4. Assign your PC to Class C subnet (i.e. masked
IPaddr: 192.168.2.x for HMC1 or
IPaddr: 192.168.3.x for HMC2

5. Ping HMC1 or HMC2. Access the web interface using the default address: (for HMC1) or (for HMC2)
Note: Sometimes you have to force the https protocol:
Example: (for HMC1)

6. The default 'admin' password is: admin
The default 'general' password is: general

7. You are required to change the admin password before being allowed
to change ASMI settings.

Monday, May 21, 2007

ld: unrecognized option '--hash-style=both'

gcc -Wl,,-export-dynamic obj_linux-native/socketdev_listener.o \
contiki-linux-native.a -o testv6.linux-native
/usr/local/bin/ld: unrecognized option '--hash-style=both'
/usr/local/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status

If you look closely, the error is something related to the local gcc not using the host's linker (ld).

$ which gcc

$ which ld

For some reason, I messed my compiler path. To synchronized gcc to use the host's dynamic linker (i.e. /usr/bin/ld), set the environment variable COMPILER_PATH to /usr/bin.

$ export COMPILER_PATH=/usr/bin

$ gcc -print-prog-name=ld

Saturday, May 12, 2007

Upgrade: Ubuntu Edgy (6.10) to Feisty (7.04)

I broke my rule of using the Ubuntu version one step backward from the current development release. My main interest is the stable ntfs driver with write capability. The upgrade went smooth except for a minor issue related to shared-mime-info package and a custom package (freemind). I reported the fix here.

Tuesday, May 01, 2007

Upgrade woes

I am sharing some of the notes that I've jotted down. This might be helpful to people who are upgrading from the long-term supported (LTS) Ubuntu Linux Dapper Drake (6.06.1) to Edgy Eft (6.10). My own cycle in upgrading is one step backward from the current development release. The current release is Feisty Fawn (Ubuntu 7.04). I use the command update-manager -c -d to dist-upgrade. This must be run as a privileged user.

Error 1:
Could not fetch the package liboobs. This is something related to our Internet filter in the university. So, I have to manually download the liboobs (edgy eft version) and place it in /var/cache/apt/archives/.

Error 2:
Could not install /var/cache/apt/archives/samba_3.0.22-1ubuntu4.1_i386.deb. The error log is: subprocess new pre-removal script returned error exit status 102. At first, I ignored the error but this will come up again later.

Error 3:
The upgrade aborts now. Your system could be in unusable state. A recovery was run (dpkg --configure -a). installArchive() failed.

I checked the logs at /var/log/dist-upgrade. main.log reports the samba error (see Error 2). This is the fix to it:

# cd /etc/rc2.d/
# ls -al
(At this point, you need to check for the broken samba symlink. Remove the symlink.)
# rm K09samba
(Alternatively, use the unlink command.)

To continue with the dist-upgrade: update-manager --dist-upgrade

Error 4:
Subprocess post-installation script returned error exit status 2. installArchive() failed.

This is the error log in /var/log/dist-upgrade/apt.log:
ERROR: root: got an error from dpkg for pkg: 'firestarter': subprocess post-installation script returned error exit status 2.

To get more debugging message, I enabled the following flag and rerun dpkg:
export DEBCONF_DEBUG=developer; dpkg --configure -a

The error is related to firestarter failing to start its daemon. The error occurs when running the script /etc/init.d/firestarter start. To see more debugging message, remove the redirection of the following line in the init.d script /etc/init.d/firestarter start:
# $FS_CONTROL start > /dev/null
(new line:)

The offending line is in the script /etc/firestarter/ It aborts when any network interface called in /etc/firestarter/configuration is not yet initilized. In my case, it is eth1 (wlan). I just assigned an IP address to the offending interface.

The next offending line in /etc/firestarter/ is related to the DHCP not starting properly. Just disable DHCP for NATs when you enabled NAT in /etc/firestarter/configuration. In /etc/firestarter/configuration, set the following lines to off:

# Enable DHCP server for NAT clients
# Forward server's DNS settings to clients in DHCP lease

To continue with the dist-upgrade: update-manager --dist-upgrade

Error 5:
After the dist-upgrade and reboot, my X session failed to start. The log follows:

/etc/X11/Xsession.d/50xorg-common_determine-startup: 48: /usr/bin/tpaneld: not found
mkdtemp: private socket dir: Permission denied

The fix to it is to chmod the /tmp directory to a+w: chmod a+w /tmp (as privileged).

Error 6:
Firefox 2 complains when installing an addon in its error console: installLocation has no properties.

The fix to it is to rename extensions.rdf:
$ mv ~/.mozilla/firefox/{profile}/extensions.rdf extensions.rdf.orig

If you have questions, post them and leave a comment. I will answer you from there.

Friday, April 13, 2007

Default AllowOverride directive in Ubuntu 6.06

This might help people who are having problems with the rewrite module in Apache 2. The AllowOverride directive is actually set to None by default in Ubuntu 6.06.1. To allow the reading of rewrite directives in a .htaccess, AllowOverride must be set to All. This statements explains it well:

When this directive is set to None, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.

Wednesday, January 31, 2007

Replacing xscreensaver with gnome-screensaver in Xfce

By default, xfce screensaver requires xscreensaver. You have the _option_ to remove xscreensaver using the following command (as privileged):

apt-get remove xscreensaver

To install the gnome-screensaver use the following command (as privileged):

apt-get install gnome-screensaver

To auto-start the gnome-screensaver, add it as an Autostarted Application:

Xfce menu > Settings > Autostarted Applications

The command for starting the gnome-screensaver daemon is:


To be able to use the action button "Lock screen" to start gnome-screensaver immediately and lock your screen, modify the file /usr/bin/xflock4:

#xscreensaver-command -lock || xlock $*
gnome-screensaver-command --lock exit 0

Note that the original xscreensaver command is now commented. Backup the original copy of xflock4 (as privileged):

cp /usr/bin/xflock4 /usr/bin/xflock4.orig

Hope that helps.

If you have questions, post them at:
and leave a comment.

Thursday, January 25, 2007

File renaming in BASH via string handling


#remove spaces
for i in *.wma; do
mv "$i" `echo $i | tr ' ' '_'`;

#remove uppercase
for i in *.[Ww][Mm][Aa]; do
mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`;

#convert file names
for i in *.wma; do
mv "$i" "`basename "$i" .wma`.mp3";

#rename test1a, test2a, test3a
#to t1a, t2a, t3a
for i in test*a; do
mv $i $substring1$substring2'a'