User Tools

Site Tools


  • beagleboneblack
  • Jonathan Haack
  • Haack's Networking

Installing Debian on Beagle Boards

Insert microsd on host workstation, unmount in order to write the .img to the disk

sudo dmesg
umount /dev/mmcblk0p1

Write the debian image to the SD Card using dd command

sudo dd of=/dev/mmcblk0 if=/home/sexa/Downloads/bone-debian-9.2-iot-armhf-2017-10-10-4gb.img bs=1M conv=fdatasync [or && sync]

Pull out the SD card and then put back in so that it mounts read/write and then edit:

vi /media/username/rootfs/boot/uEnv.txt
cmdline=init=/opt/scripts/tools/eMMC/ [uncomment this line in the config]

Use screen and a serial usb adapter to oversee the installation since ssh will likely get broken during the post-install cleanup. The adapter's tx goes to bb's rx, and so on. For the beaglebone black pin setup, see

sudo screen /dev/ttyUSB0 115200 [Example]

Once the device powers off, remove the microSD card or it will flash the eMMC again and again. Now, prepare the bb for shell access by editing your ssh config:

vi /etc/ssh/sshd_config 
<PermitRootLogin yes>

Add a password for root, then test the shell access, add the public keysto the authorized_keys file

ssh root@xx.xx.xx.xx
ssh-copy-id root@xx.xx.xx.xx
vi /root/.ssh/authorized_keys [copy and paste the pub keys]
Clean Up Post-Install

Install deborphan in order to remove hanging dependencies from apps that we will later strip.

apt-get install screen deborphan ntp 

The new version has an ntp server, but retaining here in case setting up legacy system. Now, prepare network interfaces:

vi /etc/network/interfaces 
<uncomment these parameters>
auto eth0
iface eth0 inet dhcp
<comment out any other paramaters besides loopback>

It is now time to strip the bb of the stock apps, etc. If you prefer to use ssh over serial, then use screen as follows:

ssh -t root@xx.xx.xx.xx screen -DRO 

Now, let's remove the unnecessary packages (as root) - but bear in mind that these may change in future releases:

for i in c9-core-installer udhcpd chromium-codecs-ffmpeg-extra connman lximage-qt lxmenu-data pcmanfm-qt qupzilla xserver-xorg-core "light*" chromium-browser nodejs "lxqt*" xserver-common "apache2*" bluez "xfonts*" "x11-*" "x11proto-*" build-essential alsa-utils; do apt-get -y purge $i; done
apt remove --purge c9-core-installer bonescript bone101

Sometimes ssh hangs at this stage, so if so, use serial.

apt-get --purge autoremove 
apt-get --purge remove `deborphan`

Run this last command a few times until everything is removed.

apt-get dist-upgrade
apt-get clean

Change hostname, remove the splash/motd

vi /etc/hosts
vi /etc/hostname
vi /etc/ to remove the goofy ssh splash

Edit logs and cron to limit writes

cd /var/log && rm lastlog && ln -s /dev/null lastlog
cd /etc/cron.daily && mv man-db man-db.disabled [if it exists]

To find latest writes to disk: find / -mount -newermt 14:44:00 [to see what logs are post-updates, i.e., for limiting writes to eMMC]

Verify /etc/fstab configuration, include noatime, for example:

UUID=57e4a3f6-7951-40ae-ad25-b445959e1c30  /  ext4  noatime,errors=remount-ro  0  1
debugfs  /sys/kernel/debug  debugfs  defaults  0  0

#If we use an external sdcard, we are less concerned with re-writes, so enable the logs on the sdcard (create directories for each location below, mountpoints, etc.)

UUID=eb885f2f-28a4-49a6-99c9-3f8b0b7a871d /sdcard ext4 noatime,nofail,errors=remount-ro  0  2
/sdcard/tmp           /tmp            none bind,nofail 0 0
/sdcard/var/log       /var/log        none bind,nofail 0 0
/sdcard/var/lib/mysql /var/lib/mysql  none bind,nofail 0 0 
/sdcard/var/lib/cacti/ /var/lib/cacti none bind,nofail 0 0 
/sdcard/var/lib/ntp    /var/lib/ntp   none bind,nofail 0 0

Removing bloat update

sudo systemctl stop cloud9.service cloud9.socket
sudo systemctl disable cloud9.service cloud9.socket
sudo rm -rf /var/lib/cloud9 /opt/cloud9 /etc/default/cloud9 /lib/systemd/system/cloud9.*
sudo systemctl daemon-reload                  
sudo systemctl stop bonescript-autorun.service bonescript.service bonescript.socket
sudo systemctl disable bonescript-autorun.service bonescript.service bonescript.socket
sudo rm -rf /lib/systemd/system/bonescript* /usr/local/lib/node_modules/bonescript
sudo systemctl daemon-reload
sudo apt remove -purge apache2* nginx*
cd /opt/
rm -rf *
sudo apt autoremove

This tutorial is a designated “Invariant Section” of the “Technotronic” section of Haack's Wiki as described on the Start Page. This does not include the sections quoted from Jason's tutorial.

oemb1905 2020/02/02 20:55

computing/beaglebone.txt · Last modified: 2020/02/02 20:55 by oemb1905