Cannot get script started

Hi there

I am trying to set up BrewPi according to the documentation.
I have done everything on the Raspberry as instructed, but when it comes to updating the Arduino nothing happens.

The web interface says that the script is not running, and nothing happens when I try to start it.

Anyone else had this problem, and might know what is causing this?

Thanks

Hi Sjonni,

Are you running this on a raspberry pi?
Did you install with our install script?
Do you have a cron job in /etc/cron.d/brewpi ?

Starting the script is done by cron, the button in the web ui just removes/creates a file that is read by cron to see whether the script should be running.

Thank you for your reply Elco

I am running this on Raspberry Pi yes, and installed using the install script.
I have /etc/cron.d/brewpi, and it looks like this:

stderrpath="home/brewpi/logs/stderr.txt"
stdoutpath="home/brewpi/logs/stdout.txt"
scriptpath="home/brewpi"
entries="brewpi wifichecker"
# entry:brewpi
* * * * * brewpi python $scriptpath/brewpi.py --checkstartuponly --dontrunfile $scriptpath/brewpi.py 1>/dev/null 2>>$stderrpath; [ $? != 0 ] && python -u $scriptpath/brewpi.py 1>$stdoutpath 2>>$stderrpath &
#entry:wifichecker
*/10 * * * * * root sudo -u brewpi touch $stdoutpath $stderrpath; $scriptpath/utils/wifichecker.sh 1>>$stdoutpath 2>>$stderrpath &

When I try to start it manually it says “Conflict: same config file as another BrewPi instance already running”

So I guess it is running, but the web interface says its not running.

I tried updating the arduino, but it just freezes up midway ( Checking old version before programming.)

You can kill running instances of brewpi with:
python brewpi.py --kill

I think if you have done that, the cron job will restart it.
Also try running: /home/brewpi.utils/fixPermissions.py

Thanks, killing it worked … now it shows "script running"
But I am still unable to upload hex file to the Arduino. I am using Uno.

Is it possible to use Mega ? I see that there are only hex files for Uno and Leonardo

Furthermore, there was no fixPermissions.py file, only .sh
I ran that, and now I´m back to “script not running” even if I try killing the process.

Here are the last few lines of the error log …

Settings will be restored if possible

Devices will be restored if possible

Checking old version before programming.

Mar 07 2015 12:42:09 Notification: Script started for beer 'Heavenly heaven'
Mar 07 2015 12:44:05 Notification: Script started for beer 'Heavenly heaven'
Mar 07 2015 12:48:05 Notification: Script started for beer 'Heavenly heaven'
BrewPi: wifiChecker: Cannot find gateway IP. Restarting wlan0 interface... (Sat Mar 7 12:50:02 UTC 2015)
/sbin/ifdown: interface wlan0 not configured
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Mar 07 2015 12:50:15 Notification: Script started for beer 'Heavenly heaven'
Mar 07 2015 12:51:46 Notification: Script started for beer 'Heavenly heaven'
Mar 07 2015 12:53:05 Notification: Script started for beer 'Heavenly heaven'
Mar 07 2015 12:56:06 Notification: Script started for beer 'Heavenly heaven'

sorry, the extension is indeed .sh

The notification is about our WiFi keep alive script. I wonder why you are getting that error. Are you running on WiFi?

We don’t officially support the mega. Can you try flashing the blink example to your UNO with a PC?
Try uploading our hex file via the web interface afterwards again.

Worked like a charm after flashing the blink.
Thanks! This has been bugging me for 2 weeks now.

Thank you for this great software by the way. I look forward to improve my brewing using this.

Elco,

I am also unable to get the script running. I have a cron job, plus I have tried killing brew pi and resetting permissions as per your post. I installed using the install script and have tried updating, re-installing, re-installing the whole operating system and brew pi again, all to no avail.

Huckwell

If it helps here is an extract from stderr.txt:

Traceback (most recent call last):
File “/home/brewpi/brewpi.py”, line 179, in
allProcesses.update()
File “/home/brewpi/BrewPiProcess.py”, line 108, in update
matching = [p for p in psutil.process_iter() if any(‘python’ in p.name and 'brewpi.py’in s for s in p.cmdline)]
TypeError: ‘instancemethod’ object is not iterable

This is because you have a newer version of psutil on your system than the one the master branch was written for.

I have two pull requests ready for merging develop (which has this fixed) into master. Will merge later today.

Even using the updated develop branch it is not working.

I will merge into develop when I get back home for both the script and the web interface. The latest version of the script checks your psutil version and tells you how to update it via pip. If it did not for you, did you use develop for both the script and the web interface? I will update the installer to take care of the updating via pip later this week.

Elco,

I followed the update process as per your post on the Spark version thread which showed that I was already running the latest psutil etc. I updated both the develop first and then master branch and still no joy getting the script to run, either after a syatem reboot and --kill command. If I try to run it manually in the terminal I get the following:

pi@raspberrypi ~ $ python /home/brewpi/brewpi.py
Mar 12 2015 08:04:44 Error opening serial port: [Errno 2] No such file or directory: ‘/dev/ttyACM0’. Trying alternative serial port /dev/ttyACM1.
Traceback (most recent call last):
File “/home/brewpi/brewpi.py”, line 332, in
ser, conn = util.setupSerial(config)
File “/home/brewpi/BrewPiUtil.py”, line 117, in setupSerial
ser = serial.Serial(port, 57600, timeout=0.1) # use non blocking serial.
File “/usr/local/lib/python2.7/dist-packages/serial/serialutil.py”, line 282, in init
self.open()
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 289, in open
self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
OSError: [Errno 2] No such file or directory: ‘/dev/ttyACM1’

I am not sure what could be causing this as it was a completely fresh install of the Rasbian OS and Brewpi.

I got this error when I started the log on the BrewPi when I connected it to the Spark. I did a complete reboot on the Pi and it fixed the issue. I did use fix permissions before the reboot.

I got this error when I started the log on the BrewPi when I connected it to the Spark. I did a complete reboot on the Pi and it fixed the issue. I did use fix permissions before the reboot.

I tried a full reboot, will do one again with the fix permissions beforehand.

I updated the master branch yesterday.
Did you run updater.py recently? You can use the master branch in both repositories.

Yes I have run the latest updater, see below:

pi@raspberrypi ~ $ sudo python ~/brewpi-tools/updater.py
######################################################

Welcome to the BrewPi Updater!

######################################################

Checking whether the update script is up to date
/home/pi/brewpi-tools is up-to-date.

Most users will want to select the ‘master’ choice at each of the following menus.
Press enter to continue…

*** Updating BrewPi script repository ***
You are currently on branch master

Available branches on the remote ‘origin’ for /home/brewpi:
[0] develop
[1] master
[2] Skip updating this repository
Enter the number of the branch you wish to update [master]:
Keeping current branch master
The latest commit in /home/brewpi is aa3735c3a6ecabe3b04abacd35789226b80fba34 on Thu, 12 Mar 2015 00:29:23
The latest commit on origin/master is aa3735c3a6ecabe3b04abacd35789226b80fba34 on Thu, 12 Mar 2015 00:29:23
Your local version of /home/brewpi is up to date!

*** Updating BrewPi web interface repository ***
You are currently on branch master

Available branches on the remote ‘origin’ for /var/www:
[0] develop
[1] master
[2] Skip updating this repository
Enter the number of the branch you wish to update [master]:
Keeping current branch master
The latest commit in /var/www is d44c03e786d0bde0dc43f86a8bd655659f3f3d2b on Wed, 11 Mar 2015 21:59:39
The latest commit on origin/master is d44c03e786d0bde0dc43f86a8bd655659f3f3d2b on Wed, 11 Mar 2015 21:59:39
Your local version of /var/www is up to date!

No changes were made, skipping runAfterUpdate.sh.
If you encounter problems, you can start it manually with:
sudo /home/brewpi/utils/runAfterUpdate.sh

The update script can automatically check your Arduino version and program it with the latest hex file from the BrewPi server, would you like to do this now? [Y/n]:n
Skipping Arduino update

*** Done updating BrewPi! ***

After this I ran the runafterupdate.sh

pi@raspberrypi ~ $ sudo /home/brewpi/utils/runAfterUpdate.sh

***** Installing/updating required packages… *****

Reading package lists… Done
Building dependency tree
Reading state information… Done
apache2 is already the newest version.
arduino-core is already the newest version.
git-core is already the newest version.
libapache2-mod-php5 is already the newest version.
php5 is already the newest version.
php5-cgi is already the newest version.
php5-cli is already the newest version.
php5-common is already the newest version.
python-configobj is already the newest version.
python-git is already the newest version.
python-psutil is already the newest version.
python-serial is already the newest version.
python-simplejson is already the newest version.
rpi-update is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.

***** Done processing BrewPi dependencies *****

***** Updating cron for the brewpi user… *****

no crontab for brewpi
Checking entry for brewpi …
Done checking entry brewpi …
Checking entry for wifichecker …
Done checking entry wifichecker …
Restarting cron
[…] Restarting periodic command scheduler: cron[…] Stopping periodic comma[ ok heduler: cron.
[ ok ] Starting periodic command scheduler: cron.

***** Fixing file permissions for /var/www *****

***** Fixing file permissions for /home/brewpi *****

After a reboot etc still no joy and the same errors as above if I try to run the script through the terminal.

You are getting that error because it cannot find your controller on serial port ACM0 or ACM1.

Did you connect the BrewPi Spark via USB? (WiFi support will come soon, but for now you need to connect it via USB).

I just released a hotfix to print a better error message and work around the exception (caused by a bug in PySerial 2.7).