When I signed up for my Debian Linux VPS hosting and first logged on and invoked ps, there was the only user process running: sshd. As I can see, this was minimal Linux with only two things installed and configured: sshd and apt (plus all dependencies, of course).

I want to build (or use existing) similar Linux distro, any advice on how to build (or pick) one?

Googling "minimum linux", or "linux with sshd only" usually brings up Debian's netinstall, which is not what I want.

7 Answers
7

If you are inclined to roll your own , you might like using debootstrap. You can quickly make a very very minimal (you'll even need to generate your own locales) distro using it in just a few minutes, based on any distro that uses apt.

Pair it with your kernel version of choice, and you have a very bare bones system.

I prefer using chroot to add what I want prior to copying it over to boot media (you'll need to do that to install ssh / etc)

First, ps aux gives me a full listing of everything running on the system, including system processes. Did you mean ps ux?

Second, you said that sshd was the only user process running? What about bash? What about ps? That's a user process. The number of running user processes really has no reflection on how few system internals are running; that's why the call it a user process and not a system process.

Third, if sshd is the only system process running, how does did the computer start up (init), or deal with TTY connections (getty or agetty), or log system events (syslogd and klogd)? Truth is, there is a very specific reason for each system process and disabling or kill-ing them can lead to a dumb computer, or a crashed computer.

Udev is pretty much always going to show up in ps listings on any 2.6.xx system. With the move from Kernel 2.4 to 2.6, the udev subsystem is standard unless you compile your own kernel. If you compile udev support out, then you'll have to rely on an unchecked /dev structure, which may cause problems.

I'm quite a big fan of Arch Linux for this minimalist kind of installation. I recently set up a VM whose sole purpose was to act as an SFTP repository, separated from my main server. It has a serial and a tty1 agetty running, syslog-ng, udev and sshd.

The nice thing about Arch for this is that it's quite easy to set it up so that very little starts up by default, just edit rc.conf and set these to run like so:

DAEMONS=(syslog-ng network sshd)

With a base Arch installation, I only actually removed the entry to mount network filesystems, and added sshd.

The downside to Arch is that the development libraries are installed with each package, so it's not as minimalist on disk space as an extremely pared down Debian can be. Also, it uses pacman instead of apt so it doesn't really fulfill the stringent requirements of your question, but I do personally feel it's a viable alternative.