Revert to minimal Debian installation

From BubbaWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This tutorial is primarily aimed towards the B3 but the principle should be the same for other products.


If you'd rather do without the web interface and preinstalled packages that comes with the Excito servers, a "vanilla" Debian installation may be desirable. However, attempting to install the official Debian releases instead of the by Excito prepared images can be time-consuming and difficult. An option is to revert from the factory defaults to an "almost vanilla" Debian installation by purging unwanted packages. There are only a few caveats - specifically, LVM support, OpenSSH and the network configuration - but they are critical in order to maintain a working device after reboot.

Initial setup

First off, we'll start with the B3 as-is unboxed. Plug it in as per the official instructions and boot it. Launch a browser and go to the device web interface. Do the Wizard setup and proceed to the Users page and grant yourself shell access. It may be a good idea to switch the Network setting to Server only. Once done, do a software update and then reboot the device.

When the B3 is up and running again - log in by SSH and switch to superuser (the default password is "excito") once logged in.

ssh username@b3.local
su

Delete packages

Next up, purge (the below code is actually one line and not three but has been formatted for legibility). Dialogues will be displayed asking you wether you'd like to purge databases or not for the Horde, Mediatomb and Squeezecenter applications. Opt for removal of all data. The default MySQL root user password is empty.

aptitude purge squeezecenter mailutils guile-1.8-libs libmailutils2 dhcp3-client dhcp3-common bubba \
bubba-frontend bubba-backend excito-keyring postfix mysql-server mysql-server-5.1 mysql-common mdadm \
mnemo2-base turba2-base libmysqlclient16 libfribidi0 libgmp3c2 libgsasl7 libidn11 libntlm0 libpng12-0 libxapian15

The purge command will for the mostpart of the time not only remove the installed packages but also delete any configuration files created for or by them. However, there'll still be some remnants left for you to deal with manually.

cd /etc

rm -rf album aliases aliases.db avahi bubba_auth.xml bubba_version bubba-networkmanager.conf cups defoma dhcp3 dovecot foomatic ftd ghostscript horde mediatomb netatalk \
samba mt-daapd.conf

Reconfiguration

Next thing to do is to reinstall OpenSSH and LVM support - these were removed automatically as they were part of one of the meta-packages we purged earlier.

aptitude install openssh-server lvm2

With that issue out of the way let's get the networking set up proper.

vi /etc/network/interfaces

You should see this:

iface eth0 inet dhcp

iface eth1 inet dhcp

Edit to this:

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet dhcp

That'll have them load automatically when the system is initializing. A peculiar thing about the B3 and B2 is that the command shutdown won't have them power off and the LED will still be lit after the device having shut down. The way Excito turns the power off is by writing a certain number to a file followed by a reboot. Upon the system loading it will read that file - and if told to, power down instead of continuing booting but the button-daemon will still be running in order for the device to remain operational. This is what shuts down the B3 (proper):

/sbin/write-magic 0xdeadbeef
/sbin/reboot

This is for the B2:

echo -e "3735928559">/sys/devices/platform/bubbatwo/magic
reboot

Save it as an alias in your .bashrc or equivalent with an appropriate name.

Next two things to do is to remove the user "admin" since it was only used by the web interface and change the root password to something more appropriate - and then we'll reboot.

deluser admin

passwd

reboot

Done! What now?

There it is, an "almost vanilla" Debian system on your B3. You should have 165 packages installed and except for a few crucial ones (bubba-buttond, bubba3-kernel and bubba3-modules) it's the very same as what you'd get by installing plain old Debian. Depending on what you want to do with your server you may want to consider installing some of the following softwares:

  • sudo
  • proftpd
  • apache2
  • mysql
  • php5
  • python
  • ruby
  • dd-client
  • transmission
  • dnsmasq
  • ntp
  • screen
  • irssi
  • zsh
  • afp

Issues

At the time of writing this there is only one issue left unresolved - old files and directories created by the various softwares removed. This includes, amongst others, Mediatomb, Squeezecenter and Horde. There may also be special users and groups - those that were created for these applications to use. If you delete the Mediatomb user dpkg may conk out due to statoverride settings. This can be fixed by deleting the line(s) referring to Mediatomb in /var/lib/dpkg/statoverride but be wary of what you do (don't leave blank lines) and backing up the file in advance may be a good idea.

This article was originally written by me, totte, and may not be up to par with other articles when it comes to reader-friendliness. I may have skipped steps that I find too elementary to mention here and I probably unintentionally write tongue-in-cheek. Feel free to contact me on IRC Freenode or PM me on the Excito forum if you run into trouble or come up with clever solutions.

Backing up a customized installation

I've been looking into how one could modify the payload on the official USB installation image to customize the whole shebang from start but another, less direct yet useful, way is to backup your current installation. You need an USB drive with the Excito installation/rescue thingy on it with installation mode disabled and another USB drive of the same size or larger than the HDD in your B3. Shut the B3 down proper, remove the power cord, plug in the two USB drives, press and hold the power button down while plugging in the power cord and it'll boot the BusyBox rescue system. Find out which /dev/sdx assignments the internal HDD and the external backup disk are then do

dd if=/dev/sdx of=/dev/sdz

For me, that was

dd if=/dev/sda1 of=/dev/sdb1

When it's done (it may take a while depending on what sizes we're dealing with) you'll get some output, like

12345678+0 records in
12345678+0 records out

...and it's all good! Shut down the device with

halt

...unplug the power cord and USB drives then plug the power cord back in and you're set. It's not pretty but it works for a systemwide recovery. To back up your /home I suggest you take a look at other tutorials - there's rsync scripts to external USB drives and all kinds of stuff, each to his own!

To recover from that USB drive you follow the same procedure and simply reverse that dd to write from the USB drive to the internal drive, like this:

dd if=/dev/sdb1 of=/dev/sda1