Compiler Bug
2013-05-19
My weather system has had difficulty in recent days with delivering regional stats. The capture program was to read through a list of .ini data and process accordingly. Unfortunately, it was running about five iterations and then crapping out.
Turns out it was a compiler bug.
At times, it just worked; at other times, it wouldn't work at all. The compiler itself was generating bad code.
In the end, I unravelled the loop, so to speak: the program now accepts command-line parameters and iterates just once for each location. It works!
Now I can go back to figuring out why the forecast isn't appearing for CTO.
-Bill
Sunday, 19 May 2013
Friday, 12 April 2013
Chewin' Gum and Bailin' Twine
2013-04-12
My upgraded weather system has gone live. It took some work to get there.
To summarize, my new home weather station includes a wireless LCD display, like the old one, but with more data fields (wind speed and direction, and precipitation). Second, our cats frequently knock the data-capture camera out of position, forcing time-consuming recalibration. The new version of the capture software makes it much easier to realign onscreen elements within the GUI environment.
It took trial, error, and plenty of arithmetic, but I'm getting the capture program fine-tuned, and the data are looking fairly reliable. I do have to rejig the Humidex and Wind Chill calculation routines. No biggie. In the process, I've learned a lot about image processing. For example, the webcam delivers a colour image, and I find that the green channel is the sharpest; so I use only the green values from the image.
The optical part of the data-capture process was the most time-consuming part. I completely revamped how the system processes and validates the data from the LCD. It now compares the average brightness for each character-segment against the brightness of a pre-selected control area for that character. An adjustable darkness threshold allows tuning between false-negatives and false-positives. One field is a differential value (current reading minus last reading), and another is a comparitive (select only the darkest of an array of segments).
The sky-observing software now outputs its results directly to the data-capture program, for integration into the data feed to the weather system itself. Minutes of sunshine are imputed and recorded.
I've been tinkering with the weather software, to ensure it's properly recording and reporting the readings given it.
Looks good, so far.
-Bill
2013-04-12
My upgraded weather system has gone live. It took some work to get there.
To summarize, my new home weather station includes a wireless LCD display, like the old one, but with more data fields (wind speed and direction, and precipitation). Second, our cats frequently knock the data-capture camera out of position, forcing time-consuming recalibration. The new version of the capture software makes it much easier to realign onscreen elements within the GUI environment.
It took trial, error, and plenty of arithmetic, but I'm getting the capture program fine-tuned, and the data are looking fairly reliable. I do have to rejig the Humidex and Wind Chill calculation routines. No biggie. In the process, I've learned a lot about image processing. For example, the webcam delivers a colour image, and I find that the green channel is the sharpest; so I use only the green values from the image.
The optical part of the data-capture process was the most time-consuming part. I completely revamped how the system processes and validates the data from the LCD. It now compares the average brightness for each character-segment against the brightness of a pre-selected control area for that character. An adjustable darkness threshold allows tuning between false-negatives and false-positives. One field is a differential value (current reading minus last reading), and another is a comparitive (select only the darkest of an array of segments).
The sky-observing software now outputs its results directly to the data-capture program, for integration into the data feed to the weather system itself. Minutes of sunshine are imputed and recorded.
I've been tinkering with the weather software, to ensure it's properly recording and reporting the readings given it.
Looks good, so far.
-Bill
Wednesday, 10 April 2013
My Babies
2013-04-10
I love cats. They're fun, bright, cuddly and mostly self-maintaining.
Teeka is a sphynx cat--she's hairless and a bit on the smallish side. Elroy just joined the family a few weeks ago. He, too, is a sphynx, but full-sized. He's a total lovebug, and the two have hit it off famously.
Here's a shot:
Sphynxes are extra-bright and engaging; there's always one hanging out or looking for lap space, or play... or treats... or nip--or, most importantly, warmth!
Teeka--the little blue-gray one in the pic--loves to play, either with toys, or one-on-one. At random, she'll run up and start roughing-up my leg, making nasty-faces and generally looking for trouble. That's my cue to jump up, raise my arms, roar like a monster and give chase. She flees up the stairs, then comes charging back once I turn around. In her previous home, she'd spent entire winters huddled up to the impotent baseboard heaters. In summer, she's a total sun slut. She baked away last summer, on the balcony, while I looked for work. Now she's got spring fever and has taken to charging defiantly out onto the front step for a sniff and a shiver, when someone comes home.
Both like their spankings--it's a peculiarity of the breed. Teeka's favourite spanking pose is left-cheek-up, clinging to the end of the arm of the chesterfield; for Elroy, it's on the bed. Flop-"'Pank me!"
Because their faces are bare, Sphynxes broadcast their emotions more readily. I know at a glance what kind of mood Teeka's in, and usually what she wants. She gives 'the look' better than Mother; and when she's agitating for a tussle, her little Shatner-aping grimace telegraphs "Khaaaaaaaan!". And, boy, smiles are special!
This post is mostly for the benefit of my friend Natasha, who's breaking into Northern life on her own and whose three little doggies are still waiting to join Mommy up North. I know this picture will bring her a smile.
Have a good week.
-Bill
2013-04-10
I love cats. They're fun, bright, cuddly and mostly self-maintaining.
Teeka is a sphynx cat--she's hairless and a bit on the smallish side. Elroy just joined the family a few weeks ago. He, too, is a sphynx, but full-sized. He's a total lovebug, and the two have hit it off famously.
Here's a shot:
![]() |
| Elroy (pink; foreground) and Teeka |
Teeka--the little blue-gray one in the pic--loves to play, either with toys, or one-on-one. At random, she'll run up and start roughing-up my leg, making nasty-faces and generally looking for trouble. That's my cue to jump up, raise my arms, roar like a monster and give chase. She flees up the stairs, then comes charging back once I turn around. In her previous home, she'd spent entire winters huddled up to the impotent baseboard heaters. In summer, she's a total sun slut. She baked away last summer, on the balcony, while I looked for work. Now she's got spring fever and has taken to charging defiantly out onto the front step for a sniff and a shiver, when someone comes home.
Both like their spankings--it's a peculiarity of the breed. Teeka's favourite spanking pose is left-cheek-up, clinging to the end of the arm of the chesterfield; for Elroy, it's on the bed. Flop-"'Pank me!"
Because their faces are bare, Sphynxes broadcast their emotions more readily. I know at a glance what kind of mood Teeka's in, and usually what she wants. She gives 'the look' better than Mother; and when she's agitating for a tussle, her little Shatner-aping grimace telegraphs "Khaaaaaaaan!". And, boy, smiles are special!
This post is mostly for the benefit of my friend Natasha, who's breaking into Northern life on her own and whose three little doggies are still waiting to join Mommy up North. I know this picture will bring her a smile.
Have a good week.
-Bill
Tuesday, 9 April 2013
C'mawn, April Showers!
2013-04-09
No, I'm not pining for a porn actress. I'm waiting patiently for it to rain.
New Toys
About a month back, I ordered a new weather station, which arrived about ten days ago; the dr.Tech WA-1070-T. It's wireless. It includes wind and precipitation. It includes a solar recharger.
One unexpected omission from the package: USB capture. Dammit. Chumped by an assumption on my part.
So, I'll be back to OCR'ing an LCD display.
Back to the Fixture
(If that statement mystifies you: I capture my 'local' weather data from the LCD display of a cheap home weather station. A webcam snaps a picture of the display, and custom software quite literally interprets what's on the screen and passes the info along to the weather software proper. Versus wiring in and programming the necessary circuitry to interface it electronically, it's the best/simplest/cheapest solution. And I'm damned certain I'm infringing on some troll's patent, somewhere, in doing this.)
I've had the new station installed and in testing for about a week. Since then, it's been bloody windy, causing me to suspect vibration of the 'transmitter' unit--not the rain gauge mechanism itself--as the source of spurious readings. I'm supposed to get precipitation data in increments of 0.3 mm. What I've been getting is a string of spurious readings, 15.2 mm at a time--and this after having secured the rain gauge to a flat, stable surface. What I'm suspecting is a loose connection, in conjunction with resonant vibration in the sensor mast.
Making Ready
I've been upgrading the data-capture software, with two competing goals in mind:
Make it capture more data
Make it easier to use (GUI-squishy) and more configurable
Issue: There'll be a number of new fields on the new display (wind speed and direction, and running-total precipitation). The number of fields actually captured may vary and could change again in the future, when I try to upgrade to something even-better and chump myself again. Honest-to-'Ghettimonster, I will be absolutely certain, next time, that it's got computer connectivity. *makes coiling motions with left hand*
So, make the data fields configurable and more flexible
Issue: We have a new, active, male feline addition to the households. Prowling occurs, as do minor upsets, such as trying to perch on the Centretown Observatory Data Capture Stage, which began life as a microwave cart with a nordic moniker. Disturbances to the webcam and/or the display panel (position and orientation) are a major pain, as viewpoints change, and the camera must be realigned simultaneously with the data-capture software.
So, make it easier and faster to realign.
The revised version of the capture software now recognizes any number of user-definable data fields, in which the individual digits can be expressed as a box and the expected segments scanned automatically; or each individual segment can be defined to specific coordinates. (E.g. on the new display, the leading digit for the barometric-pressure reading is either blank, or 1 (i.e. two segments.).)
The configuration file is so simple, yet flexible, it really deserves a full page of documentation. The initial calibration is done by hand, field-by-field and character-by-character, and entered into the config file. Following that, realignment is easier. Once the camera has been levelled and roughly pointed in the right direction, the data search-boxes can be adjusted onscreen either globally, or by field. A future version may use special markings for auto-calibration.Eventually, I'll add interface elements to manage configuration completely visually.
So, a few polishing touches to the data-capture software, and a one-time calibration, and I'll be collecting live data from the new station. The only catch is that I need to see a little live action from the rain gauge; to see how real data are reported, before deciding how--or, indeed, whether--to handle rainfall readings.
Water, Water, Everywhere--And Not a Drop to Measure
It hasn't rained much, nor at the right times, since I set up the new equipment.
It's supposed to rain tonight. I've been following the front in on local radar. It's... in the neighbourhood but kind-of regrouping.
To paraphrase The Simpsons' Apu Nahasapeemapetilon (big fan; love the blithe fatalism):
Rain, rain
Go away
...and please come again!
(And that brings us to 410.4 millimetres of imaginary rain for today.)
2013-04-09
No, I'm not pining for a porn actress. I'm waiting patiently for it to rain.
New Toys
About a month back, I ordered a new weather station, which arrived about ten days ago; the dr.Tech WA-1070-T. It's wireless. It includes wind and precipitation. It includes a solar recharger.
One unexpected omission from the package: USB capture. Dammit. Chumped by an assumption on my part.
So, I'll be back to OCR'ing an LCD display.
Back to the Fixture
(If that statement mystifies you: I capture my 'local' weather data from the LCD display of a cheap home weather station. A webcam snaps a picture of the display, and custom software quite literally interprets what's on the screen and passes the info along to the weather software proper. Versus wiring in and programming the necessary circuitry to interface it electronically, it's the best/simplest/cheapest solution. And I'm damned certain I'm infringing on some troll's patent, somewhere, in doing this.)
I've had the new station installed and in testing for about a week. Since then, it's been bloody windy, causing me to suspect vibration of the 'transmitter' unit--not the rain gauge mechanism itself--as the source of spurious readings. I'm supposed to get precipitation data in increments of 0.3 mm. What I've been getting is a string of spurious readings, 15.2 mm at a time--and this after having secured the rain gauge to a flat, stable surface. What I'm suspecting is a loose connection, in conjunction with resonant vibration in the sensor mast.
Making Ready
I've been upgrading the data-capture software, with two competing goals in mind:
Make it capture more data
Make it easier to use (GUI-squishy) and more configurable
Issue: There'll be a number of new fields on the new display (wind speed and direction, and running-total precipitation). The number of fields actually captured may vary and could change again in the future, when I try to upgrade to something even-better and chump myself again. Honest-to-'Ghettimonster, I will be absolutely certain, next time, that it's got computer connectivity. *makes coiling motions with left hand*
So, make the data fields configurable and more flexible
Issue: We have a new, active, male feline addition to the households. Prowling occurs, as do minor upsets, such as trying to perch on the Centretown Observatory Data Capture Stage, which began life as a microwave cart with a nordic moniker. Disturbances to the webcam and/or the display panel (position and orientation) are a major pain, as viewpoints change, and the camera must be realigned simultaneously with the data-capture software.
So, make it easier and faster to realign.
The revised version of the capture software now recognizes any number of user-definable data fields, in which the individual digits can be expressed as a box and the expected segments scanned automatically; or each individual segment can be defined to specific coordinates. (E.g. on the new display, the leading digit for the barometric-pressure reading is either blank, or 1 (i.e. two segments.).)
The configuration file is so simple, yet flexible, it really deserves a full page of documentation. The initial calibration is done by hand, field-by-field and character-by-character, and entered into the config file. Following that, realignment is easier. Once the camera has been levelled and roughly pointed in the right direction, the data search-boxes can be adjusted onscreen either globally, or by field. A future version may use special markings for auto-calibration.Eventually, I'll add interface elements to manage configuration completely visually.
So, a few polishing touches to the data-capture software, and a one-time calibration, and I'll be collecting live data from the new station. The only catch is that I need to see a little live action from the rain gauge; to see how real data are reported, before deciding how--or, indeed, whether--to handle rainfall readings.
It hasn't rained much, nor at the right times, since I set up the new equipment.
It's supposed to rain tonight. I've been following the front in on local radar. It's... in the neighbourhood but kind-of regrouping.
To paraphrase The Simpsons' Apu Nahasapeemapetilon (big fan; love the blithe fatalism):
Rain, rain
Go away
...and please come again!
(And that brings us to 410.4 millimetres of imaginary rain for today.)
Saturday, 23 March 2013
Configuring WiFi on Raspberry Pi
Edimax WiFi Dongle
Static IP Address
No Encryption
2013-03-23
My Raspberry Pi, a tiny, ARM-based, single-board computer, has arrived.
Following a test boot and preliminary configuration, I needed to get it running on WiFi. For this, I had an Edimax EW-7811Un Wireless-b/g/n USB dongle--very common among Pi owners.Getting it going wasn't easy. All the references online talk about WPA/WPA2 configuration. Well, I don't use encryption, due to the menagerie of devices (of various ages and levels of technological sophistication) we use around here. Instead, I rely on MAC filtering. Yes--it's not the most-secure setup, as someone can always clone a MAC address and connect. Personally, I feel that if they want to go to that much trouble, when there are several open access points on this street alone, they're welcome to some of my bandwidth. So far, it hasn't been an issue.
Anyway.
After digging through man pages and reading others' comments, I got things set up. When not using WPA, you needn't mess with wpa_supplicant; only the interfaces file must be configured properly.
1. Don't worry about kernel modules; the appropriate module is pre-loaded.
2. Login to your Pi and enter the following, leaving out the comments:
cd /etc/network # Change Directory
sudo nano interfaces # Edit file with nano text editor
In the nano editor, enter the following lines:
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wireless-essid your_ssid # Router's SSID - no quotes
address dotted-IP-address # IP addr you want for Pi
netmask 255.255.x.x # 255.0 or 0.0
network dotted-IP.0 # i.e. x.x.x.0
broadcast dotted-IP.255 # i.e. x.x.x.255
gateway your-gateway-ip # Usually your router's IP
If there's a line in there about "wpa", prefix it with '#' to comment it out.
Press Ctrl+O to save, then hit [Enter].
Ctrl+X to exit.
3. Logout.
4. Remove the Ethernet cable (if any) and insert the Edimax dongle.
5. Reboot
It should come up and connect automatically.
Cheers!
Tuesday, 19 March 2013
Goodies
2013-03-19
I have new toys on the way:- A dr.Tech wireless weather station (WA-1070T, very similar to the ubiquitous Fine Offset WH-1080PC, which I had before)--I'll be adding (flawed) wind and precip data to my weather site in the near future; and
- one Raspberry Pi single-board microcomputer.
The Pi runs a version of Debian Linux--my favourite distro. The weather station, like my first one three years ago, has a wireless receiver with USB computer input.
My plan is to sorta bungie the Pi to the back of the receiver, hook in the USB input, use the pywws scripts to read in the live data, and pipe that to my weather software. I'll need quickly to write a little conversion program, to change the pywws data to something my system can handle. I can have that mostly written-up in advance.
The Pi is coming with an AC adapter and WiFi dongle. This means I can place the receiver in an optimal location, and the Pi will come along for the ride, burdened only by its power cable. Meh--I can live with that. I have a portable DVD player, with composite input, that I can use as a sweet little mini-monitor, too.
Heck, as the weather system itself is deployed in Linux, I could move the whole-shootin'-match over to the Pi and let it chug along.
The weather software itself will require some tweaking to handle the live wind and precip data. I can do that in a few idle hours.
At some point, I'll have to polish- and package-up my software and Open-Source it.
So, to my neighbours: the instrument mast is coming back!
Sunday, 23 December 2012
Fresh Install of Ubuntu Server 12.10 on a Working System from an ISO Image and Non-Bootable USB Drive
2012-12-23
See the last section of this post for a concise summary
New (less old) Server
Yesterday, I replaced my home/weather server, a venerable Toshiba Tecra 8000, circa 1998, with something a little more recent--my old Acer laptop, circa 2005.
I've been using Ubuntu Server for some years, now, and like it a lot more than their desktop flavours. The server was running version 11.10; quite frankly, I was averse to updating the poor old thing with such cramped disk space (10 Gigs). Switching to the newer machine gives me lots of free space for future upgrades, and it should remain capable of running mainstream Linux distros for quite a few years to come.
Installation was simple. I'd planned carefully and kept a list of files that needed to be modified on both old and new machines to make the changeover. The weather system I transferred in stages, first the support scripts and programs, and then the main daemon itself. A few hours of work, and the new server was up and running, and the old one was back up as just-a-normal-client. The new server boots to the XFCE desktop and now hosts the webcam analyzer, a GUI program. It's working surprisingly well and laughs at the puny load the weather system puts on it; the old server wheezed and chugged to keep up.
But It Ain't Dead Yet
Now, time to repurpose the old server; I'm going to replace the thin client, which currently captures the local readings from an LCD display. It runs Arch Linux (by necessity, due to a CPU peculiarity) off a thumb drive, takes about ten minutes to boot, and has a big old, space-eating CRT monitor attached. The old server--even though its hardware is several years older than that thin client's--can handle the task of capturing the readings and transmitting them to the server--and nothing else, while, being a laptop, saving a load of space.
The plan was to install Ubuntu Server in a very minimal configuration, then XFCE and the readings-capture software. I wanted to do a fresh install, rather than an upgrade, to get rid of all of the server stuff it wouldn't actually need anymore. And, I just like to start fresh when repurposing a system. Additionally, U'Server uses a console-based install. I wasn't up to trusting a 14-year-old laptop with a GUI-based install; let it sort out the basics, first.
So, now it was merely a matter of installation method. I evaluated my limited resources.
And here the issues began.
Can't Boot from CD or USB
I knew already that I couldn't boot from a thumb drive; the damned BIOS is just too old, though it does have a USB port. No, I wasn't willing to risk updating the BIOS; I bought that laptop second-hand a good ten years ago.
Okay, so I'll burn a CD and install from that; that's how I'd done the last fresh install on that machine. I slapped one in, booted, and nothing. I could hear the disc scraping inside the drive. Apparently Teeka the Human-Like Sphynx kitty had perched on the keyboard too many times and... harmed the CD-ROM drive. I didn't feel like futzing with it. (I did, incidentally, install an anti-cat-perching device on the laptop after I catching her doing it. She wasn't trying to be naughty, either; sphynxes are hairless and love warm places. QED.)
So, no CD, and no thumb drive.
...or Network... or not...
Next alternative: network install. Nope; Ethernet access is via a PCMCIA card, which requires drivers which are not, of course, available at boot time. So that's out.
There are ways of installing Linux from files already present on the hard drive. I decided to try that route.
Issue: the previous installation had carved off a separate /home partition; but in order to run a GUI, I needed all the space consolidated into one partition.
Issue: Can't repartition the drive while running Linux which resides on that drive--and, again, no way to boot, say, System Rescue CD or Partition Magic from USB or the network.
I partly addressed the partitioning issue by moving /home off its separate partition and onto the root partition. That freed up its partition, which I unmounted, deleted and replaced with a smaller (700 MB) partition (sda3 - remember that for later). Onto that I copied the Ubuntu Server ISO.
Leverage the Existing Boot Manager
The old server boots with Grub2, and the boot manager is the key to booting unconventionally. Following some examples on the Internet (none of which worked straight-up for me), I added (as Superuser) the following to /etc/grub.d/40_custom:
(This didn't actually work for me)
Backtracking slightly: I verified that the files referenced in "linux (loop)..." and "initrd (loop)..." above are correct. To do this, I mounted the ISO's partition, then mounted the ISO file onto the loopback device, and had a look around:
Next, I rebooted.
False Start: What CD-ROM?
Up flashed the Grub boot-time menu. I arrowed down to the new entry, then hit 'e' to view/edit the commands.
Issue: seems grub-update had removed the (hd0,3) bit from the code. I manually added it back in, took a deep breath and hit Ctrl+X to go ahead and boot with those commands.
It trundled away for a long moment, then up came the Ubuntu installer, to ask me some questions. Hooray!
Issue: after a number of questions, it reported that it couldn't mount the installation 'CD-ROM'. Okay, wait--I'd seen something online about that. I hit Alt+F2 for a command shell (console 2) and entered the following commands to mount the ISO file (which the installer, running from memory, had unmounted) to the /cdrom mountpoint:
Alt+F1 took me back to the installer (console 1). Ha, I thought, yes, go ahead and retry mounting the CD-ROM.
What CD-ROM?
Issue: same error.
Okay. I flipped back to the command shell and remounted the ISO (the third command line, above), then flipped back to the installer.
This time, I said no, don't try to mount the CD-ROM. That took me out to the main installation menu (detect and mount CD-ROM, something like that). Just for fun, I chose the next entry (something about debconf). Lo and behold, the installation process carried on!
Issue: A few screens in, I'm informed that I cannot re-partition the drive when a partition is already mounted. Yes, /dev/sda3 was mounted, holding the ISO file.
Dammit!
Boot from ISO, Install from USB
I consulted with my coffee for a long moment, trying to think this through. Possibly I could instead boot from the System Rescue CD ISO, and try re-partitioning from that. But, even then, I'd have to leave that 700 MB partition holding the ISO file.
Huh. If only I could use that damned thumb drive.
Something was trying to catch my attention. Quite literally--the blinking lights of that plug-in Ethernet adapter.
The PCMCIA bus was initialized and working. So would the USB port!
I aborted the installation, shut down, wrote the ISO to the thumb drive and plugged it in, and rebooted, following the steps above.
Problem: installer starts up but then can't find the preseed file. Clue: it's looking for it on /cdrom. As it turns out, that's where it's mounted the thumb drive. so it's looking for it after the installer unmounts the original ISO image, and after it's mounted the thumb drive. Okay.
Reboot back to the existing OS and tweak /etc/grub.d/40_custom, replacing $iso/preseed... with /cdrom/preseed... . Then one last round of update-grub.
I rebooted and again selected the installer entry in Grub. The installer fired up, asked the usual questions and then carried right on. Now, the installer was running in memory, and the installation files were coming from the thumb drive. The hard drive wasn't being used at all.
Moments later, the partitioner popped up with nary a complaint. I set up a small swap partition, then created one single partition with the remaining free space. Nine-point-five Gigabytes--that'll be enough for the GUI and what few bits of software I'll have to add.
It chugged along merrily, finished the installation, and rebooted. I'm now configuring and installing packages. Hot damn!
Knowing what I do now, if I need to do a fresh install in future, I can simply download the ISO to that main partition (remembering that the installer unmounts it after starting up, leaving the drive free for reformatting) and 'burn' it onto a thumb drive, and repeat the above steps.
Concise Procedure:
If you don't have a USB port or otherwise can't use a USB drive at any point in the process... meh; it gets a whole lot messier.
Some thoughts:
2012-12-23
See the last section of this post for a concise summary
New (less old) Server
Yesterday, I replaced my home/weather server, a venerable Toshiba Tecra 8000, circa 1998, with something a little more recent--my old Acer laptop, circa 2005.
I've been using Ubuntu Server for some years, now, and like it a lot more than their desktop flavours. The server was running version 11.10; quite frankly, I was averse to updating the poor old thing with such cramped disk space (10 Gigs). Switching to the newer machine gives me lots of free space for future upgrades, and it should remain capable of running mainstream Linux distros for quite a few years to come.
Installation was simple. I'd planned carefully and kept a list of files that needed to be modified on both old and new machines to make the changeover. The weather system I transferred in stages, first the support scripts and programs, and then the main daemon itself. A few hours of work, and the new server was up and running, and the old one was back up as just-a-normal-client. The new server boots to the XFCE desktop and now hosts the webcam analyzer, a GUI program. It's working surprisingly well and laughs at the puny load the weather system puts on it; the old server wheezed and chugged to keep up.
But It Ain't Dead Yet
Now, time to repurpose the old server; I'm going to replace the thin client, which currently captures the local readings from an LCD display. It runs Arch Linux (by necessity, due to a CPU peculiarity) off a thumb drive, takes about ten minutes to boot, and has a big old, space-eating CRT monitor attached. The old server--even though its hardware is several years older than that thin client's--can handle the task of capturing the readings and transmitting them to the server--and nothing else, while, being a laptop, saving a load of space.
The plan was to install Ubuntu Server in a very minimal configuration, then XFCE and the readings-capture software. I wanted to do a fresh install, rather than an upgrade, to get rid of all of the server stuff it wouldn't actually need anymore. And, I just like to start fresh when repurposing a system. Additionally, U'Server uses a console-based install. I wasn't up to trusting a 14-year-old laptop with a GUI-based install; let it sort out the basics, first.
So, now it was merely a matter of installation method. I evaluated my limited resources.
And here the issues began.
Can't Boot from CD or USB
I knew already that I couldn't boot from a thumb drive; the damned BIOS is just too old, though it does have a USB port. No, I wasn't willing to risk updating the BIOS; I bought that laptop second-hand a good ten years ago.
Okay, so I'll burn a CD and install from that; that's how I'd done the last fresh install on that machine. I slapped one in, booted, and nothing. I could hear the disc scraping inside the drive. Apparently Teeka the Human-Like Sphynx kitty had perched on the keyboard too many times and... harmed the CD-ROM drive. I didn't feel like futzing with it. (I did, incidentally, install an anti-cat-perching device on the laptop after I catching her doing it. She wasn't trying to be naughty, either; sphynxes are hairless and love warm places. QED.)
So, no CD, and no thumb drive.
...or Network... or not...
Next alternative: network install. Nope; Ethernet access is via a PCMCIA card, which requires drivers which are not, of course, available at boot time. So that's out.
There are ways of installing Linux from files already present on the hard drive. I decided to try that route.
Issue: the previous installation had carved off a separate /home partition; but in order to run a GUI, I needed all the space consolidated into one partition.
Issue: Can't repartition the drive while running Linux which resides on that drive--and, again, no way to boot, say, System Rescue CD or Partition Magic from USB or the network.
I partly addressed the partitioning issue by moving /home off its separate partition and onto the root partition. That freed up its partition, which I unmounted, deleted and replaced with a smaller (700 MB) partition (sda3 - remember that for later). Onto that I copied the Ubuntu Server ISO.
Leverage the Existing Boot Manager
The old server boots with Grub2, and the boot manager is the key to booting unconventionally. Following some examples on the Internet (none of which worked straight-up for me), I added (as Superuser) the following to /etc/grub.d/40_custom:
(This didn't actually work for me)
menuentry "ubuntu-12.10-server-i386" {
set iso="/ubuntu-12.10-server-i386.iso"
loopback loop (hd0,3)$iso
linux (loop)/install/vmlinuz file=$iso/preseed/ubuntu-server.seed ro quiet --
initrd (loop)/install/initrd.gz
}
What we're doing is setting a memory variable (iso) to point to the ISO file on the partition. Next, we're mounting that ISO - (hd0,3) above is Grub's way of referring to /dev/sda3; the partition where my ISO file resided for the installation. Then we're booting the Linux kernel and related files from inside the ISO.
Backtracking slightly: I verified that the files referenced in "linux (loop)..." and "initrd (loop)..." above are correct. To do this, I mounted the ISO's partition, then mounted the ISO file onto the loopback device, and had a look around:
mkdir /media/hst
mount /dev/sda3 /media/hst
mkdir /media/iso
mount -o loop,ro -t iso9660 /media/hst/ubuntu-12.10-server-i386.iso /media/iso
cd /media/iso
ls (etc., etc...)
That said, I saved the Grub file previously mentioned, then ran update-grub to get the entry added into Grub's boot-time menu.
Next, I rebooted.
False Start: What CD-ROM?
Up flashed the Grub boot-time menu. I arrowed down to the new entry, then hit 'e' to view/edit the commands.
Issue: seems grub-update had removed the (hd0,3) bit from the code. I manually added it back in, took a deep breath and hit Ctrl+X to go ahead and boot with those commands.
It trundled away for a long moment, then up came the Ubuntu installer, to ask me some questions. Hooray!
Issue: after a number of questions, it reported that it couldn't mount the installation 'CD-ROM'. Okay, wait--I'd seen something online about that. I hit Alt+F2 for a command shell (console 2) and entered the following commands to mount the ISO file (which the installer, running from memory, had unmounted) to the /cdrom mountpoint:
mkdir /media/iso
mount /dev/sda3 /media/iso
mount -o loop,ro -t iso9660 /media/iso/ubuntu-12.10-server-i386.iso /cdrom
(This is very similar to how I'd temporarily mounted it earlier, to look at its contents.) Ultimately, I didn't need to do this part (see below); but take note of it in case the entire installation must come only from the hard drive.)Alt+F1 took me back to the installer (console 1). Ha, I thought, yes, go ahead and retry mounting the CD-ROM.
What CD-ROM?
Issue: same error.
Okay. I flipped back to the command shell and remounted the ISO (the third command line, above), then flipped back to the installer.
This time, I said no, don't try to mount the CD-ROM. That took me out to the main installation menu (detect and mount CD-ROM, something like that). Just for fun, I chose the next entry (something about debconf). Lo and behold, the installation process carried on!
Issue: A few screens in, I'm informed that I cannot re-partition the drive when a partition is already mounted. Yes, /dev/sda3 was mounted, holding the ISO file.
Dammit!
Boot from ISO, Install from USB
I consulted with my coffee for a long moment, trying to think this through. Possibly I could instead boot from the System Rescue CD ISO, and try re-partitioning from that. But, even then, I'd have to leave that 700 MB partition holding the ISO file.
Huh. If only I could use that damned thumb drive.
Something was trying to catch my attention. Quite literally--the blinking lights of that plug-in Ethernet adapter.
The PCMCIA bus was initialized and working. So would the USB port!
I aborted the installation, shut down, wrote the ISO to the thumb drive and plugged it in, and rebooted, following the steps above.
Problem: installer starts up but then can't find the preseed file. Clue: it's looking for it on /cdrom. As it turns out, that's where it's mounted the thumb drive. so it's looking for it after the installer unmounts the original ISO image, and after it's mounted the thumb drive. Okay.
Reboot back to the existing OS and tweak /etc/grub.d/40_custom, replacing $iso/preseed... with /cdrom/preseed... . Then one last round of update-grub.
I rebooted and again selected the installer entry in Grub. The installer fired up, asked the usual questions and then carried right on. Now, the installer was running in memory, and the installation files were coming from the thumb drive. The hard drive wasn't being used at all.
Moments later, the partitioner popped up with nary a complaint. I set up a small swap partition, then created one single partition with the remaining free space. Nine-point-five Gigabytes--that'll be enough for the GUI and what few bits of software I'll have to add.
It chugged along merrily, finished the installation, and rebooted. I'm now configuring and installing packages. Hot damn!
Knowing what I do now, if I need to do a fresh install in future, I can simply download the ISO to that main partition (remembering that the installer unmounts it after starting up, leaving the drive free for reformatting) and 'burn' it onto a thumb drive, and repeat the above steps.
Concise Procedure:
- This works if you have at least one available USB port.
- These instructions may be specific to replacing Ubuntu Server with Ubuntu Server 12,10
- Grub configuration is specific to Grub2
- Follow the instructions as Superuser
- Download the installation ISO to a partition on the hard drive.
- Use one of the USB installer-type programs (UNetBootIn, etc.) to 'burn' the ISO to a thumb drive.
- Add the following to /etc/grub.d/40_custom (edit (hd0,3) and anything else as needed):
menuentry "ubuntu-12.10-server-i386" {
set iso="/ubuntu-12.10-server-i386.iso"
loopback loop (hd0,3)$iso
linux (loop)/install/vmlinuz file=/cdrom/preseed/ubuntu-server.seed ro quiet --
initrd (loop)/install/initrd.gz
}
- run the command:
update-grub
- Plug in the thumb drive so it's available later.
- Reboot.
- At the Grub menu (you may have to be quick about it and/or additionally pre-configure Grub2 even to show a menu at boot time), highlight the new entry for the ISO and press 'e'.
- Verify that the commands are as you need them to be (watch the device references), and/or edit as needed (per "menuentry" in box above)..
- Press Ctrl+X to boot with that configuration.
- Installation should proceed uneventfully from there.You may partition the hard drive, as it's not being used.
- Reboot and enjoy that new-install smell and rich, Corinthian Leather crontab.
If you don't have a USB port or otherwise can't use a USB drive at any point in the process... meh; it gets a whole lot messier.
Some thoughts:
- During installation, do not reformat the partition containing the ISO file!
- The ISO can't be on the same partition as an existing installation, because the existing must be reformatted during the install process.
- If you have a small partition available, place the ISO file there and install per the above. When the 'CD-ROM' mounting problem occurs, you'll need to mount the ISO as described earlier, and continue without re-trying.
- After installation, you can delete the ISO from that small partition and use it for something else.
- You could also connect the drive to another system and consolidate the partitions from there.
- You might also do this by ISO-booting to a specialized distribution that runs from memory (which lets you unmount the hard drive and adjust its partitions).
- Or...
- With the hard drive connected to another computer (or, again, by ISO-booting to a run-in-memory distro), you could repartition/reformat it, install Grub/2 and edit its config as needed, toss the ISO into the consolidated partition, then boot in the intended computer and install from the ISO
- Or...
- Boot from ISO file, continue installation from network (presuming network drivers had been loaded by that point). I don't even know if you can mount an ISO over the network from a limited installation environment.
Subscribe to:
Posts (Atom)
