Saturday, January 29, 2011

Is it safe upgrading php through Testing Repository (CentOS)

Hello,

I need to upgrade PHP to 5.2.x

Im referring here as how to do upgrade it:
http://wiki.centos.org/HowTos/PHP_5.1_To_5.2
http://www.securityhacking.tk/2010/02/install-upgrade-php-5-1-to-5-2-centos-5-4/

But that was testing repository. Is it safe to use it on live server?

Thank you.

  • The answer is on the CentOS site

    ...it should not be left enabled or used on production systems...

    So that's that.

    However due to the age of PHP 5.1.6 and the expectations of customers I can see why you may want to do the upgrade anyway.

    From my experience I have a server running 5.2.10 from the testing repository. There have been no problems in using this version from Testing.

    Obviously I cannot provide any assurance it won't break on your setup but you can reduce any disruption by enabling rollbacks in Yum. To do this add

    tsflags=repackage
    

    to /etc/yum.conf before enabling the repository and performing the upgrade.

    Then if anything breaks you can rollback. There is an example of how to do this here.

    So the steps involved are:

    1. Edit /etc/yum.conf, add tsflags=repackage to enable rollback.

    2. Add the CentOS Testing Repository . See the instructions here.

    3. Upgrade PHP and only PHP by doing yum update php --enablerepo c5-testing. (Dependencies will be updated too, such as php-gd if installed.)

    4. Test your PHP applications thoroughly and check log files for unseen problems.

    5. Rollback if necessary.

    6. Tidy up /etc/yum.conf

    The Testing Repository should be left disabled, by setting enabled=0 in /etc/yum.repos.d/CentOS-Testing.repo to avoid accidentally updating httpd or any other critical applications with newer versions in Testing.

    This means you will have to manually check for updates to PHP regularly by using

    yum check-update php --enablerepo=c5-testing
    

    The bottom line is that it appears to work okay, but if you break anything you get to keep the pieces so you best have backups.

  • Maybe check the atomic turtle repository. They wrote plesk and these days focus on atomic secured Linux. Recent PHP rpms are available on their site and updated regularily.

    Richard Holloway : There are many places you can get newer versions of PHP as RPM or you can install from source. The question asked here is whether it is reliable for a production server. The CentOS view is "No stick 5.1.6 shipped by default". I saw the atomic turtle repository in my search for a solution for me. Do you run this version of PHP from this repository and is it more reliable that CentOS Testing?
    Imo : I run this (Atomic RPMs) in a production environment and have not experienced any problems with it. Not used CentOS testing so cannot compare. Sorry.
  • Jason Litka provides 3rd-party RPMs for php: http://www.jasonlitka.com/yum-repository/

    Safety is always a sliding scale. Clearly you are already running Centos, meaning you are probably running without a support contract of any kind and you have deemed this to be safe. I'm going to assume that when you hit problems you either try and debug yourself or you ask the community for assistance, and go from there. This is already "unsafe" from a bank/large corporation perspective.

    Sticking with either the Centos testing RPMs or Jason Litka's will place you more at risk of problems but there are still a significant portion of the user-base who are running this way. A newer version of PHP may have more security bugs, while it may contain some fixes. Redhat/Centos are sometimes lax in backporting fixes properly (which was why they got hacked - they didn't backport a kernel fix not marked as a security risk).

    Going down the Centos testing path may require you to upgrade glibc, which could then mean you have to start upgrading other packages you never intended to touch. For this reason I would recommend Jason's repository.

    Please make sure all additional repositories remained disabled (enabled=0) and you explicitly enable them on the yum command-line or using your configuration management tool

    yum --enablerepo=jason install php

    Richard Holloway : For reference, you can upgrade only php (and some php dependencies like php-gd if installed) from Testing without having to upgrade a bunch of other stuff.
    From mechcow

Is there a Cisco IOS Virtual Appliance?

Need to do test configurations on (unfamiliar) Cisco/IOS equipment. Is there a virtual machine I can light up and use it in my test environment as a real firewall/edge/core router?

  • Have a look at GNS3 it's a nice GUI frontend to Dynamips which is a IOS router simulator.

    Kyle Brandt : Might give GNS3 a try again but gave me a bunch of trouble last time I used it, now I just use dynamips with dynagen.
  • The only Cisco equipment emulator I know of is Dynamips/Dynagen, but its purpose is learning Cisco IOS commands for certification exams, not testing actual networking setups. While you could certainly do that, the performance would be likely very bad. Even connecting two routers on the same machine eats a lot of CPU, and you have to play around to find which idleCPU value works for the image you are using, to get lower CPU usage, when the router is idle. Otherwise even with idle routers you get high CPU usage.

    This is in contrast to Juniper Olives, which have quite good performance.

    gravyface : wish I could mark you both right, so I +1'ed 3dinfluence and gave you the correct answer. You need the points more than him anyways. :)
    Kyle Brandt : Performance is a good point, I am testing some QoS/rate-limiting setups and can't push more than ~5M through one of them. So I am just scaling down my 10M lab to a 1M lab by dropping a digit :-)
    Prof. Moriarty : @gravyface LOL, funniest most thoughtful comment I read so far. Thanks!

Why does eth0 show an IP if I'm booting into runlevel 1?

I'm having some issues with networking on a new Linux server I'm building. The OS is SLES 11. When booting into runlevel 1, I see that eth0 is showing an IP. Physically, there is a network cable plugged into the card associated with eth1, and then there is a network cable plugged into a QLogic iSCSI card (eth4, not shown). I've been troubleshooting this for awhile, and it seems like eth0 is somehow getting assigned an IP, even though it isn't configured in Linux or even plugged into the network for that matter. Thoughts?

ifconfig -a

Here is the ifconfig output

(Sorry, I need more rep before I can post images on SF...)

  • The runlevels are completely configurable from your inittab, so it's possible that runlevel 1 is mapped to a mode with networking activated.

    Does look odd though. Try booting into runlevel 2: in Suse that should default to multiuser/no networking.

What would cause JBoss to take up 4 more GB of memory than what is allocated?

Relevant part of the start up line: java -server -Xms10G -Xmx10G -XX:PermSize=1G -XX:MaxPermSize=1G

This instance ended up taking up 16GB of memory and 10GB of swap before killing the server.

Any ideas on what could cause that?

This is the only major application running on a RedHat system with 16GB RAM and 10GB swap.

  • My Guess would be runaway threads maybe, really probably better stack overflow on how to profile memory usage for a Java App and look for memory leaks.

    Keep in mind that the options -Xms and -Xmx are for heap only. There are other things that take up memory such as thread stacks etc. So maybe there were run away threads?

    You might want to look into ulimit for limit what this application can take, and start using something like Nagios to alert you when memory usage gets out of control. You running the jvm as root?

    Ichorus : "You running the jvm as root?" No. We found the answer and it is scary. One detail that I left out is that we are running on a virtualized server on VMWare. Originally we defined the memory to 8GB in VMWare. We changed it to 16GB when we decided to move that one into a production cluster. Apparently, VMWare, despite showing that there were 16GB available, really only had the original 8 (corraborated by sar data leading up to the crash). When we hit that limit, it went into swap, used that up completely and then, of course, the instance died. We are talking to VMWare now about it.
    djangofan : Run VirtualVM against that server and tell us which type of memory is getting out of hand in your VM.

How long do managed gigabit ethernet switches take to boot up?

One critical drawback that I have found in researching managed-switches, and one that I have some past experience with is that anything with "lots" of firmware is going to have lots of issues associated with that firmware.

We are in the middle of researching rackmount gigabit switches (48 port). It looks like for 48 ports, our only choice is managed switches (Dell, Cisco/Linksys,HP, etc). What I want to know, that I can not find out much about is the boot-time for various managed switches.

If you own one, can you please answer with the model number, and the cold boot time in seconds. I have read online that Linksys (now Cisco) SRW series sometimes take almost 5 minutes before they are fully booted up, and that is an unacceptable cost for us.

I particularly want to know about Dell PowerConnect managed switch bootup time (model 3548 and 5448), and would like to confirm the 5-minute boot time on the SRW2048 or similar model, and any HP ProCurve boot up times.

The composite of all those figures ought to form an interesting overall picture of boot-up times on managed switches.

[UPDATE: Further to those who think I am asking about boot-up time because I am silly enough to think that has anything to do with the actual operational performance, I have updated the above, to make it more clear that I'm interested in understanding the norms of this hardware type, not in forming an overall impression on switch performance based on one edge-case of boot time. Thanks for your time.]

[UPDATE2: I'm going to add my own answer for the managed SRW switch that we bought yesterday, a Cisco (former-linksys) model ... Is there anything wrong with not accepting AN ANSWER On this? I'd like to keep this question open to collect data points which might be useful to others, as well as to myself. In general, the longest time is 5 minutes, and the shortest are 1-2 minutes, with a nifty exception for the one HP ProCurve mentioned, which is super fast. ].

  • I can't imagine a reason why you would be rebooting switches often enough in any environment to even worry about this. Any reboot of a switch should be done in a maintenance window and then a few minutes isn't going to be a big deal.

    I'm not sure how you think that booting time reflects the switch performance. Switches, like most embedded devices, will have an underpowered CPU of some sort which is responsible for the booting process and maybe a few functions such as running the cli or web interface. But almost all of the networking functions are going to be handled by purpose built ASICs and won't involve the CPU at all.

    Zypher : +1 started writing the same thing, then got distracted
    Dan : +1 I agree, why is switch boot time so important? Any/all planned downtime is just that, planned.
    Warren P : Unplanned happens all the time. We had switch failures here last week. You just need one day where you have multiple switch problems, and you have to re-route the whole office network, and you start to care about little things like this. Because it's 5 minutes PER cold boot. And on a day when you had 10 of them, it's annoying.
    3dinfluence : Fair enough but it's been my experience that outages due to a switch failure is very rare, but it does happen. If you had to reboot a switch 10 times in a day then boot time isn't going to change the disruption drastically. The end result is going to be an up and down network resulting in lost productivity if we're talking end users. Would you rather a switch that takes 5 minutes to boot but would have fixed the problem in 1 reboot or a switch that takes 3 minutes to boot but took 5 reboots to work out your issues. I'm just saying that boot time may not be the win you're looking for.
    Farseeker : Agree with everything you wrote, but -1 cos it's not what the OP asked for (don't worry I gave you a +1 on your other answer so you're still 8 rep ahead!)
  • SRW2048 from a cold start running 1.2.1, 97 seconds

    tsavo:~ mcd$ date
    Mon Apr 12 14:04:48 EDT 2010
    tsavo:~ mcd$ ping 192.168.24.70
    PING 192.168.24.70 (192.168.24.70): 56 data bytes
    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    Request timeout for icmp_seq 2
    
    ... snipped ...
    
    Request timeout for icmp_seq 85
    64 bytes from 192.168.24.70: icmp_seq=86 ttl=64 time=45.284 ms
    ^C
    
    tsavo:~ mcd$ date
    Mon Apr 12 14:06:25 EDT 2010
    
    Warren P : Thanks for providing what I asked for. Lots of people can't understand why measuring performance is even important. An unmanaged switch is back online in very little time. The time it takes a managed switch to boot up is something that the network admins need to take into account. It may not happen that often, but when you have people asking "when will the system be back up", it's unexpected to have to say "well the server takes 3 minutes to boot, but our switch takes 5 minutes".
    kmarsh : +1 for actually answering the question, instead of questioning the question. While I initially had the same "why" reaction, I suddenly realized that there are many systems that have contractual uptime requirements and penalties.
    3dinfluence : @kmarsh If there are uptime requirements such as a SLA then the network needs to be designed with that in mind. That's not always possible at the edge of a corporate network but if you keep the edge switches to 24 ports the risk on affecting productivity can be minimized. The chassis based switches that you'll find at the core of most larger networks deal with this type of stuff quite well. With multiple hotswap PSU's and controller modules. But like you said in your comment you can also do things at the network layer w/ RSTP/PVST, dynamic routing protocols, and ethernet bonding.
  • Ok here's another data point for you from a PowerConnect 5324. Which is a few generations behind the models you're looking at. So take it for what it's worth.

    So the ping command below was sending 1 ping per second to you can see from the output below that it took 108 seconds from the point where it went down from the reload command to the point that it started replying again.

    PowerConnect 5324 reboot 108 seconds

    date && ping 192.168.0.2 && date
    Thu Apr 15 00:06:45 EDT 2010
    PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
    64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=2.53 ms
    64 bytes from 192.168.0.2: icmp_seq=2 ttl=64 time=2.54 ms
    64 bytes from 192.168.0.2: icmp_seq=3 ttl=64 time=2.55 ms
    64 bytes from 192.168.0.2: icmp_seq=4 ttl=64 time=2.60 ms
    64 bytes from 192.168.0.2: icmp_seq=5 ttl=64 time=2.55 ms
    64 bytes from 192.168.0.2: icmp_seq=6 ttl=64 time=2.76 ms
    64 bytes from 192.168.0.2: icmp_seq=7 ttl=64 time=2.50 ms
    64 bytes from 192.168.0.2: icmp_seq=8 ttl=64 time=2.63 ms
    64 bytes from 192.168.0.2: icmp_seq=9 ttl=64 time=3.51 ms
    ....
    64 bytes from 192.168.0.2: icmp_seq=117 ttl=64 time=2026 ms
    64 bytes from 192.168.0.2: icmp_seq=118 ttl=64 time=1028 ms
    64 bytes from 192.168.0.2: icmp_seq=119 ttl=64 time=30.1 ms
    64 bytes from 192.168.0.2: icmp_seq=120 ttl=64 time=3.80 ms
    ^C
    --- 192.168.0.2 ping statistics ---
    120 packets transmitted, 13 received, +45 errors, 89% packet loss, time 119202ms
    rtt min/avg/max/mdev = 2.502/239.520/2026.970/583.213 ms, pipe 4
    Thu Apr 15 00:08:45 EDT 2010
    
    Warren P : That's good to know. If the older generations are under 2 minutes, surely the latest power connects are also under 2 minutes.
  • I don't have the exact times on hand, but we have both Cisco (3750) and HP switches (2524 & 2510G). The Cisco ones indeed take several minutes to start up. The HP ones take about 30 seconds. The HP ones are 24 port, and it tests each port (does about 4 ports per second), so a 48 port would take slightly longer.

    Warren P : Thanks. The Cisco 3750 is a catalyst/ios series right? The ones I was originally asking about are the former Linksys now rebranded as "cisco" small business switches and are non-ios non-catalyst.
    Chris S : Yeah, the 3750 is a IOS based device. I think all the Catalyst devices have been phased out now, but I'm no expert.
    From Chris S

Strategy to allow emergency access to colocation crew

I'm setting up a server at a new colocation center half way around the world. They installed the OS for me and sent me the root password, so there's obviously a great amount of trust in them.

However, I'm pretty sure I don't want them to have my root password on a regular basis. And anyway, I intend to only allow key-based login.

On some cases, though, it might be useful to let their technical support log in through a physical terminal. For example, if I somehow mess up the firewall settings.

  • Should I even bother worrying about that?
  • Should I set up a sudoer account with a one-time password that will change if I ever use it?
  • Is there a common strategy for handling something like this?
  • Well, a lot will obviously depend on the specifics of the case, but you should keep in mind that with physical access to the machine, they can practically do anything they want anyway.

    The common solution for this is to give them a dedicated maintenance account that has root rights via sudo. Then you can give them the pw when you want them to have root access. If you want to take away root access, just change the pw on the maintenance account.

    At any rate you can configure SSH to only allow key-based logins. Then the maintenance account + pw would only be usable for logins at the physical console (even if it is enabled), further restricting the access to the system (if you want to).

    Ryaner : We do this and it works well. You can add command logging to the maintenance account too if you really want to look and see what has been done
    From sleske
  • You should buy an option for access via IP-KVM. You will have access to everything, including single-user mode and BIOS.

    kbyrd : How does that solve the security issues in the original question?
    minaev : Actually, it does not eliminate them completely (sleske is absolutely right here, physical access makes all precautions useless), but mitigates to an acceptable level, when you know for sure that nobody besides you has any right to log in. Any attempt to log in is an intrusion.
    From minaev
  • We got a similar setup for some external boxes. We keep the root-password secret and only give it out when it's needed, when done we change it. We do not allow root logins via ssh so the password is only relevant when you got physical access.

    From rkthkr

Will wear induced by turning computers off in the evening be offset by energy savings?

I'm asking this here because this is primarily a huge office scenario and administrators will more likely have the answer I'm looking for.

Employees' desktop computers can be either left turned on for the whole night or switched off in the evening and turned back on in the morning. The latter will surely save energy. In the same time turning on and off is very harmful for the equipment - hardware often breaks specifically when turned on.

Both energy and hardware replacements cost money. With energy it's quite obvious - you pay every month according to what your power meter shows. With hardware replacements it's worse - you need qualified stuff to quickly diagnose the problems and once something breaks the affected employee will have to wait for some time while his computer is fixed/replaced and the data is recovered.

So the company has to choose between saving money on energy and saving money on computer maintaince and lost hours. Such decisions must be well though.

Is there any detailed study of how turning computers off each evening affects their lifetime and what losses are induced by it?

  • Not switching PCs off may cause overheat which decrease hardware lifetime.

    sharptooth : True, but if a computer has problems with heat it will incur enough damage even during a normal 9-hours day. I agree that 9-by-5 is much less then 24-by-7, but still I'm asking about normal functioning. +1 anyway - an important factor to consider.
    pehrs : Actually a lot of desktop hardware is only rated for 9 hour cycles, not for 24/7... For that you are expected to buy "server" hardware.
  • Sorry but I didn't get you where you say "hardware often breaks specifically when turned on." Does turning computers off and on damage them ?

    Further, I would suggest having the machines to be put into suspend mode, if it is not possible to switch them off completely, so that at least some power is saved :)

    sharptooth : Yes, turning any piece of electronics off and then on several times usually causes more damage to it than just running it for several minutes.
    Knight Samar : Hmm...interesting, didn't ever think of that :) BTW, A google search took me here...maybe something in this maybe useful for you. http://www.federalelectronicschallenge.net/resources/docs/oandm.pdf
    duffbeer703 : No, turning electronics on and off does not damage the hardware. (At least not in the context of energy management.... abusive behavior like rocking the power switch back and forth obviously isn't a good idea.)
  • First, if this is a "huge office scenario", you will hopefully have warranty contracts that covers most of the lifetime of the machines. In that case, if it breaks, it's the vendors job to repair it and you can just reap in the energy savings.

    Beside that: While I would agree that there is a somewhat increased possibility that hardware will die during a power cycle, I consider this to be a problem of (really) old hardware and I can't see how one cycle every working day over a course of three to five years would cause a problem except on very crappy hardware that might die anyway whenever you look at it the wrong way.

    One major issue remains, which decides the whole game in my opinion, and this is the harddisk. Desktop drives are not designed to run 24x7 and I personally experienced a significant amount of drive failures of non-raid-type drives used in 24x7 server scenarios.

    So, in the end: Turn the machines off and save the energy. There is nothing else to gain.

    sharptooth : I seriously doubt warranty will cover lost hours.
    SvenW : Again, you are talking about a "huge office scenario". For me, this means having replacement machines available, automatic deployment etc. etc, with maybe a 30min time for replacing a dead machine. And as I said, keeping systems running actually increases the chance of a hardware failure. So, in my book there are no two choices between saving energy and saving money on maintenance and lost hours, because you get both by turning machines off.
    duffbeer703 : If you're in a "huge" office and have dedicated IT staff, a PC failure should not be an event that takes hours to recover from. You should be seeing 3-5% failure rates already, and have procedures for dealing with them.
    From SvenW
  • How much does it cost in power to run the PCs 24/7? This is a question most companies can't answer off the bat. However, it should be considered that of 168 hours in a week, each PC will be used around 40 hours, or however long your working week is (at most, there's still lunch break and not everybody does all work on the PC all the time). This means you quadruple energy consumption by not switching them off.

    My office desktop draws 250 W, so I use 1 kWh every four hours, or 42 kWh per week, if I left it running all the time. If you pay $0,15 per kWh, this means more than $300 a year, of which $225 are just waste. At that rate, the damage done by a power cycle every weekday would have to decrease the MTBF quite drastically to get economically meaningful.

    I switch my PCs and laptops off whenever I know I won't use them for the next 30-60 minutes. I have used them for many years that way. In fact, I have never even heard of a PC breaking by switching it on and off.

    In working as an energy consultant for businesses, I've seen this theme pop up over and over. Not just the PCs, your whole building is only used 25% of the week. The amount of energy that's used outside those hours, for all kinds of things, is astonishing, to say the least.

  • I work for a large state government where we recently began implementing power management. According to our calculations based on metering a sample population shutting off PCs during idle periods saves about $35/PC per year for a mainstream business desktop with LCD monitor. Your mileage will vary, so do some testing yourself.

    Laptops are generally provide for less savings, CRT monitors and workstation class devices increase savings.

    We looked into the issue of hardware failure at great length, and based on research, testing, and a production implementation that's about 6 months old, I can find no evidence supporting the assertion that turning a computer on and off "wears out" anything or causes other hardware related issues. We've observed no statistically significant increase in hardware failure. (If anything, it has gone down slightly due to refresh of older equipment.)

    You will find other issues, such as:

    • Annoyed end-users
    • Older PCs that don't like to resume properly
    • Misbehaving applications

    These issues don't have magic bullet fixes. You need to communicate with end users, test your applications and test your older hardware.

    Chris S : We went through a similar process last year. Most research we found didn't show a large difference in the life of the computer. Considering most computers are replaced after 4-5 years, you might as well save the $200 over the life of the computer. Also, we noticed the largest differences in power consumption by replacing old technologies (like CRTs) and simple 'fixes' like enabling stand-by after an hour, or turning off the monitor after 30 minutes. More reading: http://michaelbluejay.com/electricity/computers.html
    jscott : +1 for "Annoyed end-users". We've tried power management, nightly shutdowns *and* scheduled morning BIOS power-ons. People still get upset (and I don't know why). We can't win. :)
  • I wish I had detailed data, especially the type of numbers you want.

    You might simply need to do A/B testing to see which is better.

    However, I would say that the harm of turning stuff on-and-off is kind of hypothetical sounding to me:

    The latter will surely save energy. In the same time turning on and off is very harmful for the equipment - hardware often breaks specifically when turned on.

    First, what is the lifetime of a PC? Lets say it is 5 years. Turning it off and on again once a day really is not a lot. I remember, in my childhood, we turned off Apple's, IBM PC's and Atari class systems a dozen times a day, for years. Computers have only gotten more reliable since then.

    Second, I doubt a higher failure rate can be can be uniquely associated to the daily-power down. Even if you leave your computer on all the time, you still have to reboot for system updates. In my experience, that is the source of most of my boot-time problems.

    Third, the relative costs will continue to diverge over time. If you have to assume, the safe assumptions are probably: energy costs will continue to rise over time, hardware costs will decrease over time. So, even if this is break even now, this is a behavioral/cultural change, you need to start now so people will be doing it when the price benefits arrive, rather than suffering from a lag time.

    The real costs to a power-down is that you have to close up all your windows and save your work. On my Macs, almost all my applications have an auto-save feature. For Windows, I usually use "hibertnate".

    From benc