Fedora Linux Support Community & Resources Center
  #1  
Old 17th February 2017, 03:08 PM
bobx001 Offline
Registered User
 
Join Date: Dec 2012
Location: santa barbara, CA
Posts: 394
linuxfedorafirefox
Thumbs up From beyond the grave grave, Fedora to the rescue

I've been meaning to write this down for a while and just decided to leave it here, for posterity, and for whoever may find this helpful.

in 2012 I was at a "Class of '82" highschool reunion (the only one I ever went to), and when it was my turn on stage, people asked me: "what do you do ?" , to which I answered: "I solve problems, in computing of course".
To which one of my old best friends raises his hand and says: "I've got a problem".

Ready ?
OK then, he owns a Hotel, and had (still has) a billing, reservations, and guest management system, running on XENIX 2.3.4 i386 , since 1987 !!!!!!! Called Hotel-Soft, custom-made for him, (and the dude that wrote it, is already dead.) And the computer itself was once changed in 1995 with some random PC i386 33Mhz. And by the noises coming out of it, it was about to die a painful death.

So I flew down there and found myself with something out of a dark forgotten past:
1. Network ? no way
2. Every time you hit the Turbo button, the machine reboots. Fans seized. Bio-chemical dust lab.
3. The disk, 80Mb IDE was humming and chirping away like an outboard engine
But the system still ran, painfully, with its DOT-MATRIX printer connected via some strange looking internal-external serial/parallel expansion card, which was also connected to their phone system (for billing), and old PBX.
4. A root login into the Xenix yielded: Compiled COBOL application running over a proprietary database, which sorta looks like DB2, but it isn't. No sources, no documentation. Zilch. About 300 forms, and the data all inter-related, i.e. if yo u change room price in dollars it calculates pesos, and updates unknown other tables, etc etc.
5. AND THERE WERE ONLY 2MB OF SPACE LEFT OVER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
A NIGHTMARE

So I ask him: why don't you just buy a new system, there may even be open-source systems for this, for free. To which he answers: we purchased 2 of them for like 50k each, tried them, completely unusable. I want to keep this old thing running until I sell the Hotel. LOOOL.



So, how did I solve his "problem" ? .
2 choices:
A. Get all his data out, and rewrite the application from scratch, make it browser-based, in some easy text-based language like PHP, and put the data in Postgres.
B. Migrate this XENIX system out of that Hard Drive, into some Virtual Box or something.


THE WORK, which I did for free, since my reputation was at stake:
#1. We need to get a backup of all his data. At least that is my goal in that first trip down there.
a. I was able to connect to the COM2 port, change the getty in Xenix, and I was able to log in as root using "cu", at 9600baud. And my buddy had an old Toshiba laptop lying around, with a serial connector, in which I immediately installed Fedora, and left under the table, connected to the old Xenix system. That laptop then had a loop with an "xterm" being sent to one of my servers in California, (to which I "vnc" into its Xvfb Desktop, and am able to type directly into the Laptop at the Hotel)
b. Before leaving there (flying back home), I decided to take the "plunge", I took the drive out of the machine, and plugged it into an old i386 PC (win$hit 95) system he had running in some back room; however, I loaded a Knoppix CD into it, booted that, mounted my own Fedora Laptop via NFS, and I was able to at least get a "dd if=/dev/sdb of=full_drive.dd" sent to my Laptop. The Hard Drive complained a couple of times, but it finally did the "dd".
That moment was most definitely a heart-thumping experience. Imagine if all the data was lost, or the drive killed.... But it worked.


#2. So, now I had a "dd" of the full disk, 78Mb in size. Which I passed onto another guru friend of mine called Klaus in Germany, so he could figure something out. We both attacked the data, only to find out (thanks to Klaus) that the XENIX file system definition which is published in Wikipedia is actually WRONG (off by one bit) !!!!!!!!
He figured it out after weeks of testing, during which we could only get folders out, but no files, funny stuff.
So we finally got the full directory structure out, with all files. And I set out to read the data. Months went by, doing this during my spare time, and it was impossible to get a clean copy of the data. All the files were corrupted. REASON ? SIMPLE, but evil evil: XENIX keeps a mapping of the bad sectors in the Operating System itself. i.e. the information is not on the Disk. So we got all the data, but it was all corrupt !!!!!!!!!!! So, you can't successfully "dd" a XENIX disk without the actual OS running. Of course that was not to be, since I was 6000 miles away, and only talking through "cu" to a system which could crash at any second, and impossible to put a second drive into it, and it would not even work, as the system would crash the second it "does something" heavy on the cpu.

#3. So now I was stuck 6000 miles away , with a "cu" connection running in an xterm which was sent to my California server's Xvfb (also on Fedora I might add), to which I connected via VNC.
Oh dear, then it's back to rewrite the application , but without proper data. So wat I would do, is I would log in as the "hotel" user, and go through all the screens, and run screenshots in my home, so I could go and discuss them with my Hotelier friend. Luckily I flew down to his couuntry for almost 2 months the next summer, and we were able to hash out a lot, however, we had a serious problem. The system used the "F-KEYS" to navigate sometimes from screen to screen, and we were unable, after weeks of testing, to get the xterm , or konsole, or xfce term, or terminal, or whatever term I tested, so properly pass the F-KEY codes via the "cu" connection into the system.
And that simple but evil problem brought about THE SOLUTION
Reading the "UUCP" documentation (which I hadn't used since 1989 myself), I found out that there are 4 commands: ~p ~t and %p %t (Put and Take), binary is with % , textual with ~ , so I could extract files out of the XENIX system via my "cu" connection at 9600 baud, which actually by that time I had already upgraded to 19200 baud.
Things were progressing slowly, but surely.

#4. So flew back home, and I set out to extract the data, and/or anything I could find that was needed.
Another 3 to 4 months "trying" to extract the data, which was almost impossible, all connections would just drop, as errors were encountered. Say a 20KB binary file would take like 10 or 20 attempts, to properly download...... And there were thousands of files ........
At this time I remembered something I had used back then, to send files across serial connections, with proper error correction, called "KERMIT".
Problem was, XENIX had no copy of KERMIT, and there was only 2MB space left on the HD......
I went searching around the net, and found 2 important things, a Brasilian guy, who had
a. A copy of the old XENIX 2.3.4 i386 install diskettes
b. A copy of Kermit, precompiled, for XENIX 2.3.4 i386
W00000h00000

So, what to do ? hmmmmm. Well, the precompiled Kermit executable for XENIX was like 700k if I remember correctly, a massive program.
But, how do I send the actual binary INTO the machine ? Well , after 100's of tests via %p and ~p, I managed to UUencode the binary, and it gave me 2MB , which I also tried 100's of times to send in, to no avail. So I decided to "cut" the file into say 100 small chunks , which slowly but surely started trickling into the XENIX via %p and ~p. I found out that it was best transferring at 4 AM their time, with the least amount of electronic noise, and probably lowest temperature there.
So finally I had it all in there. all 100 chunks , 20KB each. Space was basically "at 100%" on the disk. Even after removing all logs, and whatever I could find that was not really necessary in the OS.
MOMENT OF TRUTH #2: I told mi friend to take the cover of the machine off, and put a powerful FAN next to it, pointing at the CPU, which he did.
I then executed this command:
cat *.cut | rm *.cut | uudecode > kermit.bin
I sweated BULLETS, and it took 10 minutes, but I got a root PROMPT !!!!!!!!!!!
ls -l kermit.bin WOOOORKEEEDD

And the space was back to 98% on the disk, all good. I then put the kermit.bin program in /bin/ , and made a loop with a wait, which would loop 10 times executing kermit, and exit. So I exited the system and tried to connect from the Kermit running under Fedora in the Laptop connected via the serial cable, and IT WORKED !

... continued

Last edited by bobx001; 18th February 2017 at 09:51 AM.
Reply With Quote
  #2  
Old 17th February 2017, 03:09 PM
bobx001 Offline
Registered User
 
Join Date: Dec 2012
Location: santa barbara, CA
Posts: 394
linuxfedorafirefox
Thumbs up Re: From beyond the grave grave, Fedora to the rescue

... continued from above:

#5. So, first thing to do, do a complete download of the full Management system, with programs, data, the works, and full directory structure, which worked perfectly well. Took some time, but it did the job.
At least I had now all data, and we could fetch it at any time, to get full backups.
I then started looking at the Brasilian dude's XENIX install diskettes, and decided this was a good time to try and run a VirtualBox with XENIX in it, like he had done, and even had a video on Youtube with it.
After a few tries:
Memory 8MB , CPU 16Mhz, etc etc, I got it running.
Now, lets put "kermit" into it. But how ? simple: enabling COM ports, and using a HOST PIPE in VirtualBox, from another VirtualBox running in the same machine. Doing the same I had done before, sans the constant interruptions.
So, finally I loaded the full app and data into a newly installed XENIX 2.3.4 , running in my Desktop at home. AND THE APP WAS RUNNING !!!!!!!!!!!!!!!!!!!!!
Sent a picture to my Hotelier buddy, and he almost passed out.

#6. SOLUTION AT HAND !!!!
a. New computer
b. Fedora
c. VirtualBox
d. Beer !!!!!!!!!!!!
But now, the nightmare of all nightmares suddenly made itself apparent. My Brasilian friend had told me that "printing was no problem", but IT WAS !!!!!
Not only because there was no way to connect the old printer in a working fashion, but also because my friend wanted to do away with the old DOT-MATRIX, and wanted to print everything in a Laser Printer.

So I went into full "full Bobby Beaver" mode , I replaced /usr/bin/lpr in the XENIX system, with a shell execution to send whatever data was coming in, to "kermit" . At the same time, on the Fedora VirtualBox sitting in the same system (which is still FC14 i386 by the way), there would be a loop, with kermit stuck on "receive", dump data into file, loop again mode.

This data would then be grabbed and converted via a PHP program that took me 3 weeks to develop, due to all the different printout formats, and that it had to "fit perfect" on a pre-printed Hotel Letterhead with "fields", etc etc. The data coming out of Xenix was not consistent either. A MESS. (But I had free food and hotel during that "PRODUCTION RUN" time )
A bloody nightmare with like 500 IF statements.
The output was then converted by me to HTML, and then via HTML2PDF, sent ito PDF.

A new database in Postgresql was created with all the Bill Numbers (which I had to decode of course), and all the PDF's sent into an LDAP (YYYY/MM/DD) for storage. And of course, once a day, everything sent off site. Once a week, shut down the VirtualBoxes and run a release, cp the vdi files over to a backup box, and relaunch.

Until Year 2015 everything was superb, and still is, but my friend called me to "modify" the program, due to the requirements by the TAX-people in his country, that ALL BILLS need to be sent IN REAL TIME, to a server of the Govt, and an "approval" code, gotten from them, needs to be inserted INTO the BILL, which the customer takes home, all needs to happen realtime. Which would be OK, if the country had a working Internet ...

But I made it work, with the help of a Cuban guy who had decoded the Govt's required communication protocol. Which sorta works, but kinda yeah well, ok mode.
Of course it now has a Proper database with the "new Bill Numberation" required by the Govt, and its corresponding internal system Numbering, for search purposes etc, and everything of course all Browser accessible for them to manage, including cancellations, devolutions, re-send data to govt, THE WORKS. And printing now does not even need Letterhead, we just generate it ourselves. etc.

Of course for this latest "upgrade", I had to charge him !!!!!

And I can thank Fedora for providing a rock solid product which I use on a daily basis.

Last edited by bobx001; 17th February 2017 at 03:24 PM.
Reply With Quote
  #3  
Old 17th February 2017, 04:10 PM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 8,453
linuxfedorafirefox
Re: From beyond the grave grave, Fedora to the rescue

Cool! an example of someone running a REAL system

That old code just never dies... Where I work, we are still running code written in the early-mid 60's, with most of it being written in the early 70's.

They did look at replacing one of the applications recently. In the package was a job with several programs that were run in a daily basis. The danged thing took 29.5 hours to run! How can you run an application daily if it takes more than a day to run once? The "homebrew" application from the early 70's that they run, doing the same thing the "new" purchased application did, runs in 2 hours versus the 29.5 hours. The old programs also ran in 16K of memory versus a little over 1GB for the new.

I can see where your friend would wish to keep running the old "dinosaur" application. It works. No bells and whistles, no frills, no huge appetite. It just works.

And big kudos to you for being able to keep him going. Not many people would have even looked at doing that. I would, but I pretty much have the same mindset, and know something about the older coding methods. Guess I am an old dinosaur as well.

And as far as charging him for the latest "upgrade" he came off cheap no matter what you charged.. You probably had him buy you a beer But it would have been worth it to him to pay you big bucks, just so he could keep his hotel in business. You don't even want to know what the going rate is for things like that. It would really have costed him some money, that is if he could have found someone even willing to touch it.
Reply With Quote
Reply

Tags
fedora, grave, rescue

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 15 rescue MohammadImran Installation, Upgrades and Live Media 2 28th April 2015 09:58 AM
Fedora to the rescue SwampKracker Fedora Focus 0 22nd November 2009 02:59 AM
Rescue fedora 10 HUN73R Using Fedora 10 15th February 2009 09:16 PM
Grave Accent dmode Using Fedora 3 29th August 2005 02:52 PM
rescue a broken LVM with a FC rescue disk morci Using Fedora 5 26th July 2005 12:05 AM


Current GMT-time: 19:31 (Monday, 21-08-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat