Tuesday, May 21, 2019

How to run pyradmon.py in Systemd on Ubuntu 18.04.2-LTS

pyradmon.py is a little python script I need running to get data from my Geiger counter (GMC-320) to its data showing webpage (Radmon.org).
The script has to always run, also after reboots, outages, changes to the system or the script itself, and it has to be restarted if it fails.
On Ubuntu 18 and many other systems a system called Systemd is in use to facilitate this.

To get the script running in systemd do the following:

Create a file called "radmon.service" in /etc/systemd/system .
[Unit]
Description=Radmon service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=30
User=marc
ExecStart=/usr/bin/python -u /home/marc/GMC/pyradmon.py
StandardOutput=null
StandardError=inherit

[Install]
WantedBy=multi-user.target
Then do:
sudo systemctl enable radmon.service
sudo systemctl start radmon.service
And if needed do:
sudo systemctl status radmon.service
sudo systemctl restart radmon.service
sudo systemctl stop radmon.service
That's it.

Saturday, May 18, 2019

How to enter Ubuntu terminal with an (old) DOS computer and a nullmodem

It is possible to use a DOS computer and enter the Ubuntu terminal via a (serial) nullmodem cable.
Even without any network installed on the DOS computer I can read my mail, browse the web or service the Ubuntu server using my old DOS laptop.

I have been using a Tulip lt 286 and it comes with an external Floppy disk port, a VGA connector that can be used for an external VGA monitor, 1 external serial COM1 port, a 2400 baud modem on COM2, 1 PS/2 port for an external keyboard, 1 external printer LPT1 port, 1 internal ISA bus port used for the IDE hard disk and 3.5 inch floppy drive and an external ISA bus port originally intended for connection to an external box containing 2 ISA BUS connectors.
I could use the external ISA bus port for a network card but I do not have the ISA expansion cable needed for this.

Getting the Ubuntu server ready

As server I used a Ubuntu 18.04.2 LTS computer that has an external COM port. There are 2 ways to add a tty to it.

1: I added "console=ttyS0" to the file /etc/default/grub in the line that now says: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash console=ttyS0" 
Save the file. You might need to have admin rights to do that, if so, open the file with "sudo".After saving the file type "sudo update-grub" in terminal to enable the new boot options. Reboot the server to apply the changes.

Or:

2: Apply a Systemd service using Execstart=/sbin/getty -L 38400 ttyS0 

Its that easy, nothing to install.

Getting the DOS computer ready.

Getting software on the old laptop is a pain because most of my floppy disks are 20+ years old and they keep failing.

I installed DOS 6.22 on the laptop and installed Norton Commander 5.5 to copy files between several computers with a (serial) nullmodem cable.

I also installed IBM-PC MS-DOS Kermit v3.16 Beta 7 patch level 0 and (eventually) found it very helpful. But if you use this program for the first time you can be a little lost as it has a steep learning curve. Here is some excellent reading material on DOS/Kermit http://kermitproject.org/onlinebooks/usingmsdoskermit2e.pdf .

With the nullmodem connected to my Ubuntu servers COM port I can now connect to an Ubuntu terminal session.
Connected to an Ubuntu terminal session via COM1
After startup of Kermit on the DOS computer type "set speed 38400" to set the speed of the serial connection. Then type "c" to open the terminal and connect to the Ubuntu server. Al other default settings of Kermit are fine.

The (modern) Ubuntu server has a far higher serial port speed compared to the DOS laptop so you will have to press the ENTER button a few times to make a successful connection. Some random characters may appear on your screen. The Ubuntu server will start with a baud rate of 115200 but will try lower speeds and eventually a connection at a lower baudrate will succeed.

The first time I logged in there was in intriguing message on the screen.
"You have new mail."
What to do? I never had this message when I logged into the server using the server itself. I never knew the server handled any mail.

I typed "mail" and saw a long list of mails the kernel send me about failures etc.
Then "r" to read, "d" to delete, "n" for next message, and so on.
It turned out I had more that 2600 mails waiting for me and the standard mail application wanted me to read them all one by one.

Therefore I installed Alpine by typing "sudo apt install alpine" into the terminal on the DOS computer. To handle the mail instead of typing "mail" I type "alpine". Without configuring anything alpine takes over and handles all mails and shows them to you in an ordered and easy text interface.

To get double the rows (lines) and columns add the following line in your autoexec.bat.

MODE CON: cols=80 lines=50

Now all seems well until Midnight commander, Alpine or any other Ubuntu terminal program is opened. Only the upper half of the screen is used. There is no way Ubuntu can find out the dimensions of your terminal so it assumes you have a VT102 terminal that like most terminal types has only 24 lines of text. Type "sudo resize" to maximise the screen space the program is using to all full 80 x 49 characters instead of only 80 x 24. (sudo apt install xterm may be needed)

I can log into my Ubuntu server from my DOS laptop which is great and completely useless.
Next thing to try is running a graphical browser on my DOS laptop. Arachne runs fine but I still need that DOS TCP/IP driver.  

How to Link DOS to Ubuntu in Norton Commander with a nullmodem cable

How to use "Link" in Norton Commander between an old DOS computer and an Ubuntu computer with Norton commander inside a DOSBox.

All was tested on DOS 6.22 with Norton Commander 5.5 running on one side and Ubuntu 18.04.2 LTS  with Norton Commander 5.5 running in a DOSBox 0.74 on the other side of a (serial) nullmodem cable.


  • Use a (serial) nullmodem cable on both COM1 ports.
  • Set the COM1 port on both computers to the same speed.(9600 is reliable on old computers) On ubuntu set the speed with "sudo stty -F /dev/ttyS0 9600". Check the speed with "stty -F /dev/ttyS0".
  • To check if the cable is going into the correct connector/port attach an old (Microsoft) serial mouse to the port, it will not work. Type in terminal "sudo inputattach --microsoft /dev/ttyS0". If you can move the pointer with the serial mouse the port is working correct and it is ttyS0. This is not a solution for a serial mouse but works fine for this test.
  • To be able to create directories in DOSBox on Ubuntu start DOSBox manually in a terminal with sudo.
  • Open DOSBox and configure "serial1=directserial realport:ttyS0". You can do this by typing " serial1 directserial realport:ttyS0" (This is confusing because you are using a cable called nullmodem and there is also the (wrong) option to go for "serial1=nullmodem")
  • Check the setting at the dosbox command prompt with "serial1"
  • Start Norton Commander 5.5 on both computers and open the menu with F9 and open the "Left" or "Right" panel, scroll down and open "Link".
Screenshot of Norton Commander 5.5 in DOSBox on Ubuntu 18.04.2 LTS

  • Choose Master on one side and Slave on the other side and press Link on both sides.
  • Now the master computer has a panel that has files on the other computer and files can be copied from one computer to the other and back.

Tuesday, May 14, 2019

Norton Commander "Link" between DOS and Win10 computer

This setup is used for transferring files between an old MS-DOS computer and a modern computer like Windows 10. Both sides are using Norton Commander only one of them is running in a DOSBox.
All was tested on DOS 6.22 with Norton Commander 5.5 running on one side and Windows 10 Pro 1809 with DOSBox 0.74-2 running on the other side of a (serial) nullmodem cable.

How to use "Link" in Norton Commander between an old DOS computer and a Windows 10 computer with Norton commander inside a DOSBox.

  • Use a (serial) nullmodem cable on both computer COM1 ports. DOSBox has not implemented the use of LPT ports. To test it with a parallel port you will need two real DOS computers.
  • Set the COM1 port on both computers to the same speed.(9600 is reliable on old computers)
  • Open DOSBox and configure "serial1=directserial realport:COM1". You can do this by typing " serial1 directserial realport:COM1" (This is confusing because you are using a cable called nullmodem and there is also the (wrong) option to go for "serial1=nullmodem")
  • Check the setting at the dosbox command prompt with "serial1"
  • Better to set this in the dosbox config file.
  • Restart dosbox and check in the dosbox terminal (The black second screen behind the DOSBox screen) if the COM port is used ok. If not, a connection in Windows might prevent DOSBox from taking the line.
  • Start Norton Commander 5.5 on both computers and open the menu with F9 and open the "Left" or "Right" panel, scroll down and open "Link".
Screenshot of Norton Commander 5.5 in DOSBox on Ubuntu 18.04.2 LTS
  • Choose Master on one side and Slave on the other side and press Link on both sides.
Now the master computer has a panel that has files on the other computer and files can be copied from one computer to the other and back.