Monday, December 13, 2021

tar

I regret what I wrote below.  It turns out that tar has gotten easier over the years, it now supports the origional unix style arguments and some easier to understand "GNU" style arguments.  All I had to do to extract my tar file was:

tar --extract --file=$filename

I need to be less grumpy.  Tarball creation is easier now too:

tar --create --file=$newtarball --$options $files

compression options; pick one: --[bzip2,xz,lzip,lzma,lzop,gzip,compress,zstd]
 

other options:
  --label=$TEXT
  Handling of file attributes - (there are a lot of confusing options here, I'm only listing a few that I can see might be useful to me:)
  --sort=[none,name,inode] (inode is a performance tweak)
  --atime-preserve
  --preserve-permissions
  --preserve-order
  --format=$tldr
      (there are some archaic (?) formats supported, the important thing to know is that tar itself has two formats tar<=1.12.x  and tar=>1.13.x - hopefully I never have to care about this; but it seems like something that could bite the llamas ass.)
  Device blocking options - (these are options that you don't need until you really need then, and then you find out that good-ol-tar is [hypothetically] the only archive format that can handle your input...)
  Device selection and switching - (these options seem to have everything to do with tape backups.  I have three Tandberg tape libraries.  I want to learn how to use amanda. I don't want to use tar to make multi-volume tape backups.  But it's good to know I could; but I'd never be able to find anything without some sort of very complicated index.)
    Extended File Attributes - ACL's, SELinux, and xattrs options.
 

I still think we need a revolution in open source usability.  But; we're not going to be there by spreading grumpiness.  - Perhaps I should limit the number of blog posts I write at 2:45AM.  :-)

I've come to dread every tar ball download.  Because I know I'm going to sit there for at least 10 minutes desperately scrolling through the contents of 'man tar'  trying to figure our how to extract the files.

I still remember how to use pkzip and pkunzip, version 2.04g - their help files were SOOOOO easy to read and understand.

Why does tar have to be so horrible?  I can't even imagine how much more difficult it would be if I wasn't a native english speaker.  -- Although I suspect the man pages are probably smart enough to display help text in your language of choice; if such help exists.

Manual page tar(1) is 965 lines long.  At ~60 lines per page that's 16 pages.  There are about 4 million websites out there that have been written to answer the question "how to untar"

Open source software is CONSTANTLY shooting itself in the foot.  Because the philosophy is so attractive, so GOOD, uncountable human hours have been spent developing amazing open source tools, which any sane person would/should avoid like the plague, because they are just too complicated to use.

We need a revolution in open source, a usability revolution.

[Snort]  check this out...

"failed-read
                     Suppresses  warnings  about unreadable files or directories. This keyword applies only if used together with the --ignore-failed-read option."

So to suppress an unreadable file warning you have to use the --ignore-failed-read option and the --failed-read option?  I'm so confused and flabbergasted....   The madness just doesn't end!  These 16 pages are the BRIEF version!  Apparently I'm supposed to read the 'info' pages for the full version.


Computer Name Resolution, DNS and Friends - My Musings and Ramblings

 I intend this to be a blog post that I'm going to update, but it might make more sense to move this information to a personal knowledge web....   We'll see.

 DNS  -  You want to contact a computer to which you know the name of?  No problem.  The computer your using makes a request to a Domain Name Service, asking for an IP address for the server, then proceeds to connect to the server using it's IP address. - Simple!

Many internet fundamental technologies were created by very clever people in robust and simple ways and have either stood the test of time; or developed such a historical inertia that they had to be kept the same or else everything thing would break.  Many of these technologies have been extended and expanded in very clever ways to function better and more completely today then they ever have.

At first blush Computer Name Resolution doesn't seem to be one of these golden children.  Check out the Wikipedia History on DNS - In 1973 ARPANET used a hosts.txt file on each system, and apparently it was managed by Jake over at Stanford.  She managed all computer name resolution for ~17 years.  --  Stick that on your resume and smoke it.  --  Oh, and she invented Domains.  --  Although I 100% believe Jake was clever; the systems that she and her team put into place have not been robust.  The one constant for DNS seems to be that it constantly changes; and stays the same.

I imagine there is a ton of awesome history between 1989 and now.  But I'm trying to get my server to work, so I'm going to focus on today.  Today Jake has been replaced by a group known as the"Internet Assigned Numbers Authority" (IANA). 

Or excuse me maybe it's the Public Technical Identifiers (PTI) that actually run things, they are an affiliate of ICANN, contracted to preforn the IANA functions on behalf of ICANN.

Based on my messed up preconceived notions and the very few things I think I've learned about ICANN I believe them to be completely morally bankrupt.    --  Really, never in history has a bureaucracy been worse than ICANN.  As far as I know they are completely useless and  a massive detriment to society in general.  The only way to get anything done with ICANN is to provide nation state level bribes to it's ~388 employees. 

Jon Postel did it better in his spare time and without charging anything for his services.  

None of this should have happened, it's a modern tragedy. 

"Once you realize what a joke everything is, being the Comedian's is the only thing that makes sense."

—Eddie Blake

So forget it, lets move on.  Lets look at the technology, and see what's been done and where we can go from here.

If you have something on the internet, you probably started with getting a name from Jon/ICANN/PTI/IANA, lets call them JIPI.  JIPI authorizes registrars to charge you yearly for your name. 

Either those registrars, a hosting company, or you, must provide DNS servers to go along with your name.  You maintain 'records' with those DNS servers so that when someone requests information on how to contact your site the DNS server responds with an IP address, or such, which the requestor can use to contact the computer that is hosting your site.  "Site" in this case could be a web page, game, virtual world, or whatever...

I just looked up "josiahluscher.com" and a name server ns3.dreamhost.com replied with an 'A' record and the IP address 64.90.48.157

Neat eh?  DNS servers are hierarchical, and divided up into zones.  So if whatever DNS server you contact doesn't have an authoritative answer, it asks the lowest server that it knows will be able to find the answer....  That might be the root DNS server. The root server won't give an answer though, it just refers the requester to a higher level server that should have the answer.  this referral process may repeat several times. Finally the "authoritative" DNS server is found, and then you get an answer.

Obvious challenges to traditional DNS:

  1. Internet DNS, doens't know about local networks, so a local DNS is needed.
  2. Multiple computers serving many users who all expect to use the same service.
  3. Prevent malicious actors from replying with fake destinations to perpetrate man-in-the-middle attacks.
  4. Others?



Pieces of software that I want to learn about related to DNS:
nmcli - NetworkManager
systemd-resolvd
dnsutils
ifupdn
iproute2
resolvconf
dhclient
net-tools
mDNS

nmcli

In terms of ease of use and the help information available nmcli is one of those programs that give Linux a bad name. 

 [Good news though I did solve my immediate problem that inspired this post.  My eno1 wired gigabit ethernet interface was setup with a static IP and static DNS records which were no longer correct. The way to change that interface to DHCP and remove the old records is this:

nmcli device show eno1
less /etc/sysconfig/network-scripts/ifcfg-eno1

nmcli con mod eno1 ipv4.ignore-auto-dns no
nmcli device modify eno1 ipv4.method auto
nmcli device modify eno1 ipv6.method auto
nmcli con mod eno1 -ipv4.dns [Old.Incorrect.DNS.IP]
nmcli con mod eno1 -ipv4.dns [Old.Incorrect.DNS.IP]
systemctl restart NetworkManager

nmcli device show eno1
less /etc/sysconfig/network-scripts/ifcfg-eno1


To be continued someday....

Sunday, November 28, 2021

Serial RS232 Lessons and Musings

Yesterday and today I made all the mistakes I could possibly make connecting to a serial device, EXCEPT for letting the smoke out.   Win? ¯\_(ツ)_/¯  For posterity, and for future Josiah, here are the two big mistakes and I made and lessons learned.

First mistake: I used an Isolated 5v RS485 adapter to attempt to connect to an RS232 device. - It didn't work; but I do wonder if it would have worked, if I had used a level shifter.  I might try that later.

The differences between RS232, RS485:
(Table copied from here.)


RS232RS485
Voltage SystemVoltage level-basedDifferential
Total Drivers and Receivers on One Line1 Driver, 1 Receiver32 Drivers, 32 Receivers(One Driver active at a time)
Line ConfigurationPoint-to-pointMultidrop
Maximum Operational Distance15M / 50FT1,200M / 3000FT
Maximum Data Transmission Rate1MBit/s10MBit/s
Duplex ModeFull DuplexHalf Duplex or Full Duplex
Maximum Driver Output Voltage+/-25V-7V to +12V
Receiver Input Resistance3 to 7 kΩ12 kΩ
Receiver Input Voltage Range+/-15V-7V to +12V
Receiver Sensitivity+/-3V±200mV
 

  • The RS485 standard does not  define a communications protocol, these are the ones I'v been able to find so far.:
    • Modbus - Open Protocol, common in factory automation.
    • Profibus - IEC 61158 standard, common in factory automation.
    • (?) - Commercial aircraft cabins' vehicle bus
    • DMX512 - Stage lighting and effects.
    • AES3 - Digital audio transmission between some 'pro' audio gear.
    • (?) -Building automation, surveillance and door control devices.
    • DCC - Digital Command Control for Model Railways
  • Regarding distance for RS485: A quick approximation is that the length of the line in meters and the data rate in bits per second should not exceed 108. For example, a 20-meter cable would probably allow a data rate of 5 Mbits/s.
  • RS-422 is a variation of RS-485 with similar specifications but is designed only for one driver and up to 10 receivers. 
  • RS-423 is a single-ended rather than differential variation of RS-422.

Both RS485 and RS232 send data serially, but that's about where the similarities end.  RS485 is great for long distance multi device connections. RS232 is great for cheap device to host connections.

 Why use RS232 at all if RS485 is better?  Many reasons. First like the width of railroad tracks, RS232 has been around forever.  It has historical inertia.

(Historical information from LinusAkesson, and Wikipedia.)
    RS232 became a standard in May of 1960; but it's roots go MUCH farther back than that.  The stock ticker, invented in 1869, is really the start of serial data transmission standards.
    But it gets so much more wild than that!!  The stock ticker evolved into the ASCII teletype.  Teletypes were once connected across the world in a network called Telex; used to send telegrams.  Global text messaging(!); but you know, on paper at both ends.
    As computers moved from batch processing static data, like punch cards, to becoming fast enough to interact with humans in real time; some sort of user interface was needed, and Telex machines were readily available.  Underneath the hood the Unix/Linux Kernel still today relies heavily on manipulating streams of data; exactly like those from a serial teletype, or to a cast iron stock ticker from the mid 1800's.  If you want to understand Linux, I strongly recommend digging into this.  Amazingly technology from 1869 influenced how the terminal on modern computers today operate.  Seriously, check out the Linus Akesson site, link above; it's good!

Second reason why you pretty much never see RS485:  I feel like RS485 never really caught on.  Today on Digi-Key a 500kbps RS485 chip costs $3.37, a 10mbps Ethernet chip is $3.06, and if you want them in bulk you can get 100mbps Ethernet chips for less than a dollar.  I suspect that RS485 didn't catch on because for single devices RS232 was easier and cheaper, and for multiple devices networks like Ethernet were in most cases a better option.  -  Clocks in buildings are an interesting exception.  I've seen some strange systems for synchronizing the clocks throughout a building, including RS485.

 Second mistake: For my second attempt I used an isolated 5v RS232 to USB adapter to connect to a 3.3v serial device.  

I was able to get some garbled data from the device using this.  At first I thought it was a problem with baud rate, or something more esoteric like a bit-wise inversion.  However it was just the wrong voltage.

 A few notes on real world use of RS232:
    The early RS232 official standard "zero" was represented by a voltage of between +3 and +15 volts, and "one" was a voltage between -3 to -15 volts.  In the EIA-232 standard it was increased to +/-25 volts!  Today, "nobody" does this.  RS232 voltage is either 0v/5v - or - 0v/3.3v.  If you connect your expensive computer to a lot of serial devices it's a good idea to get an isolated USB to serial adapter.  Then if you do happen to plug into a real/old RS232 port you don't fry your computer with 50v AC into your USB port.
    RS232 officially has 11 different wires (DCD, DSR, RI, RTS, RTR, CTS, TxD, RxD, GND, PG) - Unless your using a modem over a POTS phone line you will only use three wires, TxD, RxD, and GND (maybe also a shield for PG).  I remember connecting to BBS's as a kid and having a vague knowledge of RI and CTS and such.  I'll be surprised if I ever have to do that again. Three wires and a shield are all you need.
    I plan on making a level shifter with DB-9 plugs on either side that I can add to my little collection of gender adapters and null-modem adapters.

Third lesson: Not all inexpensive USB to serial adapters are the same or even sane.
    Some inexpensive USB to serial adapters that have a 3.3v Vout pin: still output 5v on the Tx pin!  -  Also strange, but more useful are adapters that are the reverse:  3.3v Rx and Tx, with a 5v Vout to maybe power a device with.

    Be careful when buying a USB to serial adapter, know what your getting, and know that eventually you might need more than one type!

If you use USB serial adapters professionally: don't use a cheap adapter.  It's not worth your job.  When I'm connecting to an expensive PLC processor, or the console port of a fancy network switch, I don't use a serial adapter I got from a stranger in another country for 5$.  For professional work I really like the ones made by Advantech, I have an older version of BB-USO9ML2-A, 2,000+ volt isolation, quality design, and no corners cut provide a lot of piece of mind.

    But for hobby work, if you want to spend much, much, less you can get isolated or non-isolated ones from Aliexpress.  If you want to buy American, Adafruit sells a nice selection.

*** NOTE!!  If you don't want headaches, consider paying a little bit more and get a USB to serial adapter with a real FTDI chip.  The cheaper chips like the PL2303 and CP2102 usually work fine after you find, download, and install drivers for them.  But there are some devices that you just can't connect to if you don't have a real FTDI chip;  and yes there are fake FTDI chips out there.  I've held one in my hand, it was labled FTDI, but it was not.  Even with the correct drivers it could not connect to many Allen Bradley PLC's.  ***

(These are not affiliate links, I don't care what you buy.  :-) )

Now that you know about the variety of USB to serial adapters, you are going to have much fewer problems transferring data over serial ports!  Have fun!

PS: I've already expanded and updated this post, several times.  This may end up less of a blog post and more of a 'living' document.







Thursday, July 15, 2021

Linux Sucks!

 So I tried to take a screenshot today, but I couldn't find it.  I had previously set a setting that saved my screenshots in a specific place.  It took about an hour for me to figure out where they were going.  

 (I was slightly thwarted because I was hitting Ctrl-PrintScreen - on my last laptop the print screen button required hitting Fn and I got confused.  Ctrl-PrintScreen puts the screenshot into a paste buffer.)

So after finding out where the screenshots were going I tried to set the setting again to get the screenshots to once again save in the correct place.

Things like this shouldn't happen in a modern polished Linux Distribution like Debian; but the popular belief is that there are a lot of volunteer programmers who work on Linux, so mistakes happen, because they aren't professionals.

That's not the case here, check out the webpages linked below. These are small people who have the power to help, but are too focused on maintaining their power over their little corner of the operating system.  They refuse to communicate effectively; or solve a problem that many users are having.

After doing a bit of research, there are a few ways to fix it and make it work again.  Users shouldn't be expected to go to great lengths to change a setting...  I may give this more consideration later and see if I can unravel this web of garbage; but I have to work in the morning, I need to sleep now.

Relevant pages:

https://askubuntu.com/questions/114429/how-can-i-specify-the-default-save-directory-for-gnome-screenshot
https://bugzilla.gnome.org/show_bug.cgi?id=699642
https://cialu.net/how-to-change-default-gnome-screenshot-savings-folder/
https://help.gnome.org/users/gnome-help/stable/screen-shot-record.html.en
https://unix.stackexchange.com/questions/279985/how-do-i-change-the-location-where-screenshots-are-saved-in-linux-mint-17-cinnam
https://unix.stackexchange.com/questions/279985/how-do-i-change-the-location-where-screenshots-are-saved-in-linux-mint-17-cinnam
https://wiki.debian.org/ScreenShots
https://forum.manjaro.org/t/gnome-change-default-screenshot-location/67834
https://forums.debian.net/viewforum.php?f=6&sid=96b34c5e3e27354cd0582ff268e79c68

So you can install custom scripts in your home directory.  You can disable the six included shortcuts and make new ones pointing to a different screenshot program, you can install a 3rd party "Gnome Shell' extension, or. apparently there is a way to do it with systemd user units???  But you get the idea...

Petty bickering has removed this feature for millions of people.
Linux Sucks!

But at least you can fix it, if Microsoft doesn't want you to take a screenshot you simply won't be able to.

Monday, July 12, 2021

Its Time: Linux is better than Windows.

 I'm struggling to set the time on windows 10.  I'm working on an industrial computer/touchscreen that is not connected to any network.  For security we never connect these machines to the internet.  I need to set the time to within a couple/three seconds.

It appears this can't be done from the GUI.  Is Microsoft using so much code from Linux that a terminal window is becomming required?

Windows is so awful, I just don't understand why anyone would want to use it.  -  It's maybe a bit easier, but it's getting harder to use, and now Microsoft spys on you, and manufacturers can lock the BIOS.....  It's NOT your computer if it has Windows on it.  Why buy a computer that's not really yours?

Sunday, August 16, 2020

Working with computers is getting harder, because of obfuscation.

TLDR:   Fuck you Dell!

I purchased an Inspiron 17 1700 and although I really like many features of it, it's obvious that all the effort went into making a computer that looks good from the outside, but is crap on the inside. 

Right now I'm struggling with WiFi, the M.2 WiFi/Bluetooth card that it comes with is an ok B/G/N card.  But the pace of technology is accelerating, and I need at least AC support if not the latest and greatest AX.  

So, I'm hunting for a replacement WiFi card, and I want to know what cards the M.2 slot supports. Their specification document says "One M.2 slot for WiFi/Bluetooth" . Not helpful.  

From their own documentation there are several different keyings and sizes of M.2 slots that can accept WiFi/Bluetooth cards.  I think even among the differently keyed slots there are likely to be other support issues.  The whole M.2 slot ecosystem is the opposite of straight forward.

 Icing on the cake, is that their feedback system is currently down, so the only way I can shame them is on this blog.   Which no one reads because mostly it's just me ranting about problems.  (Sorry!)

I really want this to be a good day.  I'm going to keep trying.

  :-)

Update: As far as I've figured out an A-keyed or an A+E-keyed M.2 slot will accept A-keyed or A+E-keyed WiFi cards.  E-keyed cards must go only into E-keyed slots.

Still haven't found any detailed technical documents on these slots; but I'm feeling better about this.  I bought a pair of Intel AX200NGW cards, so hopefully they are backward compatible with me A-keyed M.2 slot. 

When I removed the Intel 9260NGW from the motherboard the antenna studs broke off from the WiFi card and got lodged in the antenna wires.  I'm so proud of me I didn't even get upset.  I just carefully pried the debris out of the connectors and moved on.

I'll have to install the original card when I get home.

Monday, June 24, 2019

Bridge to the Shop

It works!

It has taken weeks and many many hours.  I have (almost) completely ignored everything else in my life like dishes, pets, family and friends.  The sacrifice has finally yielded success. - To my wife, I'm sorry, and thank you! - To the world I say:   Pbbbtth!    I did it, and I don't care if you think it's stupid or awesome.

I have two Raspberry Pi Model 3 B+'s on my desk, each with an EDUP 600mbps WiFi adapter, power adapter, and sdcard plugged into them.  They are a WiFi network cord.

If I use an ethernet cable to connect one RPi to my internet router, and another ethernet cable to connect the other RPi to a network switch in the garage...

Well it does exactly what you would expect of a long ethernet cable.  The two switches are connected together.  If multiple device are plugged into the switch in the garage, they get ip adresses from the internet router in the house, and connect to the internet. - Simple, functional, adds a few milliseconds to a ping, and a slight bandwidth hit.  ;-)

 Victory!

Ok, so I can ping.  Actual throughput is not great.

Normal 'N' WiFi ~19Mbps bandwidth
My WiFi Wire     ~ 65Kbps bandwidth

That's so bad it makes me laugh....

My WiFi adapters are currently only using one 20Mhz channel, and the Raspberry Pi's don't have a hardware network switch in them.  So bandwidth is, for now, terrible.

More testing is necessary.  Now that I know how to set this up maybe I need to move it to EspressoBin's, or an RPi4 (Just released today!)  :-)

I'll see if I can increase the speed and post a Edu-torial.

UPDATE:
Ha! I found the problem!  MTU on the clients MUST be set to 1446 or less.  -  I didn't realize that fragmenting packets would cause a 3000x slow down.  Once Packet size is enforced to be small enough to prevent fragmentation I get very good speeds of 30Mpbs
Next up increasing radio bandwith from 20mhz to 80mhz.  Dare I go to 160mhz?!?!?  - Only time will tell.  
(There are legal issues here in the US with using 160mhz outside, it interferes with like weather prediction stuff...(?) - Apparently it's possible with some WiFi equipment to use two different 80mhz bands, getting effectively 160mhz; not sure if there are two full 80mhz bands that I can use outdoors legally. - I think if you enable special power regulation and stuff that you can do it.)