Skip to content

Instantly share code, notes, and snippets.

@countingpine
Last active April 9, 2017 13:59
Show Gist options
  • Save countingpine/65364952b0109b9151c8c4ea4b9c98b9 to your computer and use it in GitHub Desktop.
Save countingpine/65364952b0109b9151c8c4ea4b9c98b9 to your computer and use it in GitHub Desktop.
<h3>This article has been tested for the following Ubuntu versions:</h3>
<p>&nbsp;</p>
<ul>
<li>
<p><a href="https://wiki.ubuntuusers.de/Trusty_Tahr/">Ubuntu 14.04</a> Trusty Tahr</p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/Precise_Pangolin/">Ubuntu 12.04</a> Precise Pangolin</p>
</li>
</ul>
<p>&nbsp;</p>
<h3>The following pages are helpful for understanding this article:</h3>
<p>&nbsp;</p>
<ol>
<li>
<p><a href="https://wiki.ubuntuusers.de/sudo/">Root privileges</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/Pakete_installieren/">Installation of programs</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/Terminal/">Open a terminal</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/Editor/">Open an editor</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/sources.list/">Set up source packages</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/chroot/">The command chroot</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/fstab/">Drives in / etc / fstab statically</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/Packprogramme/">Unzip the archive</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/Partitionierung/Grundlagen/">Fundamentals of partitioning</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/Kernelmodule/">Dealing with kernel modules (drivers)</a></p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/GRUB_2/">GRUB 2</a></p>
</li>
</ol>
<p>&nbsp;</p>
<p>Table of contents [-]</p>
<ol>
<li><a href="#Voraussetzungen">requirements</a></li>
<li><a href="#Installation">Installation</a>
<ol>
<li><a href="#Partitionierung-und-Formatierung">Partitioning and formatting</a></li>
<li><a href="#Installation-des-Basissystems">Installation of the basic system</a>
<ol>
<li><a href="#Wechsel-in-das-Zielsystem">Change to the target system</a></li>
</ol>
</li>
<li><a href="#Konfiguration-des-Basissystems">Configuration of the basic system</a>
<ol>
<li><a href="#Namensaufloesung">Name resolution</a></li>
<li><a href="#Dateisystem">File system</a></li>
<li><a href="#Netzwerk">Network</a></li>
<li><a href="#Paketquellen-Eintragen">Package Source</a></li>
<li><a href="#Paketabhaengigkeitsmodus-optimieren">Optimize packet dependency mode</a></li>
<li><a href="#Regionale-Einstellungen">Regionale Einstellungen</a></li>
<li><a href="#Kernel-und-Bootloader">Kernel und Bootloader</a></li>
<li><a href="#Bootmanager-installieren">Bootmanager installieren</a>
<ol>
<li><a href="#Booten-mit-SYSLINUX">Booten mit SYSLINUX</a></li>
<li><a href="#Installation-von-SYSLINUX-unter-Ubuntu-14-04-oder-12-04">Installation von SYSLINUX unter Ubun</a></li>
<li><a href="#Booten-mit-GRUB-2">Booten mit GRUB 2</a></li>
</ol>
</li>
<li><a href="#Root-Passwort">Root Password</a></li>
<li><a href="#Serielle-Konsole">Serial Console</a></li>
<li><a href="#Zeitzone">Timezone</a></li>
<li><a href="#Zugang-ueber-SSH">Zugang &uuml;ber SSH</a></li>
<li><a href="#Zusaetzlich-geladene-Module">Zus&auml;tzlich geladene Module</a></li>
<li><a href="#Installation-abschliessen-und-CF-Karte-aushaengen">Installation abschlie&szlig;en und CF-Karte </a></li>
</ol>
</li>
<li><a href="#Erster-Start">Erster Start</a></li>
</ol>
</li>
<li><a href="#Finale-Konfiguration-und-Optimierung">Final configuration and optimization</a>
<ol>
<li><a href="#Aktualisierung-und-Softwareinstallation">Aktualisierung und Softwareinstallation</a></li>
<li><a href="#Ansteuerung-der-LEDs">Ansteuerung der LEDs</a></li>
<li><a href="#Fazit">Fazit</a></li>
</ol>
</li>
<li><a href="#Links">Links</a></li>
</ol>
<p>This article explains in detail how to prepare a CompactFlash card on another computer with a finished operating system for <a href="https://wiki.ubuntuusers.de/Alix/">Alix boards</a> . Most of the instructions found on the Internet explain how an installation works on the machine itself. However, this often fails because the null modem cable has just disappeared, the new notebook or the computer does not have a serial interface at all and at an unfavorable time this is not even fast .</p>
<p>The challenge is therefore to prepare the installation completely offline on another machine, insert the resulting CF card into the Alix board, connect the power and network, and be able to log in to <a href="https://wiki.ubuntuusers.de/SSH/">SSH</a> in a matter of seconds .</p>
<h2>requirements</h2>
<p>To start the installation, you must have the following:</p>
<ul>
<li>
<p>A working network that allows access to the Internet.</p>
</li>
<li>
<p>A computer running an Ubuntu. The version is basically no matter, but it is advisable to use at least one Ubuntu 8.04, because older versions of <strong>debootstrap</strong> might not work as it would be necessary for a correct installation.</p>
</li>
<li>
<p>A working alix board. With the help of the procedure described in this manual, systems for various Alix boards of the 2D .. series were installed. In principle, this guide should be suitable for all Alix boards with only one serial interface (in order to be able to produce operating system images).</p>
</li>
<li>
<p>A fast CompactFlash card that should be at least 1GB in size. However, the total capacity depends on the intended use.</p>
</li>
<li>
<p>An external card reader</p>
</li>
</ul>
<p>If all of these prerequisites are met, installation can begin.</p>
<h2>Installation</h2>
<p>&nbsp;</p>
<h3>Note:</h3>
<p>Almost all commands listed below require root privileges <a href="#source-1">[1]</a> . To avoid having to prepend each of these commands to <strong>sudo, it is</strong> recommended to perform the installation in a root shell. This can be achieved by entering the <strong>sudo su</strong> command .</p>
<p>In the course of this article packages are often installed with <a href="https://wiki.ubuntuusers.de/apt-get/">apt-get</a> and uninstalled. This command is not the only way to achieve this. For example, it is possible to use the <a href="https://wiki.ubuntuusers.de/aptitude/">aptitude</a> command , but you may need to specify other parameters.</p>
<h3>Partitioning and formatting</h3>
<p>To use the CompactFlash card, it must be partitioned and formatted first. After inserting in the card reader, the device name under which the card can be addressed must first be determined. This is achieved by watching the system log output. The following command, executed before inserting the card, shows the previous messages:</p>
<pre>
tail -f /var/log/messages </pre>
<p>After inserting the CF card, new messages like this should appear here:</p>
<pre>
Nov 25 06:36:10 transpoldo kernel: [58904.010195] sd 2:0:0:1: [sdc] 7847280 512-byte hardware sectors (4018 MB)
Nov 25 06:36:10 transpoldo kernel: [58904.016240] sd 2:0:0:1: [sdc] Write Protect is off
Nov 25 06:36:10 transpoldo kernel: [58904.026204] sd 2:0:0:1: [sdc] 7847280 512-byte hardware sectors (4018 MB)
Nov 25 06:36:10 transpoldo kernel: [58904.032226] sd 2:0:0:1: [sdc] Write Protect is off
Nov 25 06:36:10 transpoldo kernel: [58904.037168] sdc: sdc1</pre>
<p>You can see that the CF card has got the device name <strong>/ dev / sdc</strong> and there is a partition with the device name <strong>/ dev / sdc1</strong> . At this point, the partitioning program can be called <a href="#source-9">[9]</a> :</p>
<pre>
fdisk /dev/sdc </pre>
<p>In the partitioning program, any existing partitions should be deleted, a new primary partition of the type 83 (Linux) that covers the entire map should be created with a boot flag (command &#39;a&#39;). For a 4 GB card this looks something like this:</p>
<pre>
Disk /dev/sdc: 4017 MB, 4017807360 bytes
128 heads, 63 sectors/track, 973 cylinders
Units = cylinders of 8064 * 512 = 4128768 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 973 3923104+ 83 Linux</pre>
<h3>Note:</h3>
<p>Without setting the boot flag (which can be recognized by the asterisk next to the device name of the partition), the system will not boot from the partition.</p>
<p>Partitioning can now be terminated to continue with the creation of the file system:</p>
<pre>
mke2fs -t ext2 -L root /dev/sdc1 </pre>
<p>As can be seen here, the volume <code>root</code>was given the name (which allows to mount by name), and <strong>ext2</strong> was selected as the file system, which is due to the lower number of write accesses due to the lack of implementation of journaling, Card. Nowadays, since modern flash controllers have the ability to evenly distribute the write accesses to the memory cells, the effectiveness of this measure is currently being discussed controversially. The use of the file system <strong>ext3</strong> or even a different file system is quite possible.</p>
<h3>Note:</h3>
<p>With the parameter <code>-L root</code>, the volume <code>root</code>was given the name . On systems with <a href="https://wiki.ubuntuusers.de/udev/">udev</a> , this allows the partition to be addressed not only by its device name <strong>/ dev / sdc1</strong> but also by the name <strong>/ dev / disk / by-label / root</strong> (with volume created just after entering the command <strong>udevtrigger</strong> ). This can help to alleviate the problem with constantly changing device names. For example, if you insert a USB stick, it may happen that the order of the device names has changed. However, identifying by name only works as long as these names are also unique. It is easier to identify here according to <a href="https://wiki.ubuntuusers.de/UUID/">UUID</a> . <strong>This pseudo-unique identification number is created when the file system is created and the partition can then be accessed via / dev / disk / by-id / &lt;UUID&gt;</strong> . However, the uniqueness is not really guaranteed, as some formatting programs, such as <strong>mkswap,</strong> allow you to specify a UUID. In addition, a partition can also be cloned.</p>
<p>After successful generation of the file system, the new formatted CF card can be integrated into the file system to continue the installation.</p>
<pre>
mkdir /mnt/alix
mount /dev/sdc1 /mnt/alix </pre>
<h3>Installation of the basic system</h3>
<p>At the beginning, a minimal basic system is installed on the map. This is the package</p>
<ul>
<li>
<p><strong>Debootstrap</strong></p>
</li>
</ul>
<p>Is used. If this is not already installed, you must first install it <a href="#source-2">[2]</a> .</p>
<p>The basic system is installed by entering the command:</p>
<ul>
<li>
<p>Ubuntu 14.04:</p>
<pre>
debootstrap --arch i386 trusty /mnt/alix http://de.archive.ubuntu.com/ubuntu </pre>
</li>
<li>
<p>Ubuntu 12.04:</p>
<pre>
debootstrap --arch i386 precise /mnt/alix http://de.archive.ubuntu.com/ubuntu </pre>
</li>
</ul>
<p>Depending on the speed of the Internet connection (if packets still need to be downloaded) and depending on the write speed of the CF card, this process takes different lengths of time.</p>
<p>Change to the target system</p>
<p>If this process is completed successfully, it is time to change to the new file system <a href="#source-6">[6]</a> :</p>
<pre>
mount -o bind /dev /mnt/alix/dev
mount -o bind /sys /mnt/alix/sys
mount -o bind /proc /mnt/alix/proc
chroot /mnt/alix /bin/bash </pre>
<h3>Configuration of the basic system</h3>
<p>&nbsp;</p>
<h3>Attention!</h3>
<p>From here you are per <a href="https://wiki.ubuntuusers.de/chroot/">chroot</a> on the later target system. All entered commands in the current terminal are only active there!</p>
<p>Name resolution</p>
<p>Every system does not need a name, but a name makes it better to live:</p>
<pre>
echo alix-router &gt; /etc/hostname </pre>
<p>And so that the whole name resolution works at least rudimentarily, the <strong>/ etc / hosts file</strong> should have the following content:</p>
<p>enlarge</p>
<pre>
127.0.0.1 localhost
127.0.1.1 alix-router.example.com alix-router
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts</pre>
<p>It is also worth taking a look at the <strong>/etc/resolv.conf</strong> file . Debootstrap usually copies the file of the generating system. Since the Alix system will initially be connected to the same network, this is not a problem. However, if you want to make sure that the name resolution is highly probable even after a reconfiguration, it is recommended to use as nameservers, such as OpenDNS and Google server:</p>
<pre>
nameserver 8.8.8.8
nameserver 208.67.222.222
nameserver 8.8.4.4
nameserver 208.67.220.220</pre>
<p>File system</p>
<p>The following file system table <a href="https://wiki.ubuntuusers.de/fstab/">/ etc / fstab </a> <a href="#source-7">[7]</a> ensures that the system also correctly locks all its file systems:</p>
<p>enlarge</p>
<pre>
# /etc/fstab: static file system information.
#
# &lt;file system&gt; &lt;mount point&gt; &lt;type&gt; &lt;options&gt; &lt;dump&gt; &lt;pass&gt;
proc /proc proc defaults 0 0
# /dev/sda1
LABEL=root / ext2 noatime,errors=remount-ro 0 0
tmpfs /tmp tmpfs defaults,noatime 0 0
tmpfs /var/tmp tmpfs defaults,noatime 0 0</pre>
<p>The option <code>noatime</code>for the root file system prevents any file access (ie also read accesses) from updating the so-called attribute <code>atime</code>(time stamp of the last access). This saves the flash memory of the CF card. For this reason, the temporary directories are also designed as RAM disks. To conserve the flash memory even further, you can extend the time for time-delayed write accesses. This is done by <strong>inserting the following</strong> lines into <strong>/etc/sysctl.conf</strong> :</p>
<pre>
vm.dirty_writeback_centisecs = 1500</pre>
<p>The default value is normally <code>500</code>(5 seconds). The new value <code>1500</code>(15 seconds) should significantly reduce the number of actual write accesses during ongoing operation.</p>
<p><a href="#Netzwerk">Network</a></p>
<p>This article assumes that the existing network has the address space <code>192.168.97.0/24</code>and is <code>192.168.97.1</code>the default gateway. These values ​​must be adapted to local conditions. The network addresses of the adapters are configured statically in the <a href="https://wiki.ubuntuusers.de/interfaces/">/ etc / network / interfaces file</a> . This is now created with the following content:</p>
<p>enlarge</p>
<pre>
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.97.100
netmask 255.255.255.0
gateway 192.168.97.1
# emergency fallback addresses
post-up ip addr add 169.254.19.65/16 dev eth0
pre-down ip addr del 169.254.19.65/16 dev eth0</pre>
<p>Since the Alix system is started blind (without a screen), it is very useful to assign a fixed IP address, since it would be rather difficult to determine the address assigned to the network card. The specification of the default gateway is compulsory, since additional packages must be installed later on the system. By the way, it is extremely advisable to assign a known <a href="https://de.wikipedia.org/wiki/APIPA">APIPA</a> address (for example <code>169.254.19.65</code>:), since you have the security to contact the device at any time, even if the primary address has been forgotten or is unknown. The APIPA address should also be attached to the device in the form of a label.</p>
<p>Package Source</p>
<p>The package sources - in - according to the desired version of Ubuntu <a href="https://wiki.ubuntuusers.de/sources.list/">sources.list</a> entered <a href="#source-5">[5]</a> .</p>
<p>For Ubuntu 14.04 (trusty):</p>
<p>enlarge</p>
<pre>
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
## Primary distribution source
deb http://de.archive.ubuntu.com/ubuntu/ trusty main universe
#deb-src http://de.archive.ubuntu.com/ubuntu/ trusty main universe
## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ trusty-updates main universe
#deb-src http://de.archive.ubuntu.com/ubuntu/ trusty-updates main universe
## Security updates
deb http://security.ubuntu.com/ubuntu trusty-security main universe
#deb-src http://security.ubuntu.com/ubuntu trusty-security main universe</pre>
<p>For Ubuntu 12.04 (precise):</p>
<p>enlarge</p>
<pre>
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
## Primary distribution source
deb http://de.archive.ubuntu.com/ubuntu/ precise main universe
#deb-src http://de.archive.ubuntu.com/ubuntu/ precise main universe
## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ precise-updates main universe
#deb-src http://de.archive.ubuntu.com/ubuntu/ precise-updates main universe
## Security updates
deb http://security.ubuntu.com/ubuntu precise-security main universe
#deb-src http://security.ubuntu.com/ubuntu precise-security main universe</pre>
<p>Optimize packet dependency mode</p>
<p>Since Ubuntu 8.10, the package manager <strong>apt</strong> is configured not only to install packages with direct dependency, but also to packets that are in the list of recommended additional <em>packages</em> . This behavior is undesirable in this particular case for a number of reasons because, on the one hand, it is intended to create a system as slim as possible, but on the other hand it should also be avoided that one of the suggested boot managers (in this case GRUB 2) Since in such a system it can be not only oversized but even harmful, which is explained in more detail in the corresponding section of this article.</p>
<p>In order to make the package manager install only the necessary dependencies, the <strong>/etc/apt/apt.conf.d/00onlydepends</strong> file is <strong>created</strong> with the following content:</p>
<pre>
APT::Install-Recommends &quot;0&quot;;
APT::Install-Suggests &quot;0&quot;;</pre>
<p>This change affects both the package manager <a href="https://wiki.ubuntuusers.de/apt/">apt</a> and the package manager <a href="https://wiki.ubuntuusers.de/aptitude/">aptitude</a> .</p>
<p>Regional Settings</p>
<p>Installing Regional Settings and the Console System <a href="#source-1">[1]</a> :</p>
<pre>
echo en_US.UTF-8 UTF-8 &gt; /var/lib/locales/supported.d/local
locale-gen
apt-get update </pre>
<p>Kernel and boot loader</p>
<p>Now a suitable kernel can be installed.</p>
<p>The kernel for Ubuntu 14.04 requires the support of the CPU of PAE, which the AMD Geode processor does not provide. <a href="https://wiki.ubuntu.com/phillw/non-pae">Phill Whiteside</a> <img alt="{En}" src="//media-cdn.ubuntu-de.org/wiki/attachments/35/40/gb.png" /> has created kernels without PAE for 14.04. For Ubuntu 14.04, the non-PAE kernel is installed by entering the commands:</p>
<pre>
apt-get -y install wget
wget http://phillw.net/isos/non-pae/alternate/linux-firmware-image-3.13.0-non-pae_124_i386.deb
wget http://phillw.net/isos/non-pae/alternate/linux-headers-3.13.0-non-pae_124_i386.deb
wget http://phillw.net/isos/non-pae/alternate/linux-image-3.13.0-non-pae_124_i386.deb
wget http://phillw.net/isos/non-pae/alternate/linux-libc-dev_124_i386.deb
dpkg -i *.deb
rm *non-pae*.deb </pre>
<p>For Ubuntu 12.04 by entering the command:</p>
<pre>
apt-get -y install linux-image-generic </pre>
<p>Bootmanager</p>
<p>For the system to start, it still needs a boot manager. In typical Ubuntu installations, the GRUB boot manager is used, which in this specific case is configured to perform its inputs and outputs via the serial interface. Unfortunately, it has been observed on various Alix boards that this may cause the system to not boot automatically, but to remain in the GRUB menu after switching on the system. This is presumably due to the fact that apparently the switch-on pulse appears after random pattern in the serial buffer, which interrupts the automatic boot sequence.</p>
<p>To allow the user to choose between the various boot managers, follow the instructions for installing both SYSLINUX and GRUB.</p>
<h3>Attention!</h3>
<p>Please ensure that the addressed device name is actually the one under which the CF card is addressed in the system during all subsequent actions. Blind run the commands may otherwise be <em>undesirable</em> result results! The user <a href="https://ubuntuusers.de/user/girts/">girts</a> can sing a song of it: namely, he has shot the boot sector of his computer:</p>
<p>Comment by girts, 2011-04-29: I changed the destination to MBR copy command to / dev / sdc. It was / dev / sda in the original version. However, I rewrote the MBR of my PC and lost a day to recover it. Therefore, I would like to be <img alt=":)" src="//media-cdn.ubuntu-de.org/wiki/attachments/13/47/happy.png" />able to do this<img alt=":)" src="//media-cdn.ubuntu-de.org/wiki/attachments/13/47/happy.png" /></p>
<p>Booting with SYSLINUX</p>
<p>The SYSLINUX project provides compact bootloaders for starting MS-DOS FAT file systems (SYSLINUX), for booting over the network (PXELINUX), for bootable &quot;El Torito&quot; CD-ROMs (ISOLINUX) and for the boot Starting ext2 / ext3 file systems (EXTLINUX).</p>
<p>Installing SYSLINUX on Ubuntu 14.04 or 12.04</p>
<p>The following commands are used to install SYSLINUX and make the CF card bootable:</p>
<pre>
apt-get -y install extlinux
mkdir -f /boot/extlinux
extlinux --install /boot/extlinux
dd if=/usr/lib/extlinux/mbr.bin of=/dev/sdc </pre>
<p>Next, the configuration of the SYSLINUX boot manager is adjusted. The file <strong>/ etc / default / extlinux has to be</strong> edited:</p>
<p>enlarge</p>
<pre>
EXTLINUX_UPDATE=&quot;true&quot;
EXTLINUX_ALTERNATIVES=&quot;default recovery&quot;
EXTLINUX_DEFAULT=&quot;l0&quot;
EXTLINUX_ENTRIES=&quot;all&quot;
EXTLINUX_MENU_LABEL=&quot;Ubuntu GNU/Linux, kernel&quot;
EXTLINUX_PARAMETERS=&quot;ro reboot=bios console=ttyS0,38400n8&quot;
EXTLINUX_ROOT=&quot;root=/dev/sda1&quot;
EXTLINUX_THEME=&quot;none&quot;
EXTLINUX_TIMEOUT=&quot;50&quot;</pre>
<p>Finally, one more time</p>
<pre>
extlinux-update </pre>
<p>Call. This completes the installation of the boot manager.</p>
<p>Booting with GRUB 2</p>
<p>&nbsp;</p>
<h3>Attention!</h3>
<p>The installation of GRUB was not tested under Ubuntu 12.04!</p>
<p>From version 9.10 onwards, Ubuntu no longer uses <a href="https://wiki.ubuntuusers.de/GRUB/">GRUB</a> version 0.97 (Grub Legacy) but the successor <a href="https://wiki.ubuntuusers.de/GRUB_2/">GRUB 2</a> . The installation is carried out by means of the following command:</p>
<pre>
apt-get -y install grub-pc </pre>
<p>During the installation, several questions are asked, all of which can be confirmed with the Enter key. It is important to select only the CF card (in our case <strong>/ dev / sdc</strong> ) in the list of existing devices . Further adjustments are made by entering various values ​​in some configuration files.</p>
<p>Next, the configuration of GRUB 2 <a href="#source-11">[11] is</a> adjusted. The file <strong>/ etc / default / grub must have the</strong> following content:</p>
<p>enlarge</p>
<pre>
# If you change this file, run &#39;update-grub&#39; afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=&quot;3&quot;
GRUB_DISTRIBUTOR=`lsb_release -i -s 2&gt; /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=&quot;verbose console=ttyS0,38400n8 reboot=bios&quot;
GRUB_CMDLINE_LINUX=&quot;&quot;
# Konfiguration der seriellen Schnittstelle der Alix-Boards:
GRUB_SERIAL_COMMAND=&quot;serial --unit=0 --speed=38400&quot;
GRUB_TERMINAL=serial
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo&#39;
#GRUB_GFXMODE=640x480
# Uncomment if you don&#39;t want GRUB to pass &quot;root=UUID=xxx&quot; parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY=&quot;true&quot;</pre>
<p>The changes made cause GRUB 2 to accept its inputs and outputs via the serial interface, and otherwise all pauses are quite short.</p>
<p>In the following step, GRUB 2 is now installed in the CF card. However, since this is not yet in the target system, there is a difference between the parameters as they have to be entered in the boot sector (eg, the operating system is on the first data carrier), and the current reality (namely, that The future boot media is an additional drive in another system). For this purpose, the assignment between the internal device name and the effective device name in GRUB 2&#39;s name matching <strong>table</strong> /boot/grub/devices.map is made as follows:</p>
<pre>
(hd0) /dev/sdc</pre>
<p>In this case, it is essential that the device name of the CF card is entered. This will change later in the running system. Here is now the name from the point of view of the installing system. At this point, GRUB2 can be installed and configured using the new values ​​on the CF card with the following commands:</p>
<pre>
grub-install /dev/sdc
update-grub </pre>
<p>After the installation, the name matching <strong>table</strong> /boot/grub/devices.map can now be given the final entry:</p>
<pre>
(hd0) /dev/sda</pre>
<p>To allow GRUB 2 to customize its configuration even in future kernel updates, add the <strong>following</strong> lines to /etc/kernel-img.conf:</p>
<pre>
postinst_hook = update-grub
postrm_hook = update-grub</pre>
<p>Root password</p>
<p>For a login via SSH, the password for the user <strong>root</strong> must be defined:</p>
<pre>
passwd root </pre>
<p>Serial console</p>
<p>A standard installation configures a screen console system with six consoles. These are not needed and are therefore removed. For this, it is only necessary to remove the event handler configuration files from the six screen consoles from the <a href="https://wiki.ubuntuusers.de/Upstart/">Upstart</a> event handler directory:</p>
<pre>
rm /etc/init/tty?.conf </pre>
<p>Instead, a configuration file is needed, which is responsible for setting up a serial console. This is done by creating the file <strong>/etc/init/ttyS0.conf</strong> with the following content:</p>
<p>enlarge</p>
<pre>
# ttyS0 - getty
#
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -8 38400 -L ttyS0</pre>
<p>Time zone</p>
<p>The time zone of the system is set with the following command:</p>
<pre>
dpkg-reconfigure tzdata </pre>
<p>Access via SSH</p>
<p>To access the running system, an <a href="https://wiki.ubuntuusers.de/SSH/">SSH</a> server must be installed <a href="#source-2">[2]</a> :</p>
<ul>
<li>
<p><strong>Openssh-server</strong></p>
</li>
</ul>
<p>From here, the system is accessible via the network.</p>
<h3>Attention!</h3>
<p>The SSH server accepts the authentication by default by default. As soon as the system enters normal operation, it is recommended to switch off this option because it poses a significant safety risk. If password authentication is deactivated, it is only possible to log on using a private key. For this purpose, you must ensure that your own public key is entered into the <strong>~ / .ssh / authorized_keys file</strong> of the corresponding user. Password authentication can be disabled with OpenSSH by setting the option <em>PasswordAuthentication</em> in the file <strong>/ etc / ssh / sshd_config</strong> to <em>no</em> .</p>
<p>Additional loaded modules</p>
<p>In order for the system to load the <a href="https://wiki.ubuntuusers.de/Kernelmodule/">kernel modules</a> (&quot;drivers&quot;) for special hardware components of the Alix boards, these are entered in the <strong>/ etc / modules</strong> file <a href="#source-10">[10]</a> :</p>
<p>enlarge</p>
<pre>
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with &quot;#&quot; are ignored.
# Alix Specific:
natsemi
lm90
scx200_acb base=0x810,0x820
leds-alix
ledtrig-default-on
ledtrig-heartbeat
ledtrig-gpio
ledtrig-timer</pre>
<p>Complete the installation and unplug the CF card</p>
<p>At this point, the actual installation is complete. Before you remove the CF card from the card reader, however, the following commands must still be executed:</p>
<pre>
exit
umount /mnt/alix/proc
umount /mnt/alix/sys
umount /mnt/alix/dev
umount /mnt/alix </pre>
<p>If the last command prints an error message, check whether a process is still accessing the <strong>/ mnt / alix directory</strong> or its subdirectories. The card can only be removed if the file system has been unmounted without error.</p>
<h3>Attention!</h3>
<p>After entering the <em>exit</em> command , <a href="https://wiki.ubuntuusers.de/chroot/">chroot</a> is terminated and you are no longer on the target system. All commands entered in the current terminal have an effect on the real system!</p>
<h3>First start</h3>
<p>After inserting the CF card into the Alix board, a first start can now be made. Before switching on, the system must still be connected to the network. For Alix boards with multiple network cards, the first network card is the one that is right next to the power supply socket. If you want to be safe, you can connect all network connectors to the network. At this point, the system can be turned on. To determine when the system is up and running in the network, you can enter the following command on your computer before switching on:</p>
<pre>
ping 192.168.97.100 </pre>
<p>After about 10-15 seconds, visible activity should be visible on both LEDs of the active network port. The success can be seen in the fact that the Alix system responds to the pings:</p>
<pre>
ping 192.168.97.100 </pre>
<p>&nbsp;</p>
<p>enlarge</p>
<pre>
PING 192.168.97.100 (192.168.97.100) 56(84) bytes of data.
From 192.168.97.249 icmp_seq=1 Destination Host Unreachable
[...]
From 192.168.97.249 icmp_seq=6 Destination Host Unreachable
64 bytes from 192.168.97.100: icmp_seq=7 ttl=64 time=2001 ms
64 bytes from 192.168.97.100: icmp_seq=8 ttl=64 time=992 ms
--- 192.168.97.100 ping statistics ---
11 packets transmitted, 5 received, +6 errors, 54% packet loss, time 10026ms
rtt min/avg/max/mdev = 0.389/599.057/2001.498/799.607 ms, pipe 3</pre>
<p>If this is not the case, assume that the system is not started, that the network configuration is not compatible with the network, or that something has gone wrong during the above steps. An accurate analysis of the content of the CF card usually allows the error to be found quickly. However, you should also consider using the appropriate hardware to connect to the serial port and follow the startup process of the system closely.</p>
<p>If, on the other hand, everything went as expected, one can now connect to the system using SSH:</p>
<pre>
ssh -l root 192.168.97.100 </pre>
<p>enlarge</p>
<pre>
The authenticity of host &#39;192.168.97.100 (192.168.97.100)&#39; can&#39;t be established.
RSA key fingerprint is ec:38:36:0b:42:9c:c2:ae:17:6d:8f:d5:27:24:9d:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added &#39;192.168.97.100&#39; (RSA) to the list of known hosts.
[email protected]&#39;s password:
Linux alix-router 2.6.31-15-386 #50-Ubuntu SMP Tue Nov 10 17:30:14 UTC 2009 i586
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
root@alix-router:~#</pre>
<p>The system is now ready to run and ready for final finishing.</p>
<h2>Final configuration and optimization</h2>
<p>&nbsp;</p>
<h3>Update and software installation</h3>
<p>First of all, update the whole system and install the standard system components:</p>
<pre>
apt-get update
apt-get upgrade
apt-get -y install ubuntu-standard screen </pre>
<p>In order to make the <a href="https://wiki.ubuntuusers.de/screen/">screen</a> easy to use, the corresponding configuration file <strong>/ etc / screenrc</strong> should be improved. Here is the complete amended version with note of amendment:</p>
<p>enlarge</p>
<pre>
# $Id: screenrc,v 1.15 2003/10/08 11:39:03 zal Exp $
#
# /etc/screenrc
#
# This is the system wide screenrc.
#
# You can use this file to change the default behavior of screen system wide
# or copy it to ~/.screenrc and use it as a starting point for your own
# settings.
#
# Commands in this file are used to set options, bind screen functions to
# keys, redefine terminal capabilities, and to automatically establish one or
# more windows at the beginning of your screen session.
#
# This is not a comprehensive list of options, look at the screen manual for
# details on everything that you can put in this file.
#
# ------------------------------------------------------------------------------
# SCREEN SETTINGS
# ------------------------------------------------------------------------------
startup_message off
#nethack on
#defflow on # will force screen to process ^S/^Q
deflogin on
#autodetach off
# turn visual bell on
# vbell on
# vbell_msg &quot; Wuff ---- Wuff!! &quot;
# define a bigger scrollback, default is 100 lines
defscrollback 10240
# ------------------------------------------------------------------------------
# SCREEN KEYBINDINGS
# ------------------------------------------------------------------------------
# Remove some stupid / dangerous key bindings
bind ^k
#bind L
bind ^\
# Make them better
bind \\ quit
bind K kill
bind I login on
bind O login off
bind } history
# An example of a &quot;screen scraper&quot; which will launch urlview on the current
# screen window
#
#bind ^B eval &quot;hardcopy_append off&quot; &quot;hardcopy -h $HOME/.screen-urlview&quot; &quot;screen urlview $HOME/.screen-urlview&quot;
# ------------------------------------------------------------------------------
# TERMINAL SETTINGS
# ------------------------------------------------------------------------------
# The vt100 description does not mention &quot;dl&quot;. *sigh*
termcapinfo vt100 dl=5\E[M
# turn sending of screen messages to hardstatus off
hardstatus off
# Set the hardstatus prop on gui terms to set the titlebar/icon title
termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007
# use this for the hard status string
hardstatus string &quot;%h%? users: %u%?&quot;
# An alternative hardstatus to display a bar at the bottom listing the
# windownames and highlighting the current windowname in blue. (This is only
# enabled if there is no hardstatus setting for your terminal)
#
#hardstatus lastline &quot;%-Lw%{= BW}%50&gt;%n%f* %t%{-}%+Lw%&lt;&quot;
# set these terminals up to be &#39;optimal&#39; instead of vt100
termcapinfo xterm*|linux*|rxvt*|Eterm* OP
# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E&gt;
# (This fixes the &quot;Aborted because of window size change&quot; konsole symptoms found
# in bug #134198)
termcapinfo xterm &#39;is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l&#39;
# To get screen to add lines to xterm&#39;s scrollback buffer, uncomment the
# following termcapinfo line which tells xterm to use the normal screen buffer
# (which has scrollback), not the alternate screen buffer.
#
#termcapinfo xterm|xterms|xs|rxvt ti@:te@
# Enable non-blocking mode to better cope with flaky ssh connections.
defnonblock 5
# ------------------------------------------------------------------------------
# STARTUP SCREENS
# ------------------------------------------------------------------------------
# Example of automatically running some programs in windows on screen startup.
#
# The following will open top in the first window, an ssh session to monkey
# in the next window, and then open mutt and tail in windows 8 and 9
# respectively.
#
# screen top
# screen -t monkey ssh monkey
# screen -t mail 8 mutt
# screen -t daemon 9 tail -f /var/log/daemon.log
hardstatus alwayslastline &quot;%{kw} %{b}%H%{K} &lt; %-w%{Wb} %n %t %{-}%+w &gt;&quot;
# This lets work all functions keys in midnight commander
termcapinfo xterm &#39;k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~&#39;</pre>
<h3>Control of the LEDs</h3>
<p>To control the LEDs, the corresponding module should be compiled and loaded. A detailed description can be found <a href="https://wiki.ubuntuusers.de/Alix/#LEDs-ansteuern">here</a> .</p>
<p>And now with the first LED is not just stubborn in front of itself, but a little feedback about the system status and run level, here is an event handler in the form of the file <strong>/etc/init/watchdog-led.conf</strong> :</p>
<p>enlarge</p>
<pre>
# WatchDog LED Configuration for Alix-Boards
#
# This task configures the watchdog led to resemble the status
# of the system
description &quot;Configuration of the first alix led (Watchdog led)&quot;
author &quot;Leo Moll &lt;[email protected]&gt;&quot;
start on runlevel [0123456]
stop on runlevel [!$RUNLEVEL]
export RUNLEVEL
export PREVLEVEL
task
script
case $RUNLEVEL in
1|6) echo timer &gt; /sys/class/leds/alix\:1/trigger
echo 100 &gt; /sys/class/leds/alix\:1/delay_on
echo 100 &gt; /sys/class/leds/alix\:1/delay_off
;;
0) echo 0 &gt; /sys/class/leds/alix\:1/brightness
echo none &gt; /sys/class/leds/alix\:1/trigger
;;
2|3|4|5) echo heartbeat &gt; /sys/class/leds/alix\:1/trigger
;;
*) echo timer &gt; /sys/class/leds/alix\:1/trigger
echo 100 &gt; /sys/class/leds/alix\:1/delay_on
echo 300 &gt; /sys/class/leds/alix\:1/delay_off
;;
esac
end script</pre>
<p>Based on the corresponding run level, the first LED now behaves as follows:</p>
<ul>
<li>
<p>Normal operation: heartbeat (heartbeat)</p>
</li>
<li>
<p>Reboot: Fast flashing</p>
</li>
<li>
<p>System down: LED off</p>
</li>
<li>
<p>When starting: LED on</p>
</li>
<li>
<p>System started in Run Level 1: fast flashing</p>
</li>
<li>
<p>Other Runlevel: Short flashing</p>
</li>
</ul>
<p>&nbsp;</p>
<h3>Conclusion</h3>
<p>The system is now in the state of a well-functioning basic system. This is an excellent starting point to make any special applications such as special routers, small network servers or telephone systems.</p>
<h3>Note:</h3>
<p>If you want to clone the system to other CF cards or use the CF card in another Alix system, you should not <strong>forget</strong> to delete the <strong>/etc/udev/rules.d/70-persistent-net.rules</strong> file . You do not do this, the network adapter will receive new names (eg <code>eth3</code>, <code>eth4</code>and <code>eth5</code>) and are not initialized (because they do not in the <strong>/ etc / network / interfaces</strong> are).</p>
<h2>Links</h2>
<p>&nbsp;</p>
<ul>
<li>
<p><a href="http://www.networksoul.net/page/2/">Setting up a Linux home server based on a low cost and low power hardware (Pc Engines Alix) - Part1</a> <img alt="{En}" src="//media-cdn.ubuntu-de.org/wiki/attachments/35/40/gb.png" /></p>
</li>
<li>
<p><a href="http://lwn.net/Articles/169919/">LED Class, Triggers and Drivers</a> <img alt="{En}" src="//media-cdn.ubuntu-de.org/wiki/attachments/35/40/gb.png" /></p>
</li>
<li>
<p><a href="http://ichbinroot.de/alix/leds.html">Http://ichbinroot.de/alix/leds.html</a> <img alt="{De}" src="//media-cdn.ubuntu-de.org/wiki/attachments/49/40/de.png" /> LEDs</p>
</li>
<li>
<p><a href="http://syslinux.zytor.com">Http://syslinux.zytor.com</a> <img alt="{En}" src="//media-cdn.ubuntu-de.org/wiki/attachments/35/40/gb.png" /> Homepage of the SYSLINUX project</p>
</li>
<li>
<p><a href="https://wiki.ubuntuusers.de/Alix/">Alix</a> main article</p>
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment