Sunday, February 22, 2015

The Time [Capsule] Machine

No posts for the past couple of weeks as I've been trying to track down an I/O error occuring on my OWC SSD, but that's a story for another day.  I'm positive it's the drives cable and not the drive itself.

Coincidentally, the errors started right after I had completed some configurations to mount my Apple Time Capsule as a CIFS volume on my Wheezy install, which happens to be the subject of this post.  About 5 or 6 years ago, my girlfriend (now my wife) and I invested in an 500 GB Time Capsule, model A1254, we could use to back up both of our Macs.  At the time, I only owned a white 2008 2.4 GHz Penryn MacBook (my first Mac) and had just started using it only a couple of months prior.  OS X Leopard had just come out and one of the major touted features was that of Time Machine; the quick and easy way to back up any Mac.  Because of those two reasons, we decided it would be useful to backup our more important school work.

Fast forward to present day, and I have since upgraded the drive in the Time Capsule (TC) from a 500 GB HD, to a 1TB, and eventually to a 2 TB 3.5" hard drive.  I'm having hard time remembering what brand I installed and the RPMs. I have also recently replaced the internal power supply as the Time Capsule finally kicked the bucket one day, but I had been expecting it as the handy little machine had been chugging nonstop 24/7 365 for almost 5 years.  The little guy is currently the backup device for my wife's iMac (she is a photographer), the backup for our MacBook Pro, and the backup for my OS X Leopard install on the G4 PowerBook.  It may seem like a bad idea having all of these eggs backups in one basket, but I also routinely make bootable clones of each of my systems using SuperDuper, a utility I know many are familiar with along with Carbon Copy Cloner.

If you don't currently own a Time Capsule, I'd encourage you to check them out as they can be quite useful in several different regards.  The first is that it can act as a networked storage device for storing your files or backups, create its own Wi-Fi network supporting even 802.11n (which was only in draft at the time) or bridge an existing Wi-Fi network and extend the signal by acting as another available access point (AP).  Other notable features include NAT firewall, MAC address filtering, and RADIUS authentication support. Some of the newer models obviously offer newer wireless protocols and features, but I'd save some cash and go with an older model such as the one we own.  Replacement parts are cheap and it is relatively straightforward to gain access to the Capsule's innards. I should also add it also contains a single USB port for you to attach yet another external drive and I currently have an external 1 TB Seagate attached to the USB port.  And last not but not least, it contains 3 Gigabit LAN ports and a single Gigabit WAN port for reliable wired connectivity. 

Anyways, I want to use it as a backup source for my Debian install as well. I haven't quite narrowed down what I want to deem worthy of backing up, but I'm positive it will consist of my etc directory as well as my home directory.  Eventually I'll look into what existing backup utilities are available and review them on this blog, but for now, I will write simple shell scripts to back up a few things I find important and necessary. I also plan to create a bootable clone of my Wheezy system onto an external HD.

After a bit of online research and light reading, I discovered the most common way of mounting the TC was using the Common Internet File System (CIFS), although mounting as an AFP share was possible as well if you installed the netatalk utility. I wanted to keep things fairly simple and since mounting it as a CIFS share was feasible without the need for installation and configuration of additional software, I went that route.  I should add here that another part of this set up is that I want access to the disk share to be secured via account authorization instead of having it freely available for anybody to mount and peruse.  In short we need to complete the following tasks:
  1. Set up an dedicated account for Debian to use for access
  2. Determine Time Capsule's IP Address or Hostname
  3. Mount the network share using the mount command.
  4. Optionally configure it to be mounted at startup
So let me describe the necessary steps to set this up using Apple's Airport Utility in OS X. I'll be doing this from Airport Utility v5.6.1, which also happens to be the last version made available to OS X Leopard.

  1. Select and authenticated with your Time Capsule as well as select the option to make changes (versus restoring the unit to factory settings).  
  2. Skip the option to change the TC's name and access password or change it if you feel the need
  3. The second screen you reach after hitting Continue is the place where you can edit and update your Time Capsule's disk sharing settings. Select the option to Change these settings.  Under the Secure Shared Disks: option, select the option With accounts from the drop down menu. 
  4. Now you should be able to click the + to add as many accounts as you would like.  For each account you should set the username, password, and set the account to have read and write access.  Obviously you can select the other available permissions as well if the need is there.
  5. Under the option, Airport Disk Guest Access, I'd recommend Not Allowed since you are taking the time to set up account based access.  
  6. From there, go ahead and click Continue repeatedly until you come across Finish where you can apply your changes to the Time Capsule.
Now that is out of the way we can work on actually mounting the share. Before we can do that though, we need to know the TC's IPv4 address or DNS hostname, which you can obtain using a number of different methods such as using Apple's Airport Configuration Utility in OS X, your router's DHCP table available from its web interface, or using a utility such as Angry IP Scanner.

Onto step 3.  As mentioned, we need to use the well known mount command to make the share available for use.  Now, there's a plethora of information available in this command's man pages, but eventually I constructed the following command:

sudo mount.cifs //192.168.66.7/Data /media/Backup -o username=MyUser,password=MyPass,uid=1000

Let's break this command down piece by piece so we're aware of exactly what it is accomplishing for us.
  • mount - the command keyword telling Debian we are wanting to mount another filesystem available via a directly attached device or network share
  • //192.168.66.7/Data - the IPv4 address and mount point of the share you created on your Time Capsule
  • /media/Backup - Destination folder for mounted share.  This could be anywhere you wanted, but I'd keep it either under /media or /mnt
  • cifs - tells the system the share is of type CIFS
  • -o - specifies you are providing an additional list of options
  • username= - the user created with access to the TC share
  • password= - password of the user above
  • uid= - sets the owner of the filesystem share.  In my case, I set it to 1000 as that is my user account id.
Last but not least, let's add the necessary addition to our /etc/fstab file so the new CIFS share is mounted automatically when the system boots.  A lot of what you see here is almost exactly what was used to originally mount the share, so no surprises here.  Note the / at the end of line 2.  Merely a means to indicate the command continues on the next line.

# Mount CIFS Backup Share
//192.168.66.7/Data /media/Backup /

cifs /username=MyUser,password=MyPassword,uid=1000 0 0

Save the changes and reboot to the awesomeness.

Simple enough am I right?  Luckily, there's a lot of documentation and other blog posts about this exact same topic, but hopefully all the information here helps you get the job done in one fell swoop.  If you want to make this work with your own Time Capsule and run into any issues, let me know and I'd be glad to help.  Given that my blog is dedicated to making the most out of our older aging hardware, I thought this would be an excellent way to continue using an older network storage device to store or backup your files for you on a still supported PPC OS.

I do have an update on the 1400 PB coming down the pipe.  And yes, the Clang post is coming too.  I'm just slow moving and always more nervous about posts regarding coding. :) Anyways, in the words of Joe Dirt, "Keep on keeping on."

Friday, January 30, 2015

How Does This Remote Work?

As sad as it may seem, there are some applications and utilities I use in my Network Administrator position which are simply not available for PPC OS X or Linux that are essential to doing my job in a effective and efficient manner.  One in particular is managing our vSphere 5.5 virtual environment and infrastructure.  VMware's vSphere Web Client requires Adobe Flash (minimum version of 10.1.0), which is of course, not officially supported on the PPC architecture and hasn't been for sometime. Even if it was, I have a strong feeling it would perform poorly.

I decided to try out a few pieces of software that would allow me to connect either via VNC or RDP to other machines on our network and to other PPC machines at my humble abode.  The first one I attempted to use was the well-known and popular Remmina application, which I was surprised still supported the PPC architecture. Remmina is incredibly straightforward and has a unique array of settings you can adjust to best fit your needs for each remote session/device.  What I find most useful is the fact that you can save as many individual connections as necessary for each of the devices you would or might be needing to connect to while being able to maintain separate settings for each one, including resolution, color depth, performance, etc.  The VNC connection to my G4 PowerMac running Jessie works flawlessly, so I'll continue to use it for my VNC connections.

Upon trying to RDP into my Windows 8.1 machine, I would initially receive the login prompt, where I could input my username, password, domain, and accept the certificate, but from there, a simple generic error would appear right afterwards as such:

Not very useful, am I correct?  This was with the default Security setting of Autonegotiate under the connection's Advanced tab. By leaving the setting as is, Reminna should work with Windows 8.1 to figure out what security was to be used automatically whether that be NLA, TLS, or RDP.  Just as a test, I tried to set the Security to each of the 3 available individual options with different failed results. What I needed was a bit more information in order to determine the cause of the failure.  I decided to run Remmina from the terminal to watch for the output that would appear while trying to RDP to my 8.1 PC.  This is the more detailed error I received during the connection attempt:

SSL_read: Failure in SSL library (protocol error?)
Authentication failure, check credentials.
If credentials are valid, the NTLMSSP implementation may be to blame.


First of all, I love the error.  Seems like a bit of finger pointing. Anyways, based on that information, I figured it has something to do with Microsoft's NLA, or Network Level Authentication, which was a new feature for Windows RDP 6.0 made available as of Windows Server 2008 and Vista (Windows XP SP3 supports it as well now).  NLA requires users properly and successfully authenticate themselves before establishing the actual RDP session. As stated in the article above, this helps combat DDoS attacks because no resources are used on the remote server/device until authentication is successful.  Somebody could previously make an unprecedented number of connections to a remote device without needing to authenticate themselves thus using this as a way to consume all available resources on the remote device.

My initial thought was that perhaps it was an incomplete implementation of NLA in Remmina or a bug, so I downloaded and tested both rdesktop and freerdp.  Both are command line only with freerdp actually being a fork of rdesktop with supposedly better support for newer protocols such as NLA.  However, I received the exact same error message (verbatim actually) with both utilities as I was with Remmina.

At this point, I ended up spending quite a bit more time trying various things to overcome the issue and ended up deciding to go with a workaround for now by disabling NLA on my Windows 8.1 laptop.  You can do this under Control Panel -> System and Security ->  Allow Remote Access.  Under the window that appears, uncheck the option "Allow connections only from computers running Remote Desktop with Network Level Authentication (recommended)".  Again, the caveat being that disabling this will make the connection less secure, but for the meantime it will have to do.  Thankfully (sort of), this worked and I was able to RDP to the PC witih Remmina via my saved connection.  On the downside, the colors were way off and there was what seemed like a heavy blue tint to the display.  I tried adjusting the Color depth option to set it at the highest possible value of 32 bpp (True color) as well as trying to make RemoteFX work, but the results were again, exactly the same.  Here is a screenshot of what I'm talking about:
(Makes me think of this song)

Eventually, I tried rdesktop again (since I had disabled NLA on the Windows 8.1 PC), but this time with successful results all around!  Here is a screenshot of the resulting RDP window:


From the command line, I simply ran the following:rdesktop -u HarryPotter -d Hogwarts 192.168.10.1

Values have obviously been changed for security purposes. The -u is for username and the -d is for the domain name.  I could have passed in the password as well, but decided to let the connection ask me for it. The colors were near perfect to that of what I saw when actually sitting right in front of the PC. However, the default window size was a bit small. To be honest, I'm not sure what the dimensions were nor did I care to look. What I did care about was adjusting that default window size when starting the connection so that it would occupy the entire display of the PowerBook, which again, has a resolution of 1440x960.  Even if not the entire screen, perhaps a good portion of it. So as usual, I dove into rdesktop's man pages to see what other flags and options were available to make this happen.

To adjust the window size, you pass in the -g option (g for geometry!) or try out the -f option to have it start in full screen mode.  For the -g option, you can either pass in a percentage value, which is what I did first, or it pulls the value from the extended window manager hints property (a.k.a _NET_WORKAREA).

Here is a screenshot of the entire screen with a set screen size of 90% for the RDP session:

Based on what little I know, it appears the blue tint with Remmina is an implementation bug.  I'll probably look in the next day or two to see if the bug is out there and if it isn't I'll do my due diligence and file a bug report.

The application only uses between 10 - 15% and at times up to 20% of the CPU on my 1.67 GHz PowerBook, so impact is usually small and does not affect performance of other applications I have open.  Most of that CPU consumption is to redraw the screen as of course all actual applications on the remote session are running on the remote machine.  As I had mentioned earlier, what I really wanted to do was access the vSphere Web Client, which I can do in a Mozilla browser on the PC while still accessing all the applications I use on my Debian install.

Lastly, there are a few oddities I still need to work out with this setup.  The first being that when I initially remote into my PC, it brings up the login screen where I have to actually select the Other User option as it will not let me sign in automatically to my existing desktop session.  The Other User option already has my username entered (assuming because it was the last user to login) and once I type in the correct password, it connects me to my existing desktop session.  Secondly, I cannot run the session in full screen mode as I have not yet figured out how to successfully either exit the rdesktop application or change applications on my PowerBook as the Option (Alt) + Tab shortcut actually switches applications on my Windows machine. I'll play around with each of these and provide updates (good ones hopefully) in a future post.

Again, I have not researched the small possibility of somehow running Adobe Flash applications on PPC and have yet to play with any of the Flash alternatives such as Gnash or Sparkle that are available on Linux.  I'm not quite yet ready to try and tackle them at this current time.  If I do, I'll probably try it out first and use it only on my G5 as it has more adequate processing power and memory needed to provide somewhat smoother playback and performance.   My luck, is that by the time I do figure something out, VMware will have hopefully decided to rewrite the Web Client in HTML5, which should happen sooner rather than later.  I say that because even YouTube recently announced that HTML5 is now the default video playback format in most modern browsers.  Now that is something to be stoked about!


Monday, January 19, 2015

Pour Me a Bowl Of Serial

Hopefully you'll enjoy yet another one of my funny and sometimes not so clever titles that are indeed relevant to my posts.  One of my job responsibilities as a Network Administrator is connect to and configure new network devices, most often either a layer 2 managed switch or a Cisco router. To do some of the initial configuration, I usually connect the appropriate Female DB-9 to RJ-45 console or F DB-9 to F DB-9 serial cable and I'm off on my way using a program such as Putty or HyperTerminal when using my Windows (not)workstation..

Fortunately (not unfortunately) the aluminum G4 PowerBook does not include a built in serial communications port.  However, I found a Tripp Lite male USB to DB9 serial adapter cable in storage and decided to see if I could make it work with my Wheezy install to configure a couple of brand new Cisco routers that will consolidate a bit of our spoke and hub network design. In short, just another way to make this old PowerBook useful in my everyday life.

Not knowing if it would work without any extra configuration or drivers, I decided to just plug it in and see what would happen.  But wait, what would I use to configure the serial communications interface and settings such as setting the bps rate etc?  Luckily, it's a well documented procedure.  It required a quick install of minicom and some very simple and straightforward initial configurations. Since there are PCMCIA serial adapters available, I should be able to also use my 1400CS to do the same thing, once I have put it into production.

Once minicom is installed, you'll want to run sudo minicom -s to start terminal emulation. This should bring up the software's configuration menu.  To start, you'll first want to arrow down to Serial port setup, hit Enter and then tap the A key to configure the filesystem location of the serial device you'll be using for your serial com port connections.  Since I was using the USB to serial adapter, mine was located at /dev/ttyUSB0.  Depending on your system and which USB port you use, this device may vary.  The fastest way to determine the device name is to change directories into the /dev folder and do an ls -alh | grep ttyUSB. It will almost always be ttyUSB0 though, so no worries there.

Once you have set the correct device location, hit Enter to be able to choose a different menu option.  Depending on the device you are connecting to (be that a router, switch, server, modem, etc) you may need to also adjust the Bps/Par/Bits setting to something other than the default 9600, which happens to be what you usually set it to in most cases. You'll also want to consult the vendor documentation of the device you are connecting with to see whether or not Hardware and/or Software control need to be on or off. When you are finished, hit Enter again and arrow down to Save set up as df1and hit Enter again. This should bring you back to the initial configuration menu, so go ahead and arrow down to Exit and hit Enter twice more. You should now see communication with the attached device. 

When you are finished, you can exit the minicom session by simply hitting Command + A, and then hitting the "x" key.  This should return you to your expected shell prompt.  Now have at it and enjoy another practical everyday use for your ole PowerPC machine.

And finally, in Debian PPC related news, I filed my first Debian bug report #757015 (well an extension to an existing one confirming I had the same issue) against the PPC Iceweasel package. It's a small subtle issue resting among many in a deep sea of Iceweasel bugs, but apparently one other individual has ran into the same issue.  In short, my synced XMarks folders do not appear in the Bookmarks toolbar.  It's not an XMarks issue because even just creating a simple folder and placing it in the Bookmarks toolbar does not work.  I tried it with a brand new and clean profile as well with the same results. However, when viewing my bookmarks via Command + B, it shows the folders as being on the Bookmarks toolbar. Web page bookmarks still appear and work as expected and it's not due to my only other extension I have installed, which is AdBlock.  I don't have high hopes for the bug being squashed, but at least it is out there.

Speaking of bugs, you may want to join the bug reporting party over at PowerPCLiberation. We need to do our part in whatever we can to improve the Linux PPC experience and platform!

Let me know if you have any questions or thoughts in the comments below.

Monday, January 12, 2015

New (Old) PowerBook Teardown & Resurrection

So as noted in an earlier blog post, I recently purchased both a PowerBook 1400CS and a PowerBook 190CS.  I plan on using the PowerBook 1400CS extensively in as many creative and useful ways as possible at both home and at my network administrator position.  Unfortunately, neither PB came with a power adapter, so for the first couple of weeks, I could not even determine whether they worked or not.  One thing I did not want to do was jump the gun and purchase some no good, rotten, dangerous, self-detonating piece of junk replacement adapter, but instead took my time to find a genuine Apple replacement for each.  Luckily, I scored on the 1400CS first although I'm not sure it's the official adapter originally shipped with a brand new unit.  It is a 45W adapter with a model number of M4402. In either case, it's compatible, works, as well a genuine Apple product/replacement.


Forgive my terrible photography skills.  My wife is a professional photographer and would be ashamed of these, but rightfully so!

Before powering on the near 7 pound beast (6.7 lbs according to everymac.com), I decided to tear the PB apart first just to take a quick look at its innards and see what it had for specs as well as make sure that from a quick glance everything seemed clean and in good overall condition. Never having owned a 1400CS before, I knew very little on how to tear it down appropriately, but my gut said it would be much easier than what it takes in this day and age to take a part a newer MacBook Pro or an iDevice. Wanting to be careful but curious,I decided to search the web for walk-throughs, but promising results were scarce.  Luckily, iFixIt, had a few walk-throughs for various parts of the PowerBook, but nothing too difficult like the motherboard or trackpad.  Eventually, I came across a 1400CS repair manual available here. This guide has an immeasurable amount of useful information, although the hardware replacement guides are a bit difficult to understand, but I attribute that to my lack of ability to properly read and follow instructions very well.  Your results may vary. :)

I removed, the Nickel metal hydride (NiMh) battery (which of course is shot), floppy drive module, speaker grille, cover plate, and keyboard to discover the system came with an upgraded 216 MHz NewerTech NuPowr G3 CPU, two memory modules, a video-out card (HDI45 slot), and an original 750 MB Apple Iomega HD.  Safe to say, I was quite pleased with these findings, although worried I might have a model with only 12 MB of onboard RAM.  Not sure yet whether my particular model supports 64 MB of RAM or only 56 or 60 MB as again, I do not yet know how much onboard RAM it holds and I did not look closely enough at either of the two memory modules to determine their capacity. The fact that the drive is 750 MB, makes me believe it was originally a 1G 117 MHz 1400CS. Sadly, the current 56 MB is not enough recommend memory for running Classila, although there are workarounds.

Here is a picture of the partial teardown:

Now that the system was partially torn down, I thought it might not be a bad idea to wipe it as clean as I possibly could, including the external shell, keyboard keys, speaker grills, and adapter, etc.  I will admit that the thorough cleaning has helped restored a look of being close to brand new. From there, I completed reassembly, plugged it in and waited.  Instantly, I heard the well known Apple startup sound, although it sounded terrible (not too worried about this though).  And as expected, the hard drive made a terribly loud grinding sound, so I'm a little concerned about the remaining life it holds but the PowerBook eventually booted into Mac OS 8.1!  Success!

However, my joy would be short lived as I soon discovered that the trackpad did not work.  Not only that, but I did not have an ADB mouse on hand to still peruse the system and its goods.  After double checking to make sure the trackpad ribbon cable was firmly inserted into its slot on the motherboard, I decided it was probably shot and started the hunt for a replacement as well as an ADB mouse.  I didn't necessarily need the mouse, but I thought it might be handy in the future for the other older Macs I acquire, tinker with, and restore.  While I was out shopping for replacement parts, I thought I would go ahead and purchase a HDI45 to DB15 adapter (Part # 590-0831-A) which will also eventually require a DB15 to VGA adapter (likely with dip switches) in order for me to have the ability to plug the PowerBook into any VGA display, albeit it at a maximum low resolution of 800 x 600.

I must admit that replacing the trackpad was simple, but yet at the same time incredibly tedious and difficult.  There were two screws I did not see as they were covered by circular stickers of the same color as the PB itself.  As a result I ended up busting the old trackpad while trying to remove it. Those two screws can be found on the left and right rear of the device, right at the seams whether the bottom and top halves of the PB's base meet.  You'll want to carefully remove these two circular coverings and keep them safe for the replacement trackpad. Of course, remove those two screws as well. As for the old trackpad... oh well. It was shot anyways and I was still able to salvage the screws and use them to properly attach the new trackpad. Re-inserting the trackpad ribbon cable was incredibly frustrating as my large hands proved to be a nuisance.  Luckily, the replacement trackpad works perfectly, (as does the used Apple ADB mouse).

It doesn't stop there. The uphill battle continued.  Come to find out certain keys on the keyboard were not working either including, j, u, m, p (funny I know).  A working replacement keyboard did not do any justice either, so it has to be something with the connector slot on the motherboard.  Perhaps there is a piece of debris blocking access to some of the contacts.  I'm still working on this one, but hopefully I have it resolved soon without having to go as far as replacing the entire motherboard.  That would be incredibly sad, but call me crazy, because I'd do it jump, I mean just because I want this thing in perfect working condition.  On the bright side (pun coming), I also found out the brightness and contrast controls to the right of the display work great.  Please let me know of any possible ideas or fixes for the keyboard/key issues.

At this point in time, the only other vital missing piece is a working CD-ROM drive module I could insert in place of the existing floppy drive module.  I have yet to locate one that a) was not incredibly expensive b) not for sale from some sketchy website or c)included with the purchase of an entire 1400CS laptop.  I've been keeping an eye on the LEM swap group as well, but if you know of anywhere that has them for sale at a more reasonable price, let me know!  Other than that, I'd like to find a working Ethernet card so I can cable it into my existing network.  I would do a wireless PC card, but from what I have read, no existing PC card offers support for any wireless protocols after 802.11b.  I wouldn't have minded if it supported 802.11g, but I can also understand why no such card is not available.  The machine simply wouldn't have enough processing power to adequately support it.

Once I do have a working CD Drive, I plan to install the latest version of FreeBSD.  I've already downloaded the latest copy of FreeBSD via the torrent networks and burned to a disc using my G4 PowerMac (Apollo11). From there, I may use it as a machine to handle most of my SSH connections to various machines as well as a tool for running various command line utilities. Even though the PB 1400CS is approaching 20 years in age, I strongly believe in the fact that this old laptop can still prove incredibly useful and at times even nostalgic. I'm so eager to put this machine into everyday production!

That's it for this post.  There are a few interesting pieces of software installed I would like to discuss briefly in the coming weeks that are in my opinion kind of cool.  Otherwise, I'm just tidying up the last few pieces of the introduction to Clang post, so look for that in the next week or two.

Friday, December 19, 2014

Am I Getting Hot or Cold?

Yes. A post on monitoring your PowerBook's temperatures when running Debian or similar variations of Linux. As mentioned in a previous post, I am a big fan of Conky, which I utilize to show me several pieces of information regarding my PB and other PowerPC systems at any given time. Conky shows me such things as CPU, battery, and memory usage, as well as the capacities of each plus disk space usage across all partitions, up and down network statistics on all interfaces, and top process CPU consumers. I should note that right now, when completely idle with no GUI applications running, Conky states CPU is at 1%, which I see as very ideal. Usually it's Conky taking up a majority of that 1% of CPU.

The only thing I was missing was a way to monitor temperatures that are reported by the machine's included sensors. PowerPC portables have a history of running quite warm. Obtaining this same information in OS X is incredibly easy using a dashboard widget such as iStat Pro. Still being incredibly new to many things Linux and even PowerPC, I had to start doing a little bit of research to see if or where this information could be stored for retrieval. After perusing the different Conky options, I came to the conclusion that the desired information could not be natively retrieved using any existing Conky options as most deal with the (ugh) Intel architecture.  If I'm wrong, please let me know either through the comments belows or via email if you don't feel like publicly shaming me.

One way to start was to run the lsmod command, which would provide me with a list of loaded kernel modules.  One of those sure had to be doing something temperature/fan related?  Well, a few stuck out at me including, ic2-powermac, although it was not being used by anything, but I ran into this module when doing some research online.  The other one in particular was therm_adt746x, but again was not being used by any drivers. I'll be doing some more reading of these modules in the near future.

Luckily, I also discovered a couple of the sensors and output I could retrieve from various files under the /sys/devices/temperatures folder. I simply did a search of the file system using locate temperature. There were only two sensors listed along with a few other configuration files that I have yet to investigate any further.

For each sensor, there were 3 relevant text files (actually 4 for sensor1): sensor[#]_limit, sensor[#]_location, and sensor[#]_temperature. Sensor 1 also included a sensor[#]_fan_speed file. I ran cat on each of the 3 files (again 4 for sensor1), just to obtain some sort of idea of what information it would provide. Here is a quick overview:

  •     fan_speed – provides the current speed of the fans in RPMs
  •     limit – specifies the upper limit of the temperature that the sensor can reach before I assume either you start to have issues or the fans kick in
  •     location - specifies the location that the sensor is monitoring the temperature for
  •     temperature – this file provides a single number, which happens to the latest temperature reading in degrees Celsius (converting this to Fahrenheit should be trivial)
According to the locations, one sensor was for the CPU_BOTTOMSIDE and the other PWR_SUPPLY_BOTTOMSIDE. My understanding (again please correct me if I am wrong) is there should be other additional sensors on the PowerBook that we could pull values from. If there are, I'd love to figure out how to do just that. For example, on the OS X side, when looking at temperatures in iStat Pro, it also provides temperature values for CPU top, battery, trackpad, and HD. Perhaps there is some additional documentation somewhere covering this sort of information?

Great, so how can I customize Conky to pull in these values and output them to the grid of information I have running on my desktop? Well, one of the first ideas that came to mind was using a shell script that essentially grabs the temperatures and fan RPM values from the corresponding files and assigns each to a variable that can then be output by Conky. Perhaps there is an easier way to do this?

Yes there is. Here is where exec object comes in handy. This particular object will let you specify a shell command you'd like to run and output.  If you want to have the command ran at your own set intervals, use the execi command instead, but be aware that the interval value you set must be lower than your configured update_interval (mine is set to 1.0 second) for Conky.  So for each sensor I added the following line:

Bottom CPU Temperature: ${exec cat /sys/devices/temperatures/sensor1_temperature}

Battery Temperature: ${exec cat /sys/devices/temperatures/sensor2_temperature} 

According to the man pages for Conky, running shell commands within Conky tends to be more resource intensive.  Personally, I have seen a small average of about a 1% increase in CPU consumption, but that could be to other configuration changes I've made recently to the PB.  These two additional lines in my Conky configuration file worked and do as they are intended, so in some ways a success.  Here's a screenshot:


One last thing I would like to share about Conky.  If you want to disable any sort of flickering Conky may be experiencing, add double_buffer yes to your list of options. Makes everything look like it is running much smoother. I was going to post a link to my conky.conf file somewhere, but decided if somebody was interested in taking a look at it, I send it to them via email.

I know I've barely scratched the surface on how all of these sensors work, but it's a start. One thing I haven't quite figured out is how often the temperatures are being updated in those specific files, so the quest for answers and understanding continue!

Hopefully you enjoyed this post and can use it as a starting pointing for doing your own temperature/fan speed monitoring on your PowerPC machine(s) or even as a gateway to other great ideas for information that can be displayed by Conky. 

I still have yet to finish the post on my PowerBook 1400CS (waiting on a few more parts) as well as the introduction to Clang on PowerPC. The latter is a post I am taking extra care to refine before I put it out there in the wild.

Sunday, December 7, 2014

Don't Push My PBButtons

So I wanted to cover something I ran into when first installing and configuring my Debian distro that almost drove me over the edge.  Now as you read on and discover the former source of my misery, you may laugh at its minuteness, but I'm quite particular about configurations and making sure things work exactly as I wanted them to, which as you can probably guess is never easy as you'd like it to be.  However, they (who are they?) say Linux is all about being able to customize everything to your liking. 

The problem was with configuring the G4 PB's eject key to work as you'd eject, I mean expect.  That is, upon pressing the eject button, it would eject any CD or DVD you currently had inserted into your system if any.  Just as if I was still using good ole Mac OS X.  Sounded like a piece of cake.  Every other key on the keyboard did exactly what it said it would do including the volume up, volume down, and brightness keys.  However, whenever a disc was inserted, I had to revert to using the probably better known eject command line tool, which is simple enough, but I'd still like to have the key working as well.

Still being in the infancy of my foray into using Linux (and Linux on PowerPC), I started to research how certain keys were mapped in Debian and other Linux variations on PPC hardware.  I quickly learned certain specific key mappings worked through what software is known as pbbuttons. This runs as a background daemon and can be restarted with the usual restart methods at your disposal. It has a configuration file stored in the /etc directory. Full path is /etc/pbbuttonsd.conf.  Being in the /etc directly, the file will require root/sudo privileges to edit.

The configuration file has a number of customizable options that are way beyond the scope of this post, but as always, I encourage you to peruse the file and make adjustments where you see fit.  It includes such settings as the default values for the brightness values at login/startup, different configurations for when on battery power, and default values for sound and volume.

Anyways, the specific section we were looking for was the [MODULE CDROM] that allowed you to customize which keyboard key to act as the eject key, the delay when pressing that key and which CD/DVD device it was to work with. Right away, I learned from the config file that eject was mapped to the key 161.  Okay, that's nice, but what actual key on the PowerBook's keyboard does that actually map to exactly?  So... more research, which taught me another handy command line utility (honestly, what command line tool isn't?) called xev. Pretty straightforward tool. Just type xev and it will open a new window that intercepts events such as moving a window, resizing a window, or clicking on something, and spits out information regarding that particular event. For example, you can punch any one key on the keyboard and it will print out a number of pieces of information regarding that key.  When I hit the escape key, the utility printed back the following information.

KeyRelease event, serial 46, synthetic NO, window 0x2800001,
    root 0x121, subw 0x0, time 2053168, (639,-2), root:(840,578),
    state 0x10, keycode 169 (keysym 0x1008ff2c, XF86Eject), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False


I changed the keycode value accordingly, but sadly, no go. Long story short, the keycode returned by the utility is not correct and the 161 was actually the value for the eject key as was originally hoped.  So why was it still not working?

Well the only other configuration option that could be the issue was the CD/DVD device it was mapped to. I double checked and it was pointed to /dev/cdrom.  Sounds correct, but I decided to change directories over to the /dev directory to make sure such a device did in fact exist. I ran my alias command for 'ls -alh' to list out the contents of the directory as well display ownership and permissions among other things.
lrwxrwxrwx   1 root root           3 Dec  7 14:15 cdrom -> sr0

Almost right away I noticed in the permissions that the advanced permissions flag (first character in the list of permissions) was set to l, which indicates it is a symbolic link.  So moving my eyeballs further to right, the listing indicated that cdrom was a symbolic link to /dev/sr0.  I immediately updated the conf file to use the actual sr0 device instead of the symbolic link.  I saved the changes and restarted pbbuttonsd.  And what do you know, the key finally worked! Victory!

Here is the full posting of the CD module section if you are interested.
# [MODULE CDROM]
dev_CDROM             = "/dev/sr0"
EjectCDKey            = 161
EjectCDKeyDelay       = 0


In short, you need to map the CD/DVD drive to the actual /dev/[device name] as symbolic links will NOT work. I thought I would share this little tidbit of information in hopes that it helps somebody else someday.  I'll wrap it up here though and continue working on a few other posts I am putting together, including my work on my PowerBook 1400CS, installation of Debian Jessie on a G4 Quicksilver and working with the Clang compiler on PowerPC architecture.  Comments are welcomed!

Friday, November 14, 2014

Some Hardware News

A couple of things that I've come across lately that I have felt obliged to share with you.  The first is that an individual by the name of Robert Innocenti has embarked on a new project to develop new portable PowerPC hardware that would utilize some of Freescale's newer lineup of 32/64-bit PPC CPUs.  Much more information can be found on the website.  If you are even remotely interested in assisting in some way or another, I encourage you to do so.  For a project of this scale, it requires participation from people with varying skills and abilities. I wish him and the team the best at bringing this to fruition.
In other PowerPC hardware related news, somebody has found another way to make G5 PowerMacs (and as a result earlier model Mac Pro's) useful.  Well, I think it is much less useful than what those machines are still capable of today still, but I still commend him for the effort.  I have to admit, the recycled furniture does look pretty cool, although I'd much rather load the machine up with a Linux distro and tinker with upgrades and various PCI card add-ons.

Never thought there would be so much news about PPC hardware in this day and age.  But there you have it.   If you have suggestions or questions I could answer in future blog posts, please let me know in the comments below or shoot me an email! I'm currently trying to get the trackpad working on my new 1400CS in order to complete my blog post regarding the new hardware and its specifications.