Tag Archives: linux

HOWTO automate Debian installs with preseed

Automatic (you know, for the people)

Automatic (you know, for the people)

I’ve installed Linux, probably 100s of times, and while going through all the questions and answers used to be fun, once you have everything decided it’s mainly a case of tab, space, enter, tab, tab, enter, space, space, tab, enter. I remember reading about kickstart, which was Red Hat‘s way of automating the install process, but Debian GNU/Linux (and by extension Ubuntu Linux) support  preseed. From Debian’s wiki, “Preseeding provides a way to set answers to questions asked during the installation process, without having to manually enter the answers while the installation is running. This makes it possible to fully automate most types of installation and even offers some features not available during normal installations.” So preseeding automates the install of the OS, the questions that you’d normally need to answer interactively are predetermined, and defined by a supplied configuration file, and sometimes boot parameters. So while Ubuntu is known for it’s user-friendly OS installer, Ubiquity, preseeding the Debian-Installer  (also known as “d-i”) is the recommended method for automating Ubuntu installations and for building custom install CDs. With this in mind I set out to build a preseed config file that would automate installs of virtual KVM machines we were provisioning at a gig, but looking at how I do such bare-bones base installs, this would work for most of my normal Debian installs at home too.

HOWTO start a detached process in screen on boot

Using a key to gouge expletives on another's vehicle is a sign of trust... and friendship.

Using a key to gouge expletives on another's vehicle is a sign of trust... and friendship.

Ok, a quick one today – at work I had the problem of needing a process to be automatically started during boot, and have it running in the background, but it didn’t have its own init.d script. I knew there was a way I could use GNU Screen (one of my favorite ‘must have’ sys admin tools) to do this, but it took me some time searching to find the right syntax to translate for my needs, so I’m posting it here.

HOWTO reclaim your Linux bootup messages

Ah, does it get any better than this?

You know the drill, you bootup a Linux box and watch the boot messages scroll by on the screen, now prepended with lines telling you the seconds since boot, and then you end up at a shell prompt for login. Ahh, the way Linus intended, epic! Oh, you don’t see that? Instead you see some animated Linux distro logo or something as useless like a progress bar tracing across the screen? Uggh, I hate that, you don’t know what’s really going on behind the scenes, and if Linux is anything, it’s transparent. So, let’s get that fixed for you. Basically as Linux as ‘matured’, we’ve been forced to load and watch more animated boot ‘splash’ screens for branding, and to make Linux more user-friendly, or more likely, more Windows or Mac-like. This way new users won’t run for the hills if they see something like:

HOWTO monitor Tomcat with monit and munin in Debian

I have an existing Tomcat installation in production that has been running hot and causing monit to send me notices that such and such service is down, only to come back clear on the next run. Of course since I use monit I can see that the service was never restarted, plus I’ve never had this happen on other servers with monit, so I’m convinced that Tomcat, with its hunger for Java, is the culrprit here. I’ve been running munin for years on this server too, however I never got the Tomcat plugins to work with it, so I can’t gauge how hot Tomcat is running, and how changing the heap size is effecting things. Because of this, yesterday I got serious about it and finally got it working, but I had to take an end run to get it rolling and it wasn’t fun; which is why I’m posting it here. If anyone knows a better way to do this, please share in the comments and I’ll update this, but here’s how I was successful.

HOWTO use monit to monitor sites and alert users

Ok, I’ve used the process management software, monit, since at least 2004, and it is simply an indespensible tool in my sysadmin cache. Basically it watches a process, say like Apache, and restarts it if it dies. But wait, that’s not all, it does tons of other things. Want it to watch it and restart it at a certain time? Sure. How about if it uses 50% of system memory in 5 cycles (cycles are checks, 120 seconds by default)? Yep, it’ll take care of that. How about watching a file and stopping a service and/or issuing an alert by email or web if the file’s UID, permission, or whatever has changed?   No problem. Disk space is greater than 90% on one partition you want an email to go out to the admin? Easy. Seriously, once you start using monit you’ll be amazed at what you can cover, it’s truly one of the best tools I’ve ever used, and of course it’s GPL’d open source.

So, this week we had an issue where a some of our sites were down, and the monitor that watches them were internal to our network, and relied on some of the same resources; which is lees than ideal. I have a remote server running at one of our partner’s sites, so it’s the perfect canidate to watch our sites from a ‘real world’ view.

Page 1 of 512345