Web Interface gone after being unplugged once

Hi, I have Raspberry Pi 2 connected to Arduino Uno. Just set everything up a few days ago and the brewpi had been running without any problem until I unplugged it for a few hours and then plugged it back in. Afterwards there is no website to interact with, I just get “Unable to connect” in my browser.

I checked my router and I can see the raspberry pi on the network (it connects through a wifi usb stick). I can ping the pi and even SSH into it. I tried starting brewpi from within the pi and it said brewpi was already running. Still no website.

What can I do?

Do you have a GUI running on the Pi? Can you browse to localhost from it?

If you issue the command:

ps -ef | grep "apache"

Do you see something like this?

pi@brewpi:~ $ ps -ef | grep "apache"
root       918     1  0 Oct19 ?        00:00:47 /usr/sbin/apache2 -k start
www-data  3804   918  0 15:26 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  3805   918  0 15:26 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  3806   918  0 15:26 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  3807   918  0 15:26 ?        00:00:00 /usr/sbin/apache2 -k start
pi        4512  4489  0 15:31 pts/0    00:00:00 grep --color=auto apache
www-data 32648   918  0 06:25 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 32649   918  0 06:25 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 32650   918  0 06:25 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 32651   918  0 06:25 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 32652   918  0 06:25 ?        00:00:00 /usr/sbin/apache2 -k start

Did you try to restart apache?

sudo service apache2 restart

Here is what happened when I tried restarting apache:

pi@raspberrypi:~ $ sudo service apache2 restart
Warning: Unit file of apache2.service changed on disk, ‘systemctl daemon-reload’ recommended.
Job for apache2.service failed. See ‘systemctl status apache2.service’ and ‘jour nalctl -xn’ for details.
pi@raspberrypi:~ $ ^C
pi@raspberrypi:~ $ systemctl daemon-reload
Failed to execute operation: Access denied
pi@raspberrypi:~ $ sudo systemctl daemon-reload
pi@raspberrypi:~ $ sudo service apache2 restart
Job for apache2.service failed. See ‘systemctl status apache2.service’ and ‘jour nalctl -xn’ for details.
pi@raspberrypi:~ $ systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Drop-In: /lib/systemd/system/apache2.service.d
Active: failed (Result: exit-code) since Sun 2016-10-30 12:17:28 GMT; 22s ago
Process: 3427 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
pi@raspberrypi:~ $ journalctl -xn
No journal files were found.

And here I ran the command from LBussy:

pi@raspberrypi:~ $ ps -ef | grep "apache"
pi 3538 3333 0 12:22 pts/0 00:00:00 grep --color=auto apache

I have no idea what could cause this. A quick google search doesn’t give a clear solution either.
Did you try making sure everything is up to date?

sudo apt-get update
sudo apt-get dist-upgrade

Here is what happens when I try updating:

pi@raspberrypi:~ $ sudo apt-get update
Hit http://archive.raspberrypi.org jessie InRelease
Hit http://mirrordirector.raspbian.org jessie InRelease
Hit http://archive.raspberrypi.org jessie/main armhf Packages
Hit http://archive.raspberrypi.org jessie/ui armhf Packages
Hit http://mirrordirector.raspbian.org jessie/main armhf Packages
Hit http://mirrordirector.raspbian.org jessie/contrib armhf Packages
Hit http://mirrordirector.raspbian.org jessie/non-free armhf Packages
Hit http://mirrordirector.raspbian.org jessie/rpi armhf Packages
Ign http://archive.raspberrypi.org jessie/main Translation-en_GB
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Reading package lists… Done
pi@raspberrypi:~ $ sudo apt-get dist-upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages will be upgraded:
gdb gdbserver libapache2-mod-php5 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 php5 php5-cgi php5-cli php5-common php5-readline
raspberrypi-bootloader raspberrypi-kernel
14 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/74.7 MB of archives.
After this operation, 255 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Segmentation fault
debconf: Perl may be unconfigured (Can’t load ‘/usr/lib/arm-linux-gnueabihf/perl/5.20/auto/POSIX/POSIX.so’ for module POSIX: /usr/lib/arm-linux-gnueabihf/perl/5.20/auto/POSIX/POSIX.so: nonzero padding in e_ident at /usr/share/perl/5.20/XSLoader.pm line 93.
at /usr/lib/arm-linux-gnueabihf/perl/5.20/POSIX.pm line 36.
Compilation failed in require at /usr/share/perl5/Debconf/Template.pm line 7.
BEGIN failed–compilation aborted at /usr/share/perl5/Debconf/Template.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Question.pm line 8.
BEGIN failed–compilation aborted at /usr/share/perl5/Debconf/Question.pm line 8.
Compilation failed in require at /usr/share/perl5/Debconf/Config.pm line 7.
BEGIN failed–compilation aborted at /usr/share/perl5/Debconf/Config.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at (eval 1) line 4.
BEGIN failed–compilation aborted at (eval 1) line 4.
) – aborting
dpkg: unrecoverable fatal error, aborting:
files list file for package ‘libpython2.7-dev:armhf’ is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
pi@raspberrypi:~ $

That’s not good. That could be caused by a corrupt SD card.

If the SD card is corrupt, would the operating system still be running? and connecting to wifi, allowing me to ssh into it and everything?

Any idea what causes an sd card to corrupt?

Anyways, I have another SD card to try, but I was hoping to fix this without having to set everything up again, and losing my data.

I had this happen to me twice recently. Reinstalling Raspberry OS and BrewPi solved the problem, the SD-card still had a functioning installer on it.

Are you guys just pulling the power on the pi without shutting down? This causes SD’s to go corrupt almost every time i’ve done it.

Thanks for this!

I was just unplugging it and plugging it back in. I guess that may have caused my problem. I’ll be sure to do a proper shutdown from now on!

For those that are wondering how, in the thread linked by Subtletree I found these commands:

sudo shutdown -h now


sudo halt

I found that uncontrolled shutdown’s corrupted my SD card on the Pi on a regular basis. I always do a proper shutdown but on the occasions that it lost power, it would result in segmentation faults when starting services and causing panics. I would have to to a complete re-format / re-install to get it working again.

I also got segmentation faults when trying apt-get requests too. It was always a corrupted SD card.

My solution in the end was to connect a USB hard drive to the Pi and run the root filesystem from there. I’ve had no problems since (fingers crossed!).


This is another option:

This module can power the pi for long enough to shut down and can send that shutdown command when the power is lost.