Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


jandal160165

174 posts

Master Geek
+1 received by user: 9


#244997 13-Jan-2019 15:30
Send private message

Hi I am running  a Raspberry Pi 3B+ with a version of raspian.  

 

When it does a soft reboot the webpage server Apache2 won't start.  

 

Can i adjust a initialising file to ensure it starts every time?  Can I get an example of that please?  

 

If I remove the power adaptor for at least 10 seconds it will surely start.  TIA





Pedro
Huawei P20, H96Max, Smart Modem 3, HiFiberry, Pi3b+, 


Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic
 1 | 2
chevrolux
4962 posts

Uber Geek
+1 received by user: 2638
Inactive user


  #2160278 13-Jan-2019 16:15
Send private message

What OS are you running? A debian one? Not sure on version they are basing those R.Pi images off, but assuming debian 9... "sudo systemctl enable apache2" should do the trick.




michaelmurfy
meow
13579 posts

Uber Geek
+1 received by user: 10910

Moderator
ID Verified
Trusted
Lifetime subscriber

  #2160373 13-Jan-2019 17:12
Send private message

With Raspbian it should automatically start Apache.

 

If not, as mentioned above "sudo systemctl enable apache2"





Michael Murphy | https://murfy.nz
Referral Links: Quic Broadband (use R122101E7CV7Q for free setup)

Are you happy with what you get from Geekzone? Please consider supporting us by subscribing.
Opinions are my own and not the views of my employer.


jandal160165

174 posts

Master Geek
+1 received by user: 9


  #2160376 13-Jan-2019 17:17
Send private message

Hi I its a version of debian from a company called Max2play.  I have an amplifier (Hifiberry) HAT stacked on top of the pi.   I can get Apache2 to start using those commands.  But can I write something in some config file for it to restart automatically?

 

root@max2play:/etc/default# service --status-all

 

 [ - ]  alsa-utils

 

 [ + ]  apache-htcacheclean

 

 [ - ]  apache2

 

 [ + ]  avahi-daemon

 

 [ + ]  bluetooth

 

 [ - ]  console-setup.sh

 

 [ + ]  cron

 

 [ + ]  dbus

 

 [ - ]  dhcpcd

 

 [ - ]  dnsmasq

 

 [ + ]  dphys-swapfile

 

 [ + ]  fake-hwclock

 

 [ ? ]  gmediarender

 

 [ + ]  hd-idle

 

 [ + ]  hddtemp

 

 [ + ]  hostapd

 

 [ - ]  hwclock.sh

 

 [ + ]  ifplugd

 

 [ ? ]  init-ympd

 

 [ - ]  keyboard-setup.sh

 

 [ + ]  kmod

 

 [ ? ]  librespot

 

 [ + ]  lightdm

 

 [ + ]  lircd

 

 [ + ]  lircmd

 

 [ + ]  lm-sensors

 

 [ + ]  logitechmediaserver

 

 [ + ]  minidlna

 

 [ - ]  mpd

 

 [ + ]  networking

 

 [ - ]  nfs-common

 

 [ - ]  nmbd

 

 [ - ]  paxctld

 

 [ - ]  plymouth

 

 [ - ]  plymouth-log

 

 [ + ]  procps

 

 [ + ]  raspi-config

 

 [ - ]  rpcbind

 

 [ - ]  rsync

 

 [ + ]  rsyslog

 

 [ - ]  samba

 

 [ - ]  samba-ad-dc

 

 [ ? ]  shairport

 

 [ + ]  shellinabox

 

 [ - ]  smbd

 

 [ ? ]  squeezelite

 

 [ + ]  ssh

 

 [ - ]  sudo

 

 [ + ]  triggerhappy

 

 [ + ]  udev

 

 [ - ]  x11-common

 

 

 

Here again after a soft reboot.  Apache2 hasn't started.   Its just an annoyance.





Pedro
Huawei P20, H96Max, Smart Modem 3, HiFiberry, Pi3b+, 




chevrolux
4962 posts

Uber Geek
+1 received by user: 2638
Inactive user


  #2160411 13-Jan-2019 18:15
Send private message

Did you run the systemctl command as above?

jandal160165

174 posts

Master Geek
+1 received by user: 9


  #2160412 13-Jan-2019 18:19
Send private message

Ran the command but Apache2 still not restarting after SSH reboot





Pedro
Huawei P20, H96Max, Smart Modem 3, HiFiberry, Pi3b+, 


gzt

gzt
18682 posts

Uber Geek
+1 received by user: 7824

Lifetime subscriber

  #2160444 13-Jan-2019 18:56
Send private message

sudo systemctl status apache2

?

 
 
 

Shop now on AliExpress (affiliate link).
chevrolux
4962 posts

Uber Geek
+1 received by user: 2638
Inactive user


  #2160456 13-Jan-2019 19:25
Send private message

That's a bit weird.

 

I guess you could just put 'systemctl start apache2' in /etc/rc.local

 

Or maybe use 'service apache2 start' if systemctl doesn't work.

 

Edit: my understanding of Debian though is that it doesn't rc.local though.... @michaelmurfy will set us straight on that.


jandal160165

174 posts

Master Geek
+1 received by user: 9


  #2160459 13-Jan-2019 19:28
Send private message

Tried that command.  Will sudo nano that file and see what happens.  Found that file and it has some other lines for starting processes so added that in there as well.  Lets see what happens.

 

 





Pedro
Huawei P20, H96Max, Smart Modem 3, HiFiberry, Pi3b+, 


wazzageek
1095 posts

Uber Geek
+1 received by user: 108

ID Verified
Trusted
Lifetime subscriber

  #2160472 13-Jan-2019 19:52
Send private message

Have you checked the /var/log/apache2/error.log file ?

It sounds a little like a lock file isn’t being correctly removed upon a soft reboot. (Although it sounds very strange that a stop and start works correctly.)

jandal160165

174 posts

Master Geek
+1 received by user: 9


  #2160474 13-Jan-2019 19:55
Send private message

[Sun Jan 13 06:25:03.675570 2019] [mpm_prefork:notice] [pid 7883] AH00163: Apache/2.4.25 (Debian) configured -- resuming normal operations

 

[Sun Jan 13 06:25:03.675673 2019] [core:notice] [pid 7883] AH00094: Command line: '/usr/sbin/apache2'

 

No LSB modules are available.

 

No LSB modules are available.

 

No LSB modules are available.

 

No LSB modules are available.

 

[Sun Jan 13 15:33:04.760939 2019] [mpm_prefork:notice] [pid 7883] AH00169: caught SIGTERM, shutting down

 

[Sun Jan 13 19:41:30.185648 2019] [mpm_prefork:notice] [pid 964] AH00163: Apache/2.4.25 (Debian) configured -- resuming normal operations

 

[Sun Jan 13 19:41:30.187457 2019] [core:notice] [pid 964] AH00094: Command line: '/usr/sbin/apache2'

 

No LSB modules are available.

 

No LSB modules are available.

 

No LSB modules are available.

 

No LSB modules are available.

 

No LSB modules are available.

 

[Sun Jan 13 19:46:28.849610 2019] [mpm_prefork:notice] [pid 964] AH00169: caught SIGTERM, shutting down

 

 

 

Thats it there.  I just did a restart after adding that line...  and Apache2 hasn't started.  I couldn't tell you what I am looking at on here. 





Pedro
Huawei P20, H96Max, Smart Modem 3, HiFiberry, Pi3b+, 


wazzageek
1095 posts

Uber Geek
+1 received by user: 108

ID Verified
Trusted
Lifetime subscriber

  #2160533 13-Jan-2019 20:15
Send private message

what line did you add? What I’m deducing from the log is that the system must’ve started a little before 19:41, as that’s apache starting, but then 5 minutes later I can see that something is requesting that apache is shut down.

Is there enough memory on the raspberry pi for your configuration (i.e. you haven’t set MinSpareServers to something ridiculously high? How’s the disk free space on the machine?

if you use “dmesg” after a soft reboot (and when discovering apache2 is not up) do you see anything there that’s obvious?

Can you see if journalctl -xe is of any help?

 
 
 

Stream your favourite shows now on Apple TV (affiliate link).
chevrolux
4962 posts

Uber Geek
+1 received by user: 2638
Inactive user


  #2160539 13-Jan-2019 20:18
Send private message

Just a quick thought, looking at that Max2Play site, it seems their whole deal is about controlling your Pi from a web interface. That would be quite useless if they didn't start apache on boot.

 

Have you tried their support?


jandal160165

174 posts

Master Geek
+1 received by user: 9


  #2160543 13-Jan-2019 20:27
Send private message

I added this line to the file mentioned: 'systemctl start apache2' in /etc/rc.local

 

I have tried their support.  But it was me a complete linux novice who found the Apache2 problem for myself.   Which has been an issue from day 1 and probably something that they maybe aware of.  They have gone quiet on me since I mentioned checking the running services and finding Apache2 stopped when restarting from the command line.

 

Maybe I can make my logging a little more verbose to see what is going on?





Pedro
Huawei P20, H96Max, Smart Modem 3, HiFiberry, Pi3b+, 


gzt

gzt
18682 posts

Uber Geek
+1 received by user: 7824

Lifetime subscriber

  #2160558 13-Jan-2019 20:39
Send private message

Did I mention sudo systemctl status apache2 ? ; ).

jandal160165

174 posts

Master Geek
+1 received by user: 9


  #2160563 13-Jan-2019 20:43
Send private message

Hi thanks for the reply.  You did mention it as well.  Doesn't seem to make much of a difference.





Pedro
Huawei P20, H96Max, Smart Modem 3, HiFiberry, Pi3b+, 


 1 | 2
Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.