Category Archives: Server Admin

Connect to Lantronix Spider from Ubuntu RS232 Serial Port or USB

If you need to connect to the Lantronix Spider or SpiderDuo KVM-over-IP Devices via a serial connection, for example to change the configuration or reset the password, you need to use a serial console to do this. I was using an Ubuntu machine with a standard serial / com port ( DB9/RS232 ) and had one of the $4 RJ45 to DB9/RS232 cables To get connected I ended up installing picocom which I like better than using screen as it seems to be more forgiving if something goes wrong and not lock up the system. Then I used the command picocom -b 9600 /dev/ttyS0 to connect to the device and got prompt so I could reset the device: Welcome! Choose a command for the following features: -Initial IP configuration: “config”. -Reset device: “reset”. [(none) spider]> If you don’t have a RS232 you can also use a ~ $10 USB to RS-232 DB9 Serial Converter in order to get a serial port. The device will show up in /dev/ as something like /dev/ttyUSB0 which will change your picocom command to be: picocom -b 9600 /dev/ttyS0 To exit picocom use control+a, control+x. To install picocom on Ubuntu / Debian linux systems use apt-get install -y picocom A few notes from the Lantronix page: How do I perform the reset? See details on the lantronix page – you will need to use the reset button on the back of the device in combination with a terminal connection described above. What is the default … Continue reading

Posted in Server Admin | Tagged , | Leave a comment

How to disable the LEDs on the PogoPlug running Debian Squeeze

If you’ve installed Debian Squeeze on the PogoPlug you’ll notice there is no longer an /sys/module/xce/sections/ or /dev/xce path for you to echo commands to. However, you can still control the LEDs by using the sys -> devices -> platform -> LEDS / GPIO How to disable the LEDs echo 0 > /sys/devices/platform/leds-gpio/leds/status:red:fault/brightness echo 0 > /sys/devices/platform/leds-gpio/leds/status:green:health/brightness How to make the LED green echo 0 > /sys/devices/platform/leds-gpio/leds/status:red:fault/brightness echo 1 > /sys/devices/platform/leds-gpio/leds/status:green:health/brightness How to make the LED red echo 1 > /sys/devices/platform/leds-gpio/leds/status:red:fault/brightness echo 0 > /sys/devices/platform/leds-gpio/leds/status:green:health/brightness How to make the LED orange / yellow echo 1 > /sys/devices/platform/leds-gpio/leds/status:red:fault/brightness echo 1 > /sys/devices/platform/leds-gpio/leds/status:green:health/brightness You can also try using values 1-255 to control the brightness but I didn’t see much difference between different numbers. ymmv. Also, if you wish to read the status of the LEDs you can do so by using something like cat with these paths: cat /sys/devices/platform/leds-gpio/leds/status:red:fault/brightness A value of 0 indicates the LED is off. Most likely if you are running Debian there will be no events that turn the LEDs on – but in case you have issues you can disable system events from triggering the LEDS you also need to change the ‘triggers’ – first check out the existing ones: cat /sys/devices/platform/leds-gpio/leds/status:green:health/trigger This results in: [none] nand-disk timer oneshot ide-disk1 ide-disk2 heartbeat gpio default-on mmc0 And for the red led use: cat /sys/devices/platform/leds-gpio/leds/status:red:fault/trigger Which should result in: [none] nand-disk timer oneshot ide-disk1 ide-disk2 heartbeat gpio default-on mmc0 Next, to disable the events from triggering the LEDs run: … Continue reading

Posted in Server Admin, Tech Tips | Tagged , | Leave a comment

Install syslinux 3.86 on Ubuntu

Get the syslinux 3.86 download from here, maybe the syslinux-3.86.tar.gz file To build syslinux-3.86 on Ubuntu, Debian, and similar: apt-get install build-essential nasm cd /tmp wget “https://www.kernel.org/pub/linux/utils/boot/syslinux/3.xx/syslinux-3.86.tar.gz” tar -xf syslinux-3.86.tar.gz cd /tmp/syslinux-3.86 make you will most likely get some errors about building for windows, but when this process finishes you will have the 3.86 version of syslinux working. Execute the main program by running: /tmp/syslinux-3.86/linux/syslinux You can also do a make install but that may conflict with other versions of syslinux you have installed ( if you have already tried apt-get install syslinux, for example) Another note, you can run apt-get install syslinux-legacy to get a version of syslinux that is around 3.63 to 3.82: Check all of the versions by doing something like this: $ which syslinux /usr/bin/syslinux $ strings /usr/bin/syslinux | grep SYSLINUX SYSLINUX SYSLINUX 4.05 SYSLINUX 4.05 20140113 $ which syslinux-legacy /usr/bin/syslinux-legacy $ strings /usr/bin/syslinux-legacy | grep SYSLINUX SYSLINUX SYSLINUX 3.63 Debian-2012-04-16 $ strings /tmp/syslinux-3.86/linux/syslinux | grep SYSLINUX SYSLINUX SYSLINUX 3.86 0x53e5a115

Posted in Server Admin | Leave a comment

Fail2ban: Block CIDR IP Address Ranges (aka wildcard)

It has been requested to have the ability in fail2ban to block whole IP address ranges. Yaroslav Halchenko replied, saying we are working on the features which would occur in some 0.9.x release which would make it configurable out-of-the-box, but meanwhile you can just easily create an augmented action file where you would have customized iptables call with /XX to ban whatever big subnet you like Well, at the time of this writing the current version is Fail2Ban v0.8.6 – and it seems to not have CIDR capabilities out of the box. However, you can still have fail2ban block an IP address by using a command like this: fail2ban-client -vvv set apache banip 1.2.3.0/24 Your fail2ban log file ( maybe /var/log/fail2ban.log ) should have information about the rule you just added. Also, the -vvv flag tells the command to be verbose. For the rule to take effect, you may need to wait until one of the other files fail2ban is monitoring has a change. So check out your /etc/fail2ban/jail.local file, see what is enabled, and then run touch /path/to/file on a logfile you are watching with fail2ban

Posted in Server Admin | Leave a comment

Heroku pg migration error “PG:DataCorrupted: Error”

Heroku’s database system is having issues at the moment, if you use a command like this: heroku rake db:migrate You’ll see some details saying: Heroku pg migration error “PG:DataCorrupted: Error” This looks like a system-wide error on Heroku’s side. The complete error is something like: One option may be to try this: heroku run rake Although at this time the Heroku dashboard does not report any issues officially: Now one day later we see the results from the Heroku Support Bot: Your database HEROKU_POSTGRESQL_CRIMSON_URL on yourapp requires maintenance. During this period, your database credentials will become read-only. Once it has completed, your database URL will have changed, but we will update your app’s config variables accordingly. This automated maintenance is a necessary part of our Starter tier plans, Dev and Basic. Should you need more control over maintenance windows, a production database (Crane or higher) offers more control over database maintenance, as we are able to schedule them in advance and provide better tools for self-served maintenance. We expect maintenance to last just a few moments. We will update this ticket when maintenance begins, and again once it’s complete.

Posted in Linux, Server Admin | Leave a comment

Vim and Jailkit

Recently I installed Jailkit on Ubuntu 12.04 and then tried to use the vim editor to edit files as the jailed user (specifically a user jailed with the bash shell) and vim was behaving oddly. The colors on the terminal were just a gray (default color) and a bold white. After a little digging I found out this is how vim does syntax highlighting when it thinks that only two colors are available. Also, I was having trouble with the arrow keys not working – I could move around with HJKL but there also seemed to be lag and vim was hanging or would hang sometimes and was not responsive. I typed in set terminal and it told me ansi which is the default, “dumb” terminal. You can change vim to another terminal type, like xterm a few ways. Inside vim type :set term=xterm and that should do it Edit your .vimrc file (in your home directory) and add set term=xterm Before launching vim type export TERM=xterm to set an environmental variable Add that last command (export TERM=xterm) into one of your startup files like ‘~/.profileor ‘~/.bashrc This fixed the issue with the arrow keys, the lag and hanging, but I still only had two colors. After many hours of digging I realized that with Jailkit on Ubuntu even if you do jk_init -v /home/jail editors to install joe and vim and emacs you still get this problem. I did a stack trace on vim and even turned on debugging … Continue reading

Posted in Server Admin | Tagged , , | Leave a comment

brew install gnu-stat

The stat command on Ubuntu and OS X behave differently and I’d like to have the functionality of the GNU / Ubuntu version of stat available on OS X – if there is such a thing. I have already used homebrew to install gnu-sed and I see similarly that a lot of the GNU utilities are available from: brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt I know stat on OS X might be very specialized because of the OS X file systems that may be present, but I’d ALSO like to have the linuxy version if it is available. As it turns out, it is. The GNU version of stat can be accessed on OS X by installing a package / keg called coreutils which includes the following utilities: base64 env mknod runcon touch basename expand mktemp seq tr cat expr mv sha1sum true chcon factor nice sha224sum truncate chgrp false nl sha256sum tsort chmod fmt nohup sha384sum tty chown fold nproc sha512sum uname chroot groups numfmt shred unexpand cksum head od shuf uniq comm hostid paste sleep unlink cp id pathchk sort uptime csplit install pinky split users cut join pr stat vdir date kill printenv stty wc dd link printf sum who df ln ptx sync whoami dir logname pwd tac yes dircolors ls readlink tail dirname md5sum realpath tee du mkdir rm test echo mkfifo rmdir timeout These GNU utilities are available on Mac OS X but the one caveat is that they are … Continue reading

Posted in Mac, Server Admin, Tech Tips | Tagged , , , | Leave a comment

Rackspace: Exit Rescue Mode

The Rackspace documentation says on exiting rescue server mode: Once you are done troubleshooting your system, you can exit Rescue Mode by clicking the link labeled Exit Rescue Mode in the Rackspace Cloud Control Panel under your Server Details page. I couldn’t seem to find the link. The solution? Visit the list of servers. Click the server name to go to the details page. And the most important key? Wait. It may take a few seconds (~10) before the “Exist Rescue Mode” box pops up with an option to quit recovery mode and reboot into normal server operations.

Posted in Server Admin, Tech Tips | Tagged , | Leave a comment

How can I recover a crashed Rackspace Cloud Server?

I’m now starting to use Rackspace after a having a lot of experience with Amazon AWS and so I’m having a hard time understanding a few things about the way Rackspace works. One of these things is “Disaster Recovery” for a Rackspace “Cloud Server’s” primary drive primary drive. There is a lot of server terminology with Rackspace so for clarification I’m talking about the ones in the Cloud Servers control panel that are in this tab: So my point of confusion is this: If I screw up something big on AWS, like the /etc/fstab file and the server won’t boot, I can use the AWS control panel to get the console log: If I need to edit things on the primary drive I can “detatch” it from the instance and attach it to another server, and then access the files on it. I searched the Rackspace knowledge base and also read the Disaster Recovery blog post which mentions three ways of doing disaster recovery with Rackspace: Take regular snapshots and restore the instance from one of those Do manual file system and database backups to have a copy of your data NOT on the primary drive Replication with Manual Failover (seems like overkill) I also saw that it is possible to boot the server into “recovery mode” but I haven’t tried it yet. The way I’m planning on running my rackspace server is attaching another drive (aka Storage Volume) and putting all the application data on that. I am also … Continue reading

Posted in Server Admin | Tagged , , , | Leave a comment

linux: What does hash -r do?

The hash utility shall affect the way the current shell environment remembers the locations of utilities found as described in Command Search and Execution. Depending on the arguments specified, it shall add utility locations to its list of remembered locations or it shall purge the contents of the list. When no arguments are specified, it shall report on the contents of the list. The following option shall be supported: -r: Forget all previously remembered utility locations.

Posted in Server Admin | Tagged , | Leave a comment