Difference between revisions of "Revert to minimal Debian installation"

From BubbaWiki
Jump to navigation Jump to search
m ('\' added to multi-line commands to ease copy/paste)
m
 
Line 1: Line 1:
<p>This tutorial is primarily aimed towards the B3 but the principle should be the same for other products.  
This tutorial is primarily aimed towards the B3 but the principle should be the same for other products.  
</p><p><br />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.  
 
</p>
<br>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.  
<h3> Initial setup  </h3>
 
<p>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 <i><b>Wizard</b></i> setup and proceed to the <i><b>Users</b></i> page and grant yourself shell access. It may be a good idea to switch the <i><b>Network</b></i> setting to <i>Server only</i>. Once done, do a software update and then reboot the device.  
=== Initial setup  ===
</p><p>When the B3 is up and running again - log in by SSH and switch to superuser (the default password is "excito") once logged in.<br />
 
</p>
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.<br>  
<pre>ssh username@b3.local
<pre>ssh username@b3.local
su
su
</pre>  
</pre>  
<h3> Delete packages  </h3>
=== Delete packages  ===
<p>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.<br />
 
</p>
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.<br>  
<pre>aptitude purge squeezecenter mailutils guile-1.8-libs libmailutils2 dhcp3-client dhcp3-common bubba \
<pre>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 \
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
mnemo2-base turba2-base libmysqlclient16 libfribidi0 libgmp3c2 libgsasl7 libidn11 libntlm0 libpng12-0 libxapian15
</pre>  
</pre>  
<p>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.<br />
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.<br>  
</p>
<pre>cd /etc
<pre>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 \
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
samba mt-daapd.conf
</pre>
</pre>  
<h3> Reconfiguration  </h3>
=== Reconfiguration  ===
<p>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.<br />
 
</p>
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.<br>  
<pre>aptitude install openssh-server lvm2
<pre>aptitude install openssh-server lvm2
</pre>  
</pre>  
<p>With that issue out of the way let's get the networking set up proper.<br />
With that issue out of the way let's get the networking set up proper.<br>  
</p>
<pre>vi /etc/network/interfaces
<pre>vi /etc/network/interfaces
</pre>  
</pre>  
<p>You should see this:<br />
You should see this:<br>  
</p>
<pre>iface eth0 inet dhcp
<pre>iface eth0 inet dhcp


iface eth1 inet dhcp
iface eth1 inet dhcp
</pre>  
</pre>  
<p>Edit to this:<br />
Edit to this:<br>  
</p>
<pre>auto eth0
<pre>auto eth0
iface eth0 inet dhcp
iface eth0 inet dhcp
Line 46: Line 44:
iface eth1 inet dhcp
iface eth1 inet dhcp
</pre>  
</pre>  
<p>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 <i>but</i> the button-daemon will still be running in order for the device to remain operational. This is what shuts down the B3 (proper):  
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):  
</p>
<pre>/sbin/write-magic 0xdeadbeef
<pre>/sbin/write-magic 0xdeadbeef
/sbin/reboot
/sbin/reboot
</pre>  
</pre>  
<p>This is for the B2:  
This is for the B2:  
</p>
<pre>echo -e "3735928559"&gt;/sys/devices/platform/bubbatwo/magic
<pre>echo -e &quot;3735928559&quot;&gt;/sys/devices/platform/bubbatwo/magic
reboot
reboot
</pre>  
</pre>  
<p>Save it as an alias in your .bashrc or equivalent with an appropriate name.  
Save it as an alias in your .bashrc or equivalent with an appropriate name.  
</p><p>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.<br />
 
</p>
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.<br>  
<pre>deluser admin
<pre>deluser admin


Line 65: Line 61:
reboot
reboot
</pre>  
</pre>  
<h3> Done! What now?  </h3>
=== Done! What now?  ===
<p>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:  
 
</p>
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:  
<ul><li>sudo  
 
</li><li>proftpd  
*sudo  
</li><li>apache2  
*proftpd  
</li><li>mysql  
*apache2  
</li><li>php5  
*mysql  
</li><li>python  
*php5  
</li><li>ruby  
*python  
</li><li>dd-client  
*ruby  
</li><li><a href="http://wiki.excito.org/wiki/index.php/Setup_transmission_on_b3">transmission</a>
*dd-client  
</li><li>dnsmasq  
*[[Setup transmission on b3|transmission]]
</li><li>ntp  
*dnsmasq  
</li><li>screen  
*ntp  
</li><li>irssi  
*screen  
</li><li>zsh  
*irssi  
</li><li>afp
*zsh  
</li></ul>
*afp
<h3> Issues  </h3>
 
<p>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.  
=== Issues  ===
</p><p><i>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&nbsp;Freenode or PM me on the Excito forum if you run into trouble or come up with clever solutions.</i>
 
</p>
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.  
<h3> Backing up a customized installation  </h3>
 
<p>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 <b>installation mode disabled</b> 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  
''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&nbsp;Freenode or PM me on the Excito forum if you run into trouble or come up with clever solutions.''
</p>
 
=== 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  
<pre>dd if=/dev/sdx of=/dev/sdz
<pre>dd if=/dev/sdx of=/dev/sdz
</pre>  
</pre>  
<p>For me, that was  
For me, that was  
</p>
<pre>dd if=/dev/sda1 of=/dev/sdb1
<pre>dd if=/dev/sda1 of=/dev/sdb1
</pre>  
</pre>  
<p>When it's done (it may take a while depending on what sizes we're dealing with) you'll get some output, like  
When it's done (it may take a while depending on what sizes we're dealing with) you'll get some output, like  
</p>
<pre>12345678+0 records in
<pre>12345678+0 records in
12345678+0 records out
12345678+0 records out
</pre>  
</pre>  
<p>...and it's all good! Shut down the device with  
...and it's all good! Shut down the device with  
</p>
<pre>halt</pre>  
<pre>halt</pre>  
<p>...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!<br />  
...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!<br>  
</p><p>To recover from that USB drive&nbsp;you follow the same procedure and simply reverse that dd to write from the USB drive to the internal drive, like this:  
 
</p>
To recover from that USB drive&nbsp;you follow the same procedure and simply reverse that dd to write from the USB drive to the internal drive, like this:  
<pre>dd if=/dev/sdb1 of=/dev/sda1</pre>
<pre>dd if=/dev/sdb1 of=/dev/sda1</pre>

Latest revision as of 13:00, 24 July 2013

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