Page 7 of 10 FirstFirst ... 56789 ... LastLast
Results 61 to 70 of 96

Thread: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

  1. #61
    Join Date
    Sep 2007
    Beans
    75

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    Quote Originally Posted by Philliesfan251 View Post
    Now for this problem I tried that and it kind of just hung, no emails or anything, had to Ctrl+C after like 5 minutes.
    Hey there, sorry for dropping off like that.

    As far as I can tell, the original error you had is a new bug that was introduced in Ubuntu 12.04. Since I am still on the older version, I can't replicated it (well... couldn't even if I tried since I am not at home).

    Here is a quick description of it (in language that is hard to comprehend):

    http://osdir.com/ml/ubuntu-bugs/2012-02/msg11004.html

    and here in language that is a little easier to follow:

    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=641886


    Here is my interpretation (which could be wildly incorrect, it is only based on about 15 minutes of googling):

    I think that the new version of mdadm only allows one monitoring process at a time. We tell mdadm explicitly to scan the arrays when we followed the following part of my tutorial:

    We want to add the above line into the madadm.conf file. The easiest way to do this is to append the line to the end of the file and then edit it afterwards. Start by typing the following (note the pipe symbol after the word scan… it should be right above the enter key on your keyboard on U.S. keyboards):

    sudo mdadm --detail --scan | sudo tee --append /etc/mdadm/mdadm.conf
    Now, edit the /etc/mdadm/mdadm.conf file by typing:

    sudo nano /etc/mdadm/mdadm.conf
    The line you appended should be at the end of the file. While it is actually ok to just leave it there, the German in me wants it to live in the "correct" location. I just use cut and paste to move it just under the portions that reads:

    # definitions of existing MD arrays
    It appears that newer versions of mdadm don't like the "name=XXXXXX" or "metadata=NN" portions of this line. Remove both of those so that the line just reads (again, your UUID will be different):

    ARRAY /dev/md0 UUID=77b695c4:32e5dd46:63dd7d16:17696e09
    Save and close the file.
    The new version of mdadm will not do any additional scanning without the --no-sharing option turned on.


    There are a couple ways of fixing this. The first, adding --no-sharing, should have done it for you (and I suspect it may have - more on this later). The second is to install an updated version of mdadm. You will have to use apt-get to download it (and you may have to use a different repository than the one built into Ubuntu - try googling on how to do that. I can try to help you if you run into trouble)

    Apparently the bug has been fixed, but it isn't in Ubuntu yet as far as I can tell. If you can download and install the latest version of mdadm, that might solve it for you.

    But according to what I have read, that
    --no-sharing
    should have fixed it for you.




    And it may have.


    mdadm will not stop until you hit ctrl-c. So that is normal.


    It seems to me that the email portion is not working. I.e. mdadm is doing what it should, but it isn't actually sending you an email (or for some reason you are not receiving it). As far as I can tell, you have never received an email from mdadm, is that correct? If so, I would suspect that that is your issue now. Look to see whether you have properly set up that part of the tutorial (I forget exactly where it is and don't have time right now to look, but let me know if you still need help and I can do some research).




    Here is one other thing you could try (add the --oneshot flag):

    Code:
    mdadm --monitor --scan --oneshot --no-sharing --test
    But I'm not sure that this is going to help at all. From the man page

    http://linux.die.net/man/8/mdadm

    we get this:

    -oneshot
    Check arrays only once. This will generate NewArray events and more significantly DegradedArray and SparesMissing events. Running
    mdadm --monitor --scan -1
    from a cron script will ensure regular notification of any degraded arrays.
    Which is a little cryptic.




    But I suspect the issue is your email settings.




    Oh, one more thing. Once you get this working in test mode, I'm not sure whether you need to somehow propagete the --no-sharing into the config file or something. That is another issue you may have to resolve.

    Good luck.

  2. #62
    Join Date
    Sep 2007
    Beans
    75

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    Quote Originally Posted by CharlesA View Post
    @bvz: Outstanding job on that script.
    Thanks!

  3. #63
    Join Date
    Jun 2009
    Location
    PA - 215
    Beans
    18
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    Quote Originally Posted by bvz View Post
    Hey there, sorry for dropping off like that.

    As far as I can tell, the original error you had is a new bug that was introduced in Ubuntu 12.04. Since I am still on the older version, I can't replicated it (well... couldn't even if I tried since I am not at home).

    Here is a quick description of it (in language that is hard to comprehend):

    http://osdir.com/ml/ubuntu-bugs/2012-02/msg11004.html

    and here in language that is a little easier to follow:

    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=641886


    Here is my interpretation (which could be wildly incorrect, it is only based on about 15 minutes of googling):

    I think that the new version of mdadm only allows one monitoring process at a time. We tell mdadm explicitly to scan the arrays when we followed the following part of my tutorial:



    The new version of mdadm will not do any additional scanning without the --no-sharing option turned on.


    There are a couple ways of fixing this. The first, adding --no-sharing, should have done it for you (and I suspect it may have - more on this later). The second is to install an updated version of mdadm. You will have to use apt-get to download it (and you may have to use a different repository than the one built into Ubuntu - try googling on how to do that. I can try to help you if you run into trouble)

    Apparently the bug has been fixed, but it isn't in Ubuntu yet as far as I can tell. If you can download and install the latest version of mdadm, that might solve it for you.

    But according to what I have read, that should have fixed it for you.




    And it may have.


    mdadm will not stop until you hit ctrl-c. So that is normal.


    It seems to me that the email portion is not working. I.e. mdadm is doing what it should, but it isn't actually sending you an email (or for some reason you are not receiving it). As far as I can tell, you have never received an email from mdadm, is that correct? If so, I would suspect that that is your issue now. Look to see whether you have properly set up that part of the tutorial (I forget exactly where it is and don't have time right now to look, but let me know if you still need help and I can do some research).




    Here is one other thing you could try (add the --oneshot flag):

    Code:
    mdadm --monitor --scan --oneshot --no-sharing --test
    But I'm not sure that this is going to help at all. From the man page

    http://linux.die.net/man/8/mdadm

    we get this:



    Which is a little cryptic.




    But I suspect the issue is your email settings.




    Oh, one more thing. Once you get this working in test mode, I'm not sure whether you need to somehow propagete the --no-sharing into the config file or something. That is another issue you may have to resolve.

    Good luck.
    Thanks for the reply, I just tried it and got this message:

    Code:
    frank@Server:~$ mdadm --monitor --scan --oneshot --no-sharing --test
    sendmail: cannot log to /var/log/msmtp.log: cannot open: Permission denied
    sendmail: log info was: host=smtp.gmail.com tls=on auth=on user=myemail@gmail.com from=myemail@gmail.com recipients=myemail@gmail.com mailsize=534 smtpstatus=250 smtpmsg='250 2.0.0 OK 1356613608 t17sm49147429wiv.6' exitcode=EX_OK
    ...and this email:
    Code:
    This is an automatically generated mail message from mdadm
    running on Server
    
    A TestMessage event had been detected on md device /dev/md0.
    
    Faithfully yours, etc.
    
    P.S. The /proc/mdstat file currently contains the following:
    
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
    md0 : active raid0 sdd1[2] sdb1[0] sdc1[1]
          1533528576 blocks super 1.2 512k chunks
    
    unused devices: <none>
    On a separate note, I started getting this hourly email:
    Code:
    /usr/local/sbin/hourly.active/hddtemp_monitor.sh: line 11: [: -ge: unary operator expected
    Not really in any rush to get it resolved because my server runs fine, but it would be nice to fix it

  4. #64
    Join Date
    Sep 2007
    Beans
    75

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    Quote Originally Posted by Philliesfan251 View Post
    Thanks for the reply, I just tried it and got this message:

    Code:
    frank@Server:~$ mdadm --monitor --scan --oneshot --no-sharing --test
    sendmail: cannot log to /var/log/msmtp.log: cannot open: Permission denied
    sendmail: log info was: host=smtp.gmail.com tls=on auth=on user=myemail@gmail.com from=myemail@gmail.com recipients=myemail@gmail.com mailsize=534 smtpstatus=250 smtpmsg='250 2.0.0 OK 1356613608 t17sm49147429wiv.6' exitcode=EX_OK
    ...and this email:
    Code:
    This is an automatically generated mail message from mdadm
    running on Server
    
    A TestMessage event had been detected on md device /dev/md0.
    
    Faithfully yours, etc.
    
    P.S. The /proc/mdstat file currently contains the following:
    
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
    md0 : active raid0 sdd1[2] sdb1[0] sdc1[1]
          1533528576 blocks super 1.2 512k chunks
    
    unused devices: <none>
    On a separate note, I started getting this hourly email:
    Code:
    /usr/local/sbin/hourly.active/hddtemp_monitor.sh: line 11: [: -ge: unary operator expected
    Not really in any rush to get it resolved because my server runs fine, but it would be nice to fix it

    Happy new year!

    Glad things are starting to settle down.

    The permission errors you are getting are, I think, because you are running mdadm directly (and not using the sudo command to run it as root). The command appears to run (seeing as how you are getting the email), but you don't have permissions to write to the log. If you try re-running it again but this time with the sudo command at the beginning of the line I suspect you would get the same email but without the error message at the beginning. But since you are getting the email, things appear to be working.


    The second error you are getting because there appears to still be a typo in your script (and if the scrip errors out, cron automatically sends an email to that effect). Could you post your hddtemp_monitor.sh script here again? That particular line in the script compares the hard drive temperature (HDTEMP) against your predefined alert level (ALERT_LEVEL). The error seems to indicate that one of those two variables does not contain a number. I think we managed to get the HDTEMP variable worked out previously, right? So it may be an error in the ALERT_LEVEL variable.

    Anyway, repost your entire script here and I suspect we can work it out.

  5. #65
    Join Date
    Jun 2009
    Location
    PA - 215
    Beans
    18
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    Quote Originally Posted by bvz View Post
    Happy new year!

    Glad things are starting to settle down.

    The permission errors you are getting are, I think, because you are running mdadm directly (and not using the sudo command to run it as root). The command appears to run (seeing as how you are getting the email), but you don't have permissions to write to the log. If you try re-running it again but this time with the sudo command at the beginning of the line I suspect you would get the same email but without the error message at the beginning. But since you are getting the email, things appear to be working.


    The second error you are getting because there appears to still be a typo in your script (and if the scrip errors out, cron automatically sends an email to that effect). Could you post your hddtemp_monitor.sh script here again? That particular line in the script compares the hard drive temperature (HDTEMP) against your predefined alert level (ALERT_LEVEL). The error seems to indicate that one of those two variables does not contain a number. I think we managed to get the HDTEMP variable worked out previously, right? So it may be an error in the ALERT_LEVEL variable.

    Anyway, repost your entire script here and I suspect we can work it out.
    I wasnt thinking, I tried sudo right after I posted that and it worked fine, thanks!

    Here's line 10 & 11:
    Code:
     HDTEMP=$($HDT $disk | awk '{ print $4}' | awk -F '°' '{ print $1}')
            if [ $HDTEMP -ge $ALERT_LEVEL ]; then
    All of this script stuff is completely foreign to me. Hopefully I'll have time to learn it one day.

  6. #66
    Join Date
    Sep 2007
    Beans
    75

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    Quote Originally Posted by Philliesfan251 View Post
    I wasnt thinking, I tried sudo right after I posted that and it worked fine, thanks!

    Here's line 10 & 11:
    Code:
     HDTEMP=$($HDT $disk | awk '{ print $4}' | awk -F '°' '{ print $1}')
            if [ $HDTEMP -ge $ALERT_LEVEL ]; then
    All of this script stuff is completely foreign to me. Hopefully I'll have time to learn it one day.

    No worries on the script stuff being foreign. Eventually it will make sense if you keep hammering on it. That said, there really isn't a need to learn it either.

    Try the following code. Save it as a completely different file (something like temp.sh) in your home directory. Change its permissions to be executable:

    chmod ugo+rwx ~/temp.sh


    Then run it by typing:

    ~/temp.sh


    Post back the results here. It will let me try to figure out where your code is going wrong.

    All this is is your code from a previous posting, but modified so that it prints out a bunch of diagnostic information as it runs (that is what all the echo commands are for - they just print a value back to the command line when the code runs)

    Code:
    #!/bin/bash
    HDDS="/dev/sd[a-d]"
    HDT=/usr/sbin/hddtemp
    LOG=/usr/bin/logger
    DOWN=/sbin/shutdown
    ALERT_LEVEL=1
    echo "ALERT_LEVEL"
    echo $ALERT_LEVEL
    for disk in $HDDS
    do
      if [ -b $disk ]; then
            HDTEMP=$($HDT $disk | sed 's/\(.*\)://g' | sed 's/^[ \t]*//' | awk -F '°' '{ print $1}')
            echo "HDTEMP"
            echo $HDTEMP
            if [ $HDTEMP -ge $ALERT_LEVEL ]; then
                echo "The server ubuntu is shutting down due to excessive hard drive temp. Drive: $disk has reached a temperature of $HDTEMP degrees Celsius and has crossed its limit of $ALERT_LEVEL degrees Celsius" | mail -s "ALERT! The server ubuntu is shutting down due to excessive hard drive temperature" youremail@yourdomain.com
                $LOG "System going down as hard disk : $disk temperature $HDTEMP degrees Celsius crossed its limit of $ALERT_LEVEL"
                sync;sync
                $DOWN -h 0
            fi
      fi
    done

    Note: I am visiting family at the moment and don't have a linux box in front of me to test this script. I hope I haven't introduced any errors but it *should* be good to go.
    Last edited by bvz; December 29th, 2012 at 11:06 PM. Reason: clarification and code update

  7. #67
    Join Date
    Jun 2009
    Location
    PA - 215
    Beans
    18
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    Quote Originally Posted by bvz View Post
    No worries on the script stuff being foreign. Eventually it will make sense if you keep hammering on it. That said, there really isn't a need to learn it either.

    Try the following code. Save it as a completely different file (something like temp.sh) in your home directory. Change its permissions to be executable:

    chmod ugo+rwx ~/temp.sh


    Then run it by typing:

    ~/temp.sh


    Post back the results here. It will let me try to figure out where your code is going wrong.

    All this is is your code from a previous posting, but modified so that it prints out a bunch of diagnostic information as it runs (that is what all the echo commands are for - they just print a value back to the command line when the code runs)

    Code:
    #!/bin/bash
    HDDS="/dev/sd[a-d]"
    HDT=/usr/sbin/hddtemp
    LOG=/usr/bin/logger
    DOWN=/sbin/shutdown
    ALERT_LEVEL=1
    echo "ALERT_LEVEL"
    echo $ALERT_LEVEL
    for disk in $HDDS
    do
      if [ -b $disk ]; then
            HDTEMP=$($HDT $disk | sed 's/\(.*\)://g' | sed 's/^[ \t]*//' | awk -F '°' '{ print $1}')
            echo "HDTEMP"
            echo $HDTEMP
            if [ $HDTEMP -ge $ALERT_LEVEL ]; then
                echo "The server ubuntu is shutting down due to excessive hard drive temp. Drive: $disk has reached a temperature of $HDTEMP degrees Celsius and has crossed its limit of $ALERT_LEVEL degrees Celsius" | mail -s "ALERT! The server ubuntu is shutting down due to excessive hard drive temperature" youremail@yourdomain.com
                $LOG "System going down as hard disk : $disk temperature $HDTEMP degrees Celsius crossed its limit of $ALERT_LEVEL"
                sync;sync
                $DOWN -h 0
            fi
      fi
    done

    Note: I am visiting family at the moment and don't have a linux box in front of me to test this script. I hope I haven't introduced any errors but it *should* be good to go.
    No worries, I'm not really in any rush, like I said. Here's the results. I did receive an email and the server did shut down.

    Code:
    frank@Server:~$ sudo nano ~/temp.sh
    [sudo] password for frank:
    frank@Server:~$ chmod ugo+rwx ~/temp.sh
    chmod: changing permissions of `/home/frank/temp.sh': Operation not permitted
    frank@Server:~$ sudo chmod ugo+rwx ~/temp.sh
    frank@Server:~$ ~/temp.sh
    ALERT_LEVEL
    1
    /dev/sda: open: Permission denied
    
    HDTEMP
    
    /home/frank/temp.sh: line 15: [: -ge: unary operator expected
    /dev/sdb: open: Permission denied
    
    HDTEMP
    
    /home/frank/temp.sh: line 15: [: -ge: unary operator expected
    /dev/sdc: open: Permission denied
    
    HDTEMP
    
    /home/frank/temp.sh: line 15: [: -ge: unary operator expected
    /dev/sdd: open: Permission denied
    
    HDTEMP
    
    /home/frank/temp.sh: line 15: [: -ge: unary operator expected
    frank@Server:~$ sudo ~/temp.sh
    ALERT_LEVEL
    1
    HDTEMP
    33
    
    Broadcast message from frank@Server
            (/dev/pts/0) at 16:25 ...
    
    The system is going down for halt NOW!
    HDTEMP
    30
    Email
    Code:
    The server ubuntu is shutting down due to excessive hard drive temp. Drive: /dev/sda has reached a temperature of 33 degrees Celsius and has crossed its limit of 1 degrees Celsius

  8. #68
    Join Date
    Dec 2012
    Beans
    7

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    This looks like a great guide especially for someone new to Ubuntu, like me. Would the steps be similar for 12.04 server or is there a similar guide out there?

  9. #69
    Join Date
    Jan 2013
    Beans
    1

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    I cannot say how grateful I am for this guide. I'm building a computer to do this on this weekend. I am wondering, though, would the security measures in this guide be incompatible with using Apache, MySQL and PHP to host a website? After completing this process I might search for a guide on how to do that.

  10. #70
    Join Date
    Jun 2012
    Beans
    10

    Re: Step by step guide to setting up Ubuntu 11.10 server for Newbies!

    Hi BVZ,

    Thanks for getting back to me (all those months ago) but I pushed my problems to the back of my mind and got stuck in with sorting SAMBA out.
    I've just bought a UPS for my server and can't get it to send me emails, so I've returned in the hope that you can suss me out!

    Like you, I only need the server to warn me when there's been an error with my RAID Array or my UPS.

    Here are the results of the commands you asked for:

    which mail
    /usr/bin/mail
    dpkg --get-selections | grep msmtp
    msmtp install
    msmtp-mta install
    MSMTP seems to be installed, it doesn't list in Webmin when I search for packages, but when I try to intall it from the terminal it says that it's already at the latest version.
    Running a command to send a test email results in an email being successfuly sent.

    MDADM's test emails worked when I last checked them (months ago) but not anymore, now I get:

    :~$ sudo mdadm --monitor --scan --test
    mdadm: Only one autorebuild process allowed in scan mode, aborting
    By adding --no-sharing to the end of that command it will actually send me a message; I won't pretend to know what that means, but I've put --no-sharing in the daily cron script for MDADM.
    Should I also add --no-sharing to the MDADM script in the 'cron.d' folder? and does this guarantee that if bad stuff goes down with my RAID array that I'll get the appropriate alert?

    Cheers!
    Last edited by incindre; January 7th, 2013 at 04:04 AM.

Page 7 of 10 FirstFirst ... 56789 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •