Saturday, September 23, 2017

Transform a Raspberry Pi 3b into an inexpensive 5250 terminal


The Raspberry Pi 3b kit, from various kit providers, costs around $50 including case, heat sinks and power supply. Add a 8GB microSDHC card for less than $10 and you've got the makings of an inexpensive (sub $60) 5250 terminal.

There are two basic methods we've used with good success to create a 5250 terminal from a Raspberry Pi. First, if you have an IBM-i with active SWMA and are running IBM-i 7.x, then the new IBM-i Access Client Solution is one option. Alternatively, if you're wanting a simple user interface with less user options (ie 5250-only) then the open source TN5250j project is your other option. Both of these programs are 100% java-based and thus can run on any OS or device that supports java without having to be recompiled.

The first basic assumption for our initial Raspberry Pi 5250 project is that we do not want a full GUI with all the bloat-ware that comes with Raspbian OS (as of the date of this post the current version is Raspbian Jessie). Thus, we're building this with Raspbian Jessie Lite and adding a basic GUI. The second assumption is that we only want 5250 functionality and none of the user data connectivity offered by the IBM Access Client Solutions application, thus we will use the TN5250J product for this post.

Here are the basic steps that I will outline in some detail in this article:


  1. Download software and prep the microSD card
  2. Install the Raspbian Jessie Lite OS
  3. Update and modify the Raspbian OS
  4. Copy 5250 program and modify files
  5. Modify the boot load sequence of OS to auto-launch 5250


Step1: Download the Raspbian Jessie Lite .img file zip archive and unzip. If you're a Windows user you'll need to install Win32DiskImager. Also, go ahead and download TN5250J from sourceforge. If you purchase a new microSCHC card it should already be formatted, if not format as FAT32.

Step 2: Use Win32DiskImager to burn the Raspian Jessie Lite .img file to the microSD card. My suggestion is that if you're going to use this microSD as a template for creating more microSD cards for more terminals, use a 4GB microSD card as your template. That way the image you'll create will be 4GB instead of 8, 16 or 32GB. Once Win32DiskImager finishes writing the .img to the microSD card, Windows will prompt you to Format the drive - CANCEL this prompt. Accept and Exit Win32DiskImager. Eject the microSD card.

Step 3: Time to hone your Linux chops or learn some new ones. Once you insert the microSD card into your pi and apply power, the OS should boot to a login prompt. UserID: pi and Password: raspberry.

sudo raspi-config ->(4)localization -> (I1)Locales->Change Locale; scroll down and un-select (using space bar) en_GB.UTF-8 (unless of course you live in Great Britain), scroll down further to en_US.UTF-8 (for those in the US), tab, OK, on the next screen arrow down to en_US.UTF-8 (or other selected locale), tab, OK (this will generate locale files); Next, set your timezone: (I2)timezone (in my case US->Central); localization -> (I3)keyboard (Generic US/104 or other depending on location), next; the system defaults to English(GB), so scroll down to Other, select appropriate option, in my case English (US), next, scroll to top of list, US (English) or other language as appropriate; OK. Next, you should change the default pi password for security; finish (should prompt to reboot); if not, type sudo reboot at the terminal prompt.

Now for installing a base GUI without all the stock bloat-ware:



To make the RaspPi automatically boot to the GUI, use sudo raspi-config to go to Boot Option menu ->(B1)Desktop/CLI -> (B4)Desktop Autologin; tab; OK; tab; Finish;

Step 4: Next, we'll download tn5250j-0.7.6-full-bin.zip (or latest version) from SourceForge and unzip. Rename the unzipped folder to tn5250j for simplicity. Copy the folder to a USB stick. Insert the USB stick into the booted RaspberryPi. The GUI should automatically prompt to "Open with File Manager". Use File Manager to drag the tn5250j folder to /home/pi/ folder.



To create shell script for running TN5250J program:



To enable TN5250J to auto-start when pi boots:



To add an icon to the Desktop for TN5250J, go to a terminal session:



At this point, if you reboot the RasPi the system should auto-login to the GUI and then launch the TN5250J program (if you elected for auto-launch option above). You can then set up a terminal session to your IBM-i system (yes, you can define multiple sessions), remap your keyboard (by default the enter key on the number pad isn't mapped as Enter). You're restricted to two key maps per function, so if you're used to the right control key also being an Enter key, you'll have to choose. If for some reason you should have an issue with the TN5250J application locking up on launch due to a possible error in session settings, just launch a terminal session, cd /home/pi/.tn5250j *important: put the period in front of tn5250j in this case, as it is a hidden directory that contains the configuration files*. Typing pwd will display your current directory. Use ls -l to display files in the directory. You can delete the sessions file using sudo rm sessions. TN5250J will recreate the sessions file when you launch TN5250J and re-add the sessions to the configuration screen.  Always remember to click APPLY.  Mark the first session you create as "default" and it will auto-launch that session every time the device boots.  Also, to modify session or add sessions, you must right-click the mouse inside the session window and the edit options panel will pop up.

If you want the Display Power Management System (DPMS) to NOT auto-sleep the display (ie the screen stay ON all the time), add the following line to the lightdm.conf file:

cd /etc/lightdm
ls -l
(should be a file called lightdm.conf in that directory)
sudo nano /etc/lightdm/lightdm.conf
arrow down to the [SeatDefaults] section of the file
add the following line underneath
[SeatDefaults]
xserver-command=X -s 0 -dpms

^O, enter to save, ^X to exit

Another "nice to have" feature would be to enable VNC via the raspi-config function so that you can provide remote support for the RasPi terminal. There is also a Citrix Receiver built for the Raspberry Pi as well as a Parallels 2X client, RDP client, and several browsers including Chrome and Firefox. Setup and installation of those are a subject for another post.  You can also set the top Panel bar to AutoHide so that if you're using the device without a mouse the panel bar doesn't show at the top of the screen.

In case you were interested, my typical hardware configuration as of this post consists of a RaspberryPi 3b board ($34.99), an Enokay case ($5.99) which screws together and comes with the two heat sinks needed for the pi board, a NorthPada power supply with on/off switch for $8.99 and an 8GB SANDisk microSD card which in bulk costs around $5.50.  Don't forget an HDMI to VGA or HDMI to DVI converter cable if your monitor(s) do not have HDMI input ports.

Wednesday, September 6, 2017

Brocade Fiber Channel Switch administration and Java support in new browsers



Older model Brocade Fiber Channel switches including IBM OEM Brocade switches use a Java webstart applet (Java Network Launching Protocol or JNLP file) for administration.  If you've tried to administer a Brocade Fiber Channel switch lately with a newer browser, it is likely you've been denied access.  Chrome, Firefox and IE have all discontinued support for NPAPI plugins, including Java webstart.

Pale Moon to the rescue!

The Pale Moon browser (from palemoon.org) is a fork of the Mozilla/Firefox code and has not (as of the date of this posting) removed the NPAPI Java plugin support.  While they do recommend that you DISABLE this feature for security purposes, the ability to associate a JNLP file with a java webstart executable and run java applications in the browser via the NPAPI plugin is still supported.

To resolve your problem with administering your Brocade Fiber Channel switch using the Java applet, do the following (note: this assumes you already have Java installed):

1. Download and install the Pale Moon browser
2. Reboot your machine
3. Launch the Pale Moon browser
4. Point the URL to the IP or DNS address of your Brocade switch
5. When prompted on how to launch the JNLP file, browse to your Program Files (or Program Files x86 if 32-bit) Java directory, select the java version you want to use (directory), go to the bin directory, and select the javaws.exe as the executable for the JNLP file.  For example: C:\>Program Files\Java\jre1.8.0_91\bin\
6. If you receive a java security error, go to the Java app properties, go to the Security tab, and add the DNS or IP entry to the Exception Site list.  Don't forget to put http:// or https:// in front of the entry.

I've had this solve my Brocade switch java access problem on IBM 2498 series switches including the 2498-B24 and 2498-24E (Brocade 300-series), as well as the Brocade 5470-based BNT Fiber Channel 10 and 20-port switches for the IBM Bladecenter Chassis.  This also works on the Cybernetics VTL administration control panel for Cybernetics Virtual Tape Library devices.  I have had the case on one laptop where I had to go into the file associations (I think it was a Windows 8.1 system) and associate the JNLP file type with the javaws.exe for execution. 



Thursday, February 9, 2017

Move Your File Server to the "Cloud"