Wednesday 12 December 2012

This is where Windows still leads the way

The Wheezy CUPS server - should be a sinch. - Ha!

To be fair to the RasPi, setting up CUPS and the administrative framework on the Pi was easy.  No issues like those that I had with the Arch build.  From the web interface for CUPS, the test page printed nicely.

And that's where the fun stopped.  My Windows box easily connected to the printer at installation, however, every print job I sent, failed to go through.  Print the test page from the CUPS admin interface - still good.  But not able to print from another machine.

So, my Canon PIXMA MP270 was working from the CUPS interface using the Gutenprint generic drivers, but otherwise not responding.  So, time to get the Canon drivers.  Canon do drivers for Linux machines, but not those running on the ARM architecture.  I tried installing the Canon drivers on the Pi, and the failure message indicated that the drivers were not compatible with ARM.

From some further research, it appears that the HP printer drivers have been ported to ARM builds quite successfully, but the issue that I've always had with HP is that their consumables are so expensive.  And at the moment, we have a good stock of consumables for the Canon. 

So, one solution would be to buy a new HP printer - not going to happen.  This PIXMA is reliable, good quality and we've got a stack of consumables for it.

Another might be to see if I can find any evidence of some security setting or config value that is stopping the network communication with the Gutenprint drivers.

Sunday 9 December 2012

Build on Stability

Tried in the last few days to get a CUPS server up and running on and Arch Linux base.  My rationale was simple - Arch Linux is a 'bare bones' distro - excellent, this will help it to be only as big as is needed.

Got the RPi up and working no problems.  Tried to get CUPS on to it - problems abound.  Apart from trying to find a mirror that would accept my connection, once I had a mirror to connect to, downloading package details was easy, but downloading the package itself and installing the package kept resulting in an error.

I tried several solutions from the Arch Wiki and other forums- no luck.  Appears that the issue was on the other end - ie the package was broken, or possibly pacman itself was at fault.  Either way, enough time lost.  I'm going for a new wheezy setup for the CUPS print server.

Saturday 8 December 2012

Immediate Needs

Well it has been a while since I have had a serious play with my RPi machines. Part of the issue being our power bills – really wanting to bring those down, meant redesigning our home network. In the end I removed two big boxes, a router and a switch. Which should reduce our power consumption by a good 5kWh per day or more. But still the power bill and usage is high. It needs to come down for both the sake of the environment, and so I don't need a second job.

So with this in mind, I am going to turn my first two RPi boxes to two particularly dedicated causes. One being that of a web server for both internal and external facing sites, the second as a CUPS server.

Given that I have not decommissioned, nor do I currently run a web server, why would I do that? Is that not just creating another machine to run and draw power? Yes and No. Currently my wife and I have about 6 different 'sites' (blogs, sites etc) with freely hosted arrangements. As we expand upon what our Internet communications are doing for our professional lives, we will want to adapt our web sites, and this is likely to mean paying for web hosting. Why not run our own server, and with the money saved in hosting costs, cover a little more power usage?

The CUPS server is another no-brainer once I thought more about it. Whilst I have taken to shutting my desktop machine down at night/in the morning, I often come home to find that it is on. That's because my wife has been doing some printing, and it is my desktop that shares the printer to our home network. I think a CUPS server that can be on 24/7 might be more the go.

So with these two challenges in mind, I have set off to get it done.

Web server.
Where to start? Simple, lets do this the professional way and start with the requirements.
Web server capable of serving up a number of sites. Preferred server-side script is PHP. Preferred DB is MySQL. So a LAMP server it is then! With phpmyadmin too please!

Without too much trouble I did a quick search for blogs/posts about this and first hit I found was at www.instructables.com/id/Raspberry-Pi-Web-Server/. Good post by drcurzon, lots of screenshots and easy to follow, step-by-step instructions – hence I am not going to make a hash of it by trying to reinvent it.

The one change I found necessary was in Step 9. If in the /etc/passwd file you comment out the pi user line (assuming pi is the user that you wish to use for FTP) you will not be able to connect via FTP, nor start a new SSH session. So from my experience, do not comment out this line. Merely observe that the running of the command usermod -d /var/www pi does change the default folder to open.

The only other problem I had I caused for myself by forgetting the credentials that I set for phpmyadmin. Eventually found them by going:

sudo nano /etc/phpmyadmin/config-db.php

Now the next trick will be to put my RPi web server into my DMZ, and ensure that I can connect to it for SSH and FTP, and web of course.

Monday 5 November 2012

Another Life

As someone with a bent for security, there are several 'rules' that I follow.  First is to avoid connecting an unsecured device to the Internet.  Another is to always change the factory default passwords to achieve the first rule.  The third is to never write a password down.  This often requires that I break rules one and two when I forget a password.

I did get my previous RPi install up and running under wheezy, with a wired USB keyboard and mouse.  No problems.  Even set the root password.  Forgot that too.

Opportunity.
So now that we have yet another edition of the Wheezy image to play with, I'll start again, with the following resources:

1 - Rpi Version 1 board inside a perspex case
1 - micro USB, 1A power supply
1 - HDMI -> DVI dongle
1 - 17" LCD monitor
1 - SanDisk 8GB 10 SD Card
1 - USB keyboard
1 - USB Mouse

For the software side, I have the latest "Wheezy" image
2012-10-28-wheezy-raspbian.img

Research and Lessons
So, what I have found out since the last attempt to fire up the RPi is:

overscan - this setting allow you to correct for boarders around the screen image on HD displays and for the correct centering of the screen.

memory_split - this config setting allows you to control how much of the RAM is dedicated to the GPU processing.  There are three possible settings: 32MiB, 64MiB and 128MiB.  64 meg is the default setting.  If you want faster graphics pump it up to 128 meg.

overclock - obvious what this config setting is for.  The options available are complex, and I am not going to pretend to know them all.  See RPi Config wiki for further details.

Outcomes
So far much the same as the previous occasion.  I tried running change_pass in the config - erred for some unexplained reason.  Selected en_AU ISO-8859-1 as my locale.  Went to the memory_split option - here the config gives 5 options, 16/32/64/128/256.  64 is the default, but I think I want 128, as I will test this build as a graphical user workstation for the home.  Overclock I will leave alone for now.  SSH, I will leave alone.  For now I will also leave the boot behaviour alone, as I want to be able to do admin from the command line at times.

After the reboot and login, have changed the password.  Now I'm running startx. What a clean interface - I like it.

Thursday 18 October 2012

Current Theorems - Am I on Track?

Perhaps my previous calculations of power consumption are too simplistic.

In researching green options, I discovered on some forums the use of a 5 port USB powered hub to deliver power to the RPi, and its peripherals, with the RPi delivering communications and data back to the hub.  I had been wondering about the concept of using one hub to power multiple RPis - would it be more efficient and greener?

Both the RPi and the hub run from their own transformers.  The RPi transformer has an input of 240V at 50-60Hz, drawing 150mA, and delivers a DC output of 1A 5VA.  To my limited knowledge of the calculations involved, this means that the input power is: 240 x 0.15 = 36 Watts, and the output is: 5 x 1 = 5 Watts.  This would imply that 31 Watts is lost to the resistance and impedance of the unit, and generates heat in the transformer.

When I look at the input and output of the USB hub's transformer, the input is: 240V at 50-60Hz, drawing 1A, therefore 240 Watts.  The output is 5V 1.5 A, therefore 7.5 Watts.

This would imply that whilst the powered hub supplied 50% more power, it draws 660% more power from the mains, and hence would not be a greener more efficient supply.

However, I know that my knowledge in this area is presently limited - am I using the right calculations and making the right deductions? Should I be calculating and comparing the power consumption of the transformers from their input or output values? Are these constant loads, or the maximum loads of each unit?

Anyone able to help?

Sunday 14 October 2012

Raspberry Pi - The Organic Way to a Green Network?

Epilogue to the Previous Post

There was life in my RPi, but not as I planned it Jim!

As a headless box, remotely operated through an SSH session, the Pi worked well - including its raspi-config tool.

But the wireless USB keyboard and mouse not working was my fault.  I didn't check the specs of the peripherals first.  If I had, I would have realised that they were not compatible with Linux.  Have since ordered a new set from Element14.

Going Green

Whilst waiting to get these goodies, I've been doing some thinking and planning.  My testing of the RPi and its abilities against other platforms is still in the planning process..  But in parallel I've had some other thoughts.


Looking at the power bills that we are getting out in a rural region - horrendous.  I'm certain that part of that excessive power usage is my small network of machines at home.  Yet I want to do more from home, with more machines.  That can only mean one thing - a bigger power bill.  Or does it?

Perhaps the RPi can come to the fore here.  Part of the problem is the machinery that I leave running most of the time.  My desktops and laptop are not so much of an issue if I shut them down overnight when not in use.  But looking at my network as it is now, and how I would like it to be, there are several spots in which I might wish to substitute in a RPi.  The list of appliances that I would like to have running 24/7 includes:

  • Firewall/Proxy Server
  • Dedicated Web Server
  • Dedicated Web App Server
  • Dedicated DB Server
  • Dedicated IDS/Honeypot
  • Dedicated Print Server

In considering the suitability of the RPi for any of these roles, I need to be able to compare apples to apples.  To do this from the power supply perspective, we need a way of comparing our traditional desktop power supply of 300 to 400 Watts, to the 1 Amp supply running the RPi.  To do this, we are going to make use of the equation;

          Watts = Amps x Volts

So, how many Watts does the RPi draw?  This is always going to be dependent upon the power pack used.  The power pack that I'm using currently has an output of 1 Amp at 5 VA.  But that is what it outputs to the RPi, not what it draws from the power socket.  What it draws from our power socket is 240 Volts at 150 milli-Amps.  Throwing these values into our equation;

          Watts = 0.15 x 240

          Watts = 36

But of course, I could compare this to a desktop or server with a 1KW PSU, and rave on about how much of a saving it should make, but it is not the size of the PSU that is important, but the amount of hardware that it supports.  From various sites you can utilise an online power calculator.  I went to eXtreme Outer Vision's calculator page.  Here I plugged in the values that were as close as possible to what my existing firewall machine has.  It is running a 300Watt PSU.  I calculated the power draw for it based upon a 90% CPU utilisation and it calculated that it would require a minimum of 198 Watts, but recommended 248 Watts to be sure.  For my comparison, I am going to take the conservative value of 198 Watts.  This is nearly 6 times more than the power draw of the RPi.  I think that there could be some real savings achieved.

To see how these potential solutions turn out, I have started a new page at: Raspberry Pi and Green Home Network

Tuesday 9 October 2012

Is there life?

Many ideas have been swirling in my head of late, for this project.  However, they are all far into the future for now.  Right now, the key critical thing is to get one of my RPi boxes active with a standard generic OS.

So, lets recap what ingredients I am putting into this stock-standard mix.
1 - Rpi Version 1 board inside a perspex case
1 - micro USB, 1A power supply
1 - HDMI -> DVI dongle
1 - 17" LCD monitor
1 - SanDisk 8GB 10 SD Card
Medion cordless keyboard and mouse

For the software side, I have the latest "Wheezy" image
2012-09-18-wheezy-raspbian.img

Setting up the SD Card
This went rather smoothly.  Simply follow the instructions presented at RPi Easy SD Card Setup.

Plug it in and Go!
Next was the easy step of plugging everything in and letting rip.  Since there is no on/off switch for the RPi, it starts as soon as you plug the micro USB adapter in.  Very quick to start up.  in under 20 seconds, Wheezy has loaded, and has opened the Raspi-config screen.  One small problem here for me, the wireless keyboard and mouse are not supported.

There are essentially two options that I have at this point.  The first, is to find a spare USB keyboard and USB mouse and plug them in - not so easy at 9:30 pm at night.  I do have a spare PS2 keyboard, and a semi functional USB mouse, but I'd need an adapter dongle.  The second option (I think), if the RPi has loaded its OS enough that it can network and accept telnet commands is to network it, and remotely take control - though I'm not sure how this will go given the config screen it is currently displaying.

Why Not Remote From Word 'Go'?
Perhaps I am over cautious, but one rule I have is not to network something until you have secured it.  Out of the box, the wheezy image is not secure.  It's preset login account has its name and password posted to the Internet.  However, if I can network it and remotely login, I should be able to secure it with a password change, and passwd the root account in a reasonably short space of time.  So I will try that.

Apart from a bit of cable management - my routers and switches needed some switching around to fit my RPi into the subnet that I wanted it - this step was fairly simple.  Thank goodness for good old PuTTY!  Started an SSH session with the RPi, and was able to reset the pi user password, and the root user password.

Interesting to note, that in the PuTTY session it has shown the message "NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'".  Excellent.  So that's the next step.



On running the config, you'll see a number of options.  The info screen is just a short paragraph that recommends using this config tool earlier rather than later - before making any major changes of your own to the set up.

'expand_rootfs' is an option that I'll explore later.  As noted in the RPi Easy SD Card Setup page, the standard image is only 2GB.  I'm running an 8GB SD Card - so there is spare space there.  The RPi Resize Flash Partitions page talks you through the options of expanding this existing partition, or creating a data partition.  For now, I'm going to leave this.

'overscan' is an option I have not heard of before.  When you enter the screen for it, there is simply the option to enable or disable.  I need to research this more.

'configure_keyboard' is an option I'd really like to fix - given my issues so far.  Upon entering this option, the screen reverts back to the command line for a few seconds to load the keymap.  It sets the preliminary keymap, and then returns to the config screen.

'change_pass' - already did that through the PuTTY session directly with the 'passwd' command.

'change_locale' is an interesting option.  Again, this will quickly leave the config screen to the command line to load some values, then brings up a new config screen.



For Australia, not sure what to pick on this screen so I will go with the advice of picking a UTF-8 locale code.  My selection leads to another config screen, which appears to indicate that I have selected a locale that has access to english_Great Britain character set.



Selecting OK here, then leads back to the command line, whilst the locales are generated.  When finished it will return you to the main config menu.

'change_timezone' - at the moment I need timezone Lima - UTC +11.  Lets see what's set.



First screen allows you to select the geographic area.  For those in Australia, simply scroll up this list to find it.  From there I'll select Canberra as the nearest city to where I live.



Done.

'memory_split' - I will investigate and get back to you.

'overclock' - I am interested in using this option as I have heard that the 700MHz CPU can clock up to 1GHz when performing particular operations.  For now, I'll leave it as stock standard.

'ssh' - This I suspect is as the menu describes, a toggle option for SSH server functionality.  Either enable or disable.  Given my current session was started under SSH, I'd say the server in the wheezy image is enabled by default.

'boot_behaviour' - this option gives you a vote to start straight to the desktop on boot - Yes or No.  For now, I'm going with No.



'update' - note the uncertainty of this option.  The menu description says 'Try to upgrade raspi-config'.  I suspect that from the description, this will not upgrade the kernel or any Linux modules, other than this very config module.

Back to the Books
So for now, there are some items for me to research and explore, and return to later.  So I'll finish with the config.  This leads to the option to reboot now, which I will.  Unfortunately, upon reboot, I am still in the state where I can not use the box on its own - I still need to configure the wireless keyboard and mouse.  Something more for me to research for the next post.