Measuring Ubuntu boot performance

Measuring boot performance in Ubunu is fairly simple. Systemd provides a tool for that.

The overall boot time for kernel and userspace is given by:

systemd-analyze

How much time each boot services takes in descending order is displayed as follows:

systemd-analyze blame

The critical chain for the default target is shown my this:

systemd-analyze critical-chain 

Those time can also be graphed as svg:

systemd-analyze plot > boot_analysis.svg

Ubuntu: clone installed packages to a new system

apt-clone:

On the source system, do the following:

apt-get install apt-clone
apt-clone clone 

Copy \<systemname>.apt-clone.tar.gz to the new machine and run:

apt-get install apt-clone
apt-clone restore .apt-clone.tar.gz

dselect:

source system:

dpkg --get-selections > ~/Package.list

target system:

apt-get update
apt-get install dselect
dselect update
dpkg --set-selections < ~/Package.list
apt-get dselect-upgrade -y

Ubuntu: configure general proxy usage

In order to let an Ubuntu system access the net via a proxy, edit two files and you're done.

/etc/environment:

http_proxy="http://:/"
https_proxy="http://:/"
ftp_proxy="http://:/"
no_proxy="localhost,127.0.0.1,::1

/etc/apt/apt.conf.d/90_proxy.conf:

Acquire {
  HTTP::proxy "http://:";
  HTTPS::proxy "http://:";
}

Update ’19: Get snmpd to log more silently

This is an update to the article from 2009 regarding quieting down snmpd - this time in recent Ubuntu LTS 18.04. The issue at hand is the intense chattyness of snmpd to syslog.

Due to the complete shift to systemd, files in /etc/default are becoming disregarded. Therefore customisations have to be made to /etc/systemd/system. Two steps are neccessary:

Create a symlink for snmpd in /etc/systemd:

ln -s /lib/systemd/system/snmpd.service /etc/systemd/system

Edit that file and change:

ExecStart=/usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f

to

ExecStart=/usr/sbin/snmpd -LS4d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f

Then run

systemctl daemon-reload && service snmpd restart

Now snmpd should be calmed down.

Ubuntu: enable MIBs in snmp tools

Lately I ran into some issues using snmp tools, e.g.:

snmpwalk -v2c -c public ${host} test

I received errors like:

Unknown Object Identifier (Sub-id not found: (top) -> test)

This is because MIBs are not installed in Ubuntu by default. To install them use the follwing line:

apt-get install snmp-mibs-downloader

Also comment line 4 of /etc/snmp/snmp.conf so it shows:

# mibs:

Hope that helps someone.

OS X: disable Mission Control on top edge

In El Capitan Apple introduced a feature which opens Mission Cotrol as soon as you drag a window to the top edge of the screen. That is annoying at least to me. Therefore here is a possible fix:

Disable:

defaults write com.apple.dock mcx-expose-disabled -bool TRUE && killall Dock

Enable:

defaults delete com.apple.dock mcx-expose-disabled && killall Dock

Resize KVM guest’s raw volumes

After running virtual machines in KVM for some time, it might come in handy to be able to resize a KVM guest's raw volumes. In order to do so you first have to shutdown your VM for a while:

virsh destroy <guestname>

In order to add an additional 2 gig to your respective machine, you do the following:</guestname>

qemu-img resize <diskname>.img +2G

Now restart the machine:</diskname>

virsh start <guestname>

Then use fdisk inside the guest to make use of the new space:

fdisk /dev/vda

There, you delete the respective partition and immediately recreate it - with more space. Now restart the machine in order to let the kernel make note of the changes:

reboot

After a final resize you're able to make use of the sweet new space:

resize2fs /dev/vda1

Voila!

Cleanup Docker Containers

In order to cleanup docker containers from time to time just fire the following:

docker system prune -a 

Adding bootstrap to Synology DSM

In package center > settings:

  • add https://www.cphub.net/ to package sources
  • Allow installation of packages published by Synology Inc. and trusted publishers

Install in this order:

  1. Perl in Developer Tools
  2. Easy Bootstrap Installer in Community (choose entware as optware doesn’t have any recent updates)
  3. iPKGui in Community

Packages will be installed to /opt.

Command-line tool is opkg.

opkg list-installed
opkg list *gcc*

Source /opt/etc/profile at the end of the ~/.profile file for each user that needs
to use packages installed by ipkg.

Enable SMTP for PHP on Ubuntu

Many php-based web application are using php's smtp function. Unfortunately, Ubuntu's php default setup disregards the installation of packages necessary for using smtp. The following command line takes care of their installation:

aptitude install php-net-smtp