OFF AND ON LINE
Phew, it was so hot today even the ants were breaking in to enjoy
my air-con. They went nowhere near any food, just running around on
the floor near the door. Unfortunately I was trying to read that
book I mentioned in my last post (quite an exciting first chapter,
full of vivid air battles fought by the author, though he's lost
his plane already now) and they kept crawling up me - I had to
fashion a foot-rest out of cardboard boxes to try and get above
their level. It's amazing how alive it is outside on these warm
nights too, which unfortunately means I can't open the windows
because with the light on I'll drown in those tiny but innumerable
bugs that somehow get through any seemingly insect-proof barrier.
Actually on second thoughts I'll try a lights-off approach and see
if they notice just the CRT alone. Oh, there's one landed on it
already...
Anyway this is actually one of my tech posts. Late last night and
most of this morning I was battling to get OpenWrt v23 to run on
the late 2000s router that I use (ie. the only common second-hand
router model that I've ever found supported by OpenWrt). Although
this hardware was already officially unsupported with v22 I was
running before, the RAM pinch seems to really be hitting now.
Nevertheless my initial trouble turned out to be seemingly a
hardware problem causing Ethernet and WiFi to intermittently not be
detected. After switching to one of my other two same-model
routers, the second one at least always showed all the physical
network interfaces with ifconfig. The 3G/4G USB modem wasn't
working because I'd made the exact same mistake I made (and wrote a
note to myself about!) a year ago, forgetting to copy over the
slight modification needed to the default chat script. Beyond that,
troubles were from running out of RAM during start-up. I threw out
lots of unneeded daemons: FTP, NTP the RNG-feeder, plus DirectIP
and IPv6 stuff which never worked properly with my modem/ISP
anyway. That got it booting, but still with a process or two
getting murdered by the desperate RAM-starved Linux kernel during
boot. Everything seemed to work anyway, but I decided to also
disable the syslog daemon since in normal use I used those logs so
little I had to check the docs for the command to read it (and
'logread' isn't exactly hard to remember). That worked great - no
more out of memory errors. Except mysteriously the networking
wouldn't work. I messed around for ages with different variations
but it seems, unlike other Linux systems, something in OpenWrt just
won't work without a syslog daemon to complain to, and I can't tell
what because I've disabled the logs! So logd stays, and everything
works, but I'm not quite happy. I'm also waiting around 5min 20s
for it to finish booting, but in normal use that rarely matters.
My main motivation was actually just to get it done before I set up
an internet data usage monitor, because I fear setting something up
nicely just before a major upgrade and having it all break
immediately afterwards. Especially for this because I've even ended
up relying on my compatibiliy nemesis: SSH.
As I complained about in 2023-12-22Phone_Disservice.txt, the USSD
service that I was using to check my remaining mobile broadband
data allowance for my home internet stopped working. It's still the
same - no response to 3G USSD requests at all - so I'm sure they've
turned it off. As described in 2021-05-15USSD_Browsing.txt I
switched to that after my ISP (Telstra) stopped offering a web page
to view that info without needing to create and log into an account
(which I don't want to create, or be required to use Firefox/Chrome
to do it). Now I'm out of options, so I've just been guessing,
albeit helped by the recently much more chatty automated emails
which shout warnings at various stages as the data limit nears.
There are unsurprisingly lots of 'bandwidth' monitor (I consider
bandwidth to be an instantaneous measurement so I don't like this
terminology, but many seem to) systems available for OpenWrt:
https://openwrt.org/docs/guide-user/services/network_monitoring/start
But somehow they all seemed a bit confusing and often geared at
much larger tasks. I was also concerned about dependencies filling
up the remaining 900K of flash on the router, and not wearing out
that flash with lots of data usage log writes. Perhaps I'm just
falling victim to "not invented here syndrome", but I discovered
/proc/net/dev and it all looked trivially simple to just implement
it myself with a shell script.
Of course it wasn't, mainly because to solve that flash wear
problem (2000s-era router flash wasn't designed to handle regular
writes, just the occasional settings change and software update (as
if any normal person in the 2000s actually updated the software on
their router anway)), I decided to store the long-term totals on my
"Internet Client" Single Board Computer. So the script uses SSH to
fetch the data, via another script on the router that knows how
much data it's already talked about since the last reboot to make
sure data doesn't get counted twice.
The result is that I can Telnet into my Internet Client computer
(something the OpenWrt devs make frustratingly hard, in preference
for SSH), and run "icli.sh" to get:
Down: 10MB Up: 0MB Total: 10MB
(yes that's all the data I've used in an afternoon+evening)
Then when more data arrives in the post (yes in a way I get my
internet by mail), I can just do "idata.sh reset" and it's all
zeroed out for the beginning of another 28 days. Or 180 days with
the next SIM I've got coming, hence why I thought I should finally
sort this out since that's a long time to guess!
A clearer description is in the about_idata.txt file:
gopher://aussies.space/0/~freet/scripts/about_idata.txt
Along with the idata.sh and send_idata.sh scripts themselves in the
scripts section:
gopher://aussies.space/1/~freet/scripts/
Actually it is pretty specific to my usage, so I doubt anyone else
would be interested. The main reason I published it was, somewhat
ironically, because I think it sort-of qualifies for Solderpunk's
OFFLFIRSOCH 2024 chalenge:
gopher://zaibatsu.circumlunar.space/0/~solderpunk/phlog/announcing-offlfirsoch-2024.txt
The irony is that the challenge is all about writing software to
perform tasks offline, but the task this achieves is measuring the
amount of data used online. It's sort of offline online software.
But following Solderpunk's description:
it either makes no use of the internet whatsoever and happily
functions entirely offline without even being aware that anything
"unusual" is happening, or else it does make use of the internet
but is fundamentally designed around the assumption that the
internet is not always available and maintains 90% or more of its
functionality when used offline, and will continue to do so no
matter whether it gets internet access once per week, once per
month, once per year or even longer.
I think it qualifies. If the internet is disconnected, it will
continue to tell you how much data you had used before that, for as
long as you survive in the offline abyss. Technically the USSD
codes I was using before weren't the internet either (except on 4G
where more concerned ISPs than mine reportedly have ways of
tunelling USSD requests over the internet), but I think this one is
definately my most offline solution, for helping me to stay online.
Oh, and yes the script has a spot for a plain-text root password
(the router doesn't have multi-user support installed). Yeah I know
that's a crime against security, perhaps humanity, but it's what I
need to run it when I push the power button on my headless Internet
Client computer at the end of the day, and a passphrase-less
private key wouldn't really be any more secure.
- The Free Thinker