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.




157 posts

Master Geek


# 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


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
4171 posts

Uber Geek


  # 2160278 13-Jan-2019 16:15
One person supports this post
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.


Mr Snotty
8813 posts

Uber Geek

Moderator
Trusted
Lifetime subscriber

  # 2160373 13-Jan-2019 17:12
One person supports this post
Send private message

With Raspbian it should automatically start Apache.

 

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





 
 
 
 




157 posts

Master Geek


  # 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.


4171 posts

Uber Geek


  # 2160411 13-Jan-2019 18:15
One person supports this post
Send private message

Did you run the systemctl command as above?



157 posts

Master Geek


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

Ran the command but Apache2 still not restarting after SSH reboot


gzt

10872 posts

Uber Geek


  # 2160444 13-Jan-2019 18:56
One person supports this post
Send private message

sudo systemctl status apache2

?

4171 posts

Uber Geek


  # 2160456 13-Jan-2019 19:25
One person supports this post
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.


 
 
 
 




157 posts

Master Geek


  # 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.

 

 


Go Hawks!
945 posts

Ultimate Geek

Trusted
Subscriber

  # 2160472 13-Jan-2019 19:52
One person supports this post
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.)



157 posts

Master Geek


  # 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. 


Go Hawks!
945 posts

Ultimate Geek

Trusted
Subscriber

  # 2160533 13-Jan-2019 20:15
One person supports this post
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?

4171 posts

Uber Geek


  # 2160539 13-Jan-2019 20:18
One person supports this post
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?




157 posts

Master Geek


  # 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?


gzt

10872 posts

Uber Geek


  # 2160558 13-Jan-2019 20:39
One person supports this post
Send private message

Did I mention sudo systemctl status apache2 ? ; ).



157 posts

Master Geek


  # 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.


 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



Twitter and LinkedIn »



Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Bitcoin.com announces partnership with smartphone manufacturer HTC
Posted 16-Sep-2019 21:30


Finalists Announced for Microsoft NZ Partner Awards
Posted 16-Sep-2019 19:37


OPPO Showcases New CameraX Capabilities at Google Developer Days China 2019
Posted 15-Sep-2019 12:42


New Zealand PC Market returns to growth
Posted 15-Sep-2019 12:24


Home sensor charity director speaks about the preventable death which drives her to push for healthy homes
Posted 11-Sep-2019 08:46


Te ao Maori Minecraft world set to inspire Kiwi students
Posted 11-Sep-2019 08:43


Research reveals The Power of Games in New Zealand
Posted 11-Sep-2019 08:40


Ring Door View Cam now available in New Zealand
Posted 11-Sep-2019 08:38


Vodafone NZ to create X Squad
Posted 10-Sep-2019 10:25


Huawei nova 5T to be available 20th September
Posted 5-Sep-2019 11:55


Kogan.com launches prepay challenger brand Kogan Mobile in New Zealand
Posted 3-Sep-2019 11:42


Pagan Online available now
Posted 27-Aug-2019 20:22


Starship hopes new app will help combat antibiotic resistance challenges
Posted 27-Aug-2019 19:43


Intel expands 10th Gen Intel Core Mobile processor family
Posted 23-Aug-2019 10:22


Digital innovation drives new investment provider
Posted 23-Aug-2019 08:29



Geekzone Live »

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


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



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.

Alternatively, you can receive a daily email with Geekzone updates.