Emoncms + RaspberryPI + Hard drive: How to prepare HDD

All,

I'm trying to follow the instructions of how to run emoncms from a RPi and hard drive. http://emoncms.org/site/docs/raspberrypihddbuild

I'm stuck on this section;

"Change /etc/fstab on HDD
Mount the Harddrive on your computer and open the main partition. Open to edit the file:

/etc/fstab
Change the root device from: /dev/mmcblk0p2 / to be /dev/sda2"

I've written the Raspbian image to the HDD (using Win32 disk imager), but all I can see on there now is 56Mb boot folder. There is no main partition. Should I have made a partition on the HDD? Where should the fstab file be located?

I've searched on google but can't find anyone else doing this...can someone assist?

Chris

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

The main partition is ext4 format which cannot be seen by a windows machine. What you see is quite normal.

You need to hook your hdd up to the pi, boot up on an sd card and mount the hdd filesystem to be able to edit /etc/fstab.

The preferred alternative method now is to use debian packages, have a look at this (rather longish) thread it explains how to start from scratch with the latest raspbian image and install emonCMS using the easier method 

http://openenergymonitor.org/emon/node/4908

the bit you should read starts about post 20-22 on Fri, 04/04/2014 - 22:38.

Paul

 

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

I have just transplanted the relevant part to its own thread for easy access. hope it helps :-)

Creating a local EmonCMS installation on a Raspberry Pi

Paul

charliemic's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

Thanks Paul!

All working now, except that having completed the heating scheduler instructions, I can't see packet gen in the Extras drop down menu- any thoughts?

Chris

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

Hi Chris, there are a couple of possibilities I can think of, the easy one is have you run Admin -> Update & check in emonCMS ? 

Try that first and if thats not it can you confirm the method you used that is whether followed the instructions you linked to entirely or did you "mix & match" or change anything.

Paul

charliemic's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

I've now caused myself another problem- I tried to change the RPi to have a static IP so I could do port forwarding. Somehow I must have entered the addresses incorrectly (using these instructions), as now I can't find the RPi on the network! Any way around this? Will I have to a) get a hdmi cable and monitor + keyboard or b) start again with fresh Raspbian image?

When I get back to the program, in response to your questions;

"have you run Admin -> Update & check in emonCMS ?" No. Do this on the RPi via SSH?

I followed http://openenergymonitor.org/emon/node/5092, then went to the heating scheduler instructions and added the modules, then edited the scheduler.

Chris

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

networking/port forwarding are not familiar territory but if you followed http://openenergymonitor.org/emon/node/5092 you do have the advantage of the redundant sd card image.

If you remove your sd card stick it in your card reader on your pc, open the file cmdline.txt replace " /dev/sda2 " with " /dev/mmcblk0p2 " save and return card to pi. when you reboot pi you will be running the original raspbian image. you can mount the hdd with

sudo mount /dev/sda2 /media/hdd

assuming you used these settings the first time round and haven't deleted/changed anything. from here you can ssh in as originally done and access the files you were editing to check & edit using commands like

sudo nano /media/hdd/etc/network/interfaces

note that you are not running on the hdd image so any commands you run will effect the sd card image not the hdd so restrict yourself to "having a look" "editing obvious mistakes" or "reverting the changes to allow you to regain direct access". When you feel you've fixed it run

sudo sh -c 'echo "dwc_otg.lpm_enable=0 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline rootwait" > /boot/cmdline.txt'

sudo shutdown -r now

to edit the /boot/cmdline.txt back to booting from hdd and restart the pi.

Good luck :-)

Paul
 

Bill Thomson's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

Paul,

Wouldn't he need to do sudo mkdir /media/hdd  before running the mount command?

 

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

Hi Bill

The /media/hdd directory was created during the initial "installing raspbian to hdd" so it should still be there (hence the "assuming you used these settings the first time round and haven't deleted/changed anything" disclaimer) hopefully :)

Paul

Bill Thomson's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

I wondered if something like that might have been the case. Hence the question, vice a statement...

charliemic's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

Got my head around crontab now (I had the scheduler line commented out in crontab, and also hadn't put spaces between each " * ". 

However I still can't see packetgen or scheduler in emoncms.

Do I need to reset something?

I discovered what I did wrong with changing the RPi's IP address- typo in the interfaces file! Again, obvious once you realise it.

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

When I get back to the program, in response to your questions;

"have you run Admin -> Update & check in emonCMS ?" No. Do this on the RPi via SSH?

Did you try this yet? You should log into emonCMS the usual way, via a browser, on the right of the nav bar at the top of the screen, you should have "Admin" then on that screen, click the "update & check" button.

If you haven.t already, try that first. There could also be an issue with the modules locations as the git and apt methods install to different locations and I've not tried mixing the two.

So can you confirm if you've done the "update & check" and hopefully that's it! but if not, someone better versed in the server antics may be able to confirm if the 2 module locations will work in harmony or if they should be combined,

Paul

ps for the record (future searches) did you use the redundant sd card partition or another method to access and fix the typo ?

charliemic's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

Paul,

I tried "Admin -> Update & check in emonCMS" in emoncms and it said that everything was up to date. I suspect the issue might be to do with module locations as when I tried to use

$ git pull /var/www/emoncms

it said that the folder wasn't a git repository.

To sort the RPi type in the etc/network/interfaces file, in the end I resorted to digging out an old playstation2 scart-phono converter, and connect up my TV! Worked a treat, except that I had to then learn how to fix the display which was cut-off down one side (and hence why it took me a while to see the typo!), and I only had one keyboard which I had to keep switching from RPi to PC!

 

Chris

charliemic's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

I should add that when I list the files in /var/www/emoncms/Modules it does show all of them their- raspberrypi, scheduler, packgetgen, events etc.

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

Ok, I'm not so good at understanding the git v apt default path situation, but based on what (little) I do know and my curious nature, in the absence of any solid advice I would revisit the scheduler instructions and replace every instance of " /var/www/emoncms/Modules " with " /usr/share/emoncms/www/Modules " to see where that got me.

In fact I just did (I did say I was curious) I ran

cd /usr/share/emoncms/www/Modules

sudo git clone https://github.com/emoncms/packetgen.git

sudo git clone https://github.com/emoncms/scheduler.git

as I already have the raspberrypi module. and they are accessible via the emoncms webpage (on a apt-get installed system). I ran "update and check" and browsed around the additional pages, but haven't configured or tested anything. I'd sat it's worth a try :-)

Paul

 

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

A quick update I ran through the steps on the scheduler page and the scheduler seems to function ok, I can see my temp sensor/zone and can change the set times and temps. I cannot see any resulting activity in the packetge. all the packetgen fields seem to work but I cannot see my "zone" this maybe due to the fact I did not rename my zones prior to initial use or maybe something else is amiss or maybe I'm just not doing something right, I've run out of time right now (need to be somewhere) so may pick this up later if I get time and try to fathom it out 

Paul

charliemic's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

I just did the same and can now see scheduler and packetgen. However like you I can't see any of the zones in packetgen. Did you get any further?

The scheduler temperature numbers are cut off in my browser- the entry box isn't quite large enough. So I changed the values of the box sizes in the php file.

Chris

charliemic's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

I notice the scheduler instructions also include;

git clone https://github.com/emoncms/raspberrypi.git

I appear to already have this in /usr/share/emoncms/www/Modules, but does it need to be updated? Or should already be the latest?

Chris

pb66's picture

Re: Emoncms + RaspberryPI + Hard drive: How to prepare HDD

That copy would of been installed by the emoncms-module-rfm12pi package. 

I have already tried apt-get remove emoncms-module-rfm12pi and then installed using the git clone method and have also installed the modified version from the packetgen's copyto_raspberrpi_module folder as per the original packetgen installation method as although thats not mentioned in the heating scheduler module thread, I assume it's required as the packetgen code is missing from the raspberrypi_run.php copy that is installed with the raspberrypi module.

I'm guessing somewhere there is a misdirected path due to the modules being in a different location, but that is just a guess.

So far I haven't spent too much time on this, as to be honest I'm not that sure of what I'm doing and it's not something I currently need

Paul

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.