Link to home
Create AccountLog in
Avatar of Brockstedt
BrockstedtFlag for United States of America

asked on

Ubuntu Server 11.10 disallows connections after 3 - 5 minutes

Good Day,

We have installed two Ubuntu Linux servers (One is a web server, the other a tftp server) both are running Ubuntu Server 11.10

We have been troubleshooting the issue of the servers not allowing traffic if there has not been any activity between 3 - 5 minutes. This causes users not to be able to access the web site or for the IT staff to use the tftp sever.

we are unable to SSH in so we will have to log into the servers locally and ping a host on the network, then traffic will start flowing again.

We have setup a cron job to ping an internal network address every 60 seconds on the web server which seems to be a work around until we can find a permanent solution for the issue. We have not done this on the tftp server due that we want to leave it as is so we can test possible solutions in it. It is only used for our switches and routers.

A solution to this issue will be greatly appreciated.


Dave Brockstedt
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

Have you checked whether iptables rules change between the working and non-working states? Here are the commands I would use
{ set -x;for i in filter nat mangle raw;do iptables -t $i -n -v --line-numbers -L;done;set +x; } >t5 2>&1

Open in new window

Issue that when it's working. When it's not working, issue the same command except use >t6 rather than >t5. Next diff t5 t6 to see if there are any changes.
Did you check the power management settings to see if someone accidentally set it to sleep?  What happens at the console when you lose your connection?  Do you have to reboot the server?
Avatar of Brockstedt


Good Day Duncan & Serialband,

Thank you for your responses. Duncan, I checked the iptables and they are empty, we have not configured any rules.

Serialband, I checked what I knew for power management (which isn't much, I'm not well versed in Linux) and discovered there was a script named 20hdparm located in /etc/apm/event.d, which I have posted below. I assume this is putting the server into a suspended state. If it is, how do I disable this script?


# Copyright (c) 2000-2002 Massachusetts Institute of Technology
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

set -e

# The APMD_DRIVES setting specifies the drives to be changed.  Set
# this to an empty string to disable any changes.

# The spindown timeout is set to the value of APMD_SPINDOWN when the
# computer is running on battery power.  When the computer is on AC
# power, the spindown timeout is disabled.  The number specified here
# is encoded in a complicated way.  See the man page for hdparm(8) for
# details.  For small timeouts, numbers between 1 and 240 specify
# multiples of 5 seconds.  So the default value of 18 means 18*5=90
# seconds, or 1.5 minutes.

[ -x "${HDPARM}" ] || exit 0

[ -n "${APMD_DRIVES}" ] || exit 0

  [ -b "${DRIVE}" ] || exit 0

[ "${APMD_SPINDOWN}" -gt 0 ] || exit 0

power_conserve ()
    # Set IDE hard disk spindown time to a short time.
    for DRIVE in $APMD_DRIVES; do
      "${HDPARM}" -q -S "${APMD_SPINDOWN}" "${DRIVE}" || true

power_performance ()
    # Disable IDE hard disk spindown.
    for DRIVE in $APMD_DRIVES; do
      "${HDPARM}" -q -S 0 "${DRIVE}" || true

choose_power ()
    if on_ac_power > /dev/null

if [ "${1}" = "start" ]; then
elif [ "${1}" = "resume" ] && [ "${2}" != "standby" ]; then
elif [ "${1},${2}" = "change,power" ]; then
elif [ "${1}" = "stop" ]; then

exit 0
Try this,
/etc/init.d/apmd stop

To turn it off permanently, follow the instructions on this link:
Good Day Serialband,

There is not an apmd in the /etc/init.d location so I did a search for it which resulted in nothing found named apmd.

The instructions with the link you sent wont apply due that we do not have gnome (or any other GUI) installed. We only access the servers via SSH.

Would it be beneficial to install one?
I wouldn't install a GUI on a server, no.
How about trying

/etc/init.d/acpi-support stop


stop acpid

If that doesn't work, try checking the bios.
What other files are in /etc/apm/event.d? Please post the output from ls -l /etc/apm/event.d if you can. Usually with directories with names ending .d, you can cd to them and chmod a-x *, after which none of the contained scripts will be run.
Do this when you have network connectivity :)
Output from ls -l on event.d folder:

administrator@cucmtftp:/etc/apm/event.d$ ls -l
total 4
-rwxr-xr-x 1 root root 2267 2012-07-10 09:54 20hdparm

There is not a acpi-support or acpi in the init.d directory. Below is the output for everything containing acpi:


Duncan I will try the chmod command you recommended.

Maybe I did not include something needed Duncan :)  Below is output when trying chmod

administrator@cucmtftp:/etc/apm/event.d$ chmod a-x*
chmod: missing operand after `a-x*'

I am not well versed in linux but have been given the task of crash coursing myself. I really do appreciate ya'lls assistance and patience with me on this.

You missed the space before the asterisk. 20hdparm is the only file in /etc/apm/event.d but
chmod a-x *

Open in new window

will stop it from running
Will it help to get a log report? If so, how would I get the report or log for you to view?

Yes there might be something in the system logs. I would make sure there is 1 log file that logs everything. E.g. I have this in my /etc/syslog.conf
# Everything is logged here.
*.debug                                         -/var/log/debug

Open in new window

You could add those lines to your file. If in doubt, post your /etc/syslog.conf and I can post one back with any suggested changes
Did you re-try the chmod?
Good Day Duncan,

It appears the server is running rsyslog. I did a search for syslog.conf and am unable to find a file by that name.

I did try the chmod again yesterday but with no luck.

You can Google for how to administer rsyslog - that's all I would be able to do for you anyway.
How did chmod fail?
I didn't get any notice that the chmod failed, the system just didn't allow connections again after a few minutes.

Will work on the rsyslog.

Avatar of Brockstedt
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Changed Operating System