3

I'm interested to benchmark a console-mode application, and would like to reduce to a minimum any interferences from other processes in the system.

Is there an easy way to boot into Ubuntu 12.04 in a "bare-metal" mode ? I'm still interested in casually booting a "desktop" version of Ubuntu (so will prefer to avoid permanent changes), and would like to avoid installing a separate Ubuntu-server version.

My use-case is the following -

  1. Application is single-thread and console-mode only.
  2. Test-box has 12GB of memory.
  3. I ssh into the test-box.

Seems I can skip at least Unity, X-server and their dependents.

3 Answers3

3

Booting into single-user mode will keep most of the services (including X) off, and bringing up the network and sshd services should be enough to make it usable for your purposes.

1

As long as other things aren't actively doing any work, there should be no interference problems. If you don't log in to an X session, and only log in via SSH, then there shouldn't really be any actual work happening, in general. You could telinit to the console-only runlevel, or simply reboot into the "recovery mode" selection from the boot prompt, to have fewer processes running.

Though, it doesn't really matter if other things are running, so long as nothing is consuming all the CPU resources, or hitting the disk constantly, which may cause your program to stall in IOWait.

dobey
  • 40,982
  • 1
    telint and recovery mode - looks good, I'll try. As for the rest, unfortunately there're enough things to interfere, including a bug in fglrx that makes a whole core spin endlessly if the box is left untouched for enough time. – user1071136 Sep 11 '12 at 15:23
  • You still want to avoid certain things, like updatedb activated from cron. The less services are on, the better for testing. – liori Sep 11 '12 at 17:51
  • @liori Right, so you probably don't want to run the tests at midnight or so, or you can just stop the anacron service. – dobey Sep 11 '12 at 19:44
  • The benchmarks I run are multi-day efforts, so not running at midnight is probably out of my hands. What other services should I be aware of? – user1071136 Sep 12 '12 at 06:46
1

As long as you can trust yourself to not mess things up while logged in as root, the best way to get a minimal system with networking and SSH is:

  1. Boot into recovery mode from Grub (hold Shift down when booting to get the menu)

    enter image description here

  2. Enable networking (which will also remount your partitions in normal read/write mode)

    enter image description here

  3. Drop to a root shell (aka single-user mode):

    enter image description here

  4. Do a service ssh start to enable SSH and you're good to go!

Note: you can always give your benchmark program realtime CPU and I/O priority using nice and ionice; e.g. maxing out both would be:

nice --20 ionice -c 1 /path/to/program
ish
  • 139,926
  • Good answer; can you relate to the differences/similarities between this method and the single-user mode? Are they essentially the same? – user1071136 Sep 11 '12 at 17:39
  • No, this method has fewer services/processes running because the root shell drop is a "little" before the single-user runlevel stage. For example, on my Ubuntu 12.04, single-user mode has these additional services/processes running: CUPS (printing), avahi-daemon, colord and dnsmasq. – ish Sep 11 '12 at 17:48
  • Last question - it seems I'm unable to ssh into the box. The machine is visible on the network, and I get a time-out. I tried disabling the firewall using ufw, but no luck. Am I missing something obvious? – user1071136 Sep 13 '12 at 06:35