====== MINIBIAN ====== The //standard// OS for the Raspberry Pi certainly is [[https://www.raspbian.org/|Raspbian]], since it is the Foundation’s official supported operating system. Although it allows anyone to get their RasPi up and running in no time and without a hassle, one must not forget that it's also a tool that was developed in a defined philosophy. As stated by [[https://minibianpi.wordpress.com/2013/07/04/minibian-minimal-raspbian-image-for-raspberry-pi/|MINIBIAN's creator Luca Soltoggio]]: > the [Raspberry Pi] project was born primarily to provide a low cost computer in education and in the countries in the developing world. This is perfectly fine, and following this logic it's perfectly understandable that since the Jessie version of Raspbian, it boots straight into the desktop GUI (version 3 of GTK+ / LXDE), see [[https://www.raspberrypi.org/blog/raspbian-jessie-is-here/|this raspberry.org article]] which clearly states the //philosophy// that lies behind the Raspbian releases. What the Pi's project founders probably didn't imagine is the fact that their creation would also become > a perfect tool for many makers across the world, who would be able to use it as a powerful, flexible and low cost **embedded system**. And there lies an enormous difference in expectations! An //educational// system environment requirements have little to do with an //embedded// system requirements. As this is an entirely different //philosophy//, one could of course start from scratch and install, let's say an [[https://archlinuxarm.org/|ArchLinux]] system on their RasPi.\\ But bear in mind that the ARM architecture isn't as //standard// (yet) as the Intel x86 (for example). Thus you might find yourself loosing some (much) time getting the right library/package to do the job. And the [[https://www.raspberrypi.org/|Raspberry foundation]] has made a tremendous job at bringing a viable environment for their platform. As many others now exist but don't come close to the level of usability the RasPi is offering nowadays. This is why the [[https://minibianpi.wordpress.com/about/|philosophy lying behind MINIBIAN]] is attractive. The point being to keep the basics from the //official Raspbian releases//, using a customized Raspbian installation, minimizing it's footprint, booting in some seconds and using as little //precious// RAM as possible. Thus guarantying a smooth experience, compatible with most of the existing software and references available for Raspbian. ===== Installation ===== First we'll need to download the MINIBIAN image, which is available from [[https://sourceforge.net/projects/minibian/|sourceforge.net]] or using this [[http://188.226.145.236/2016-03-12-jessie-minibian.tar.gz.torrent|torrent file]]. ==== Checksum ==== I won't start a discussion about the need of being careful about security, all I will say is that it is **highly recommended** to verify the authenticity of your downloaded file. This can easily be done by verifying it's checksum available on the official [[https://minibianpi.wordpress.com/download/|MINIBIAN download page]] <Code:bash |Verify the sha1 checksum of your download:> > sha1sum /path/to/your/minibian/yyyy-mm-dd-jessie-minibian.tar.gz </Code> Compare this with the value given [[https://minibianpi.wordpress.com/download/|on the Minibian download page]] ==== Setup ==== We'll now follow the setup procedure that's recommended on [[http://elinux.org/RPi_Easy_SD_Card_Setup#Using_the_Linux_command_line|elinux.org]]: <Code:bash> > cd /path/to/your/minibian/ > tar xvf yyyy-mm-dd-jessie-minibian.tar.gz </Code> Now identify the SD Card you want to use. Run the ''lsblk'' command once //**before**// you insert your SD Card into a card reader port, on once //**after**//, the difference in output should clearly show you the identification of the SD Card: <Code:bash | Before the SD Card is inserted:> > lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931.5G 0 disk ├─sda1 8:1 0 2G 0 part [SWAP] ├─sda2 8:2 0 20G 0 part / └─sda3 8:3 0 909.5G 0 part ├─vg01-opt 254:0 0 20G 0 lvm /opt └─vg01-home 254:1 0 889.5G 0 lvm /home sr0 11:0 1 1024M 0 rom </Code> <Code:bash | After the SD Card is inserted:> > lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931.5G 0 disk ├─sda1 8:1 0 2G 0 part [SWAP] ├─sda2 8:2 0 20G 0 part / └─sda3 8:3 0 909.5G 0 part ├─vg01-opt 254:0 0 20G 0 lvm /opt └─vg01-home 254:1 0 889.5G 0 lvm /home sr0 11:0 1 1024M 0 rom mmcblk0 179:0 0 14.7G 0 disk ├─mmcblk0p1 179:1 0 1.1G 0 part ├─mmcblk0p2 179:2 0 1K 0 part ├─mmcblk0p5 179:5 0 32M 0 part ├─mmcblk0p6 179:6 0 63M 0 part └─mmcblk0p7 179:7 0 13.4G 0 part </Code> In this case our target will be ''/dev/mmcblk0''. Now we make sure all its partitions are unmounted and copy our image file to the SD Card (in this case, monitoring the dd progress through ''pv''): <Code:bash |Copy the img file to the SD Card> > sudo umount /dev/mmcblk0p1 /dev/mmcblk0p2 /dev/mmcblk0p5 /dev/mmcblk0p6 /dev/mmcblk0p7 > sudo dd bs=4M if=yyyy-mm-dd-jessie-minibian.img | pv | dd of=/dev/mmcblk0 198+1 records in[3.95MiB/s] [ <=> ] 198+1 records out 832569344 bytes (833 MB) copied, 356.034 s, 2.3 MB/s 794MiB 0:05:56 [2.23MiB/s] [ <=> ] 1626112+0 records in 1626112+0 records out 832569344 bytes (833 MB) copied, 359.634 s, 2.3 MB/s </Code> Note: remove the ''| pv |'' pipe part of the code if you don't wish to monitor the dd progress. Finally, let's safely eject the card using ''sync'' to ensure the write cache is flushed and that it is safe to unmount the SD card: <Code:bash |Safely eject the SD Card> > sudo sync </Code> ===== Resize the SD Partition ===== To use the full space available on the SD card, we'll need to extend the initial Minibian partition size, this operation is detailed on [[https://minibianpi.wordpress.com/how-to/resize-sd/|the following page of the Minibian website]] <Code:bash |Using fdisk to resize the SD partition size:> > sudo fdisk /dev/mmcblk0 Welcome to fdisk (util-linux 2.25.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/mmcblk0: 14.7 GiB, 15716057088 bytes, 30695424 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 16 125055 125040 61.1M b W95 FAT32 /dev/mmcblk0p2 125056 1626111 1501056 733M 83 Linux Command (m for help): d Partition number (1,2, default 2): 2 Partition 2 has been deleted. Command (m for help): n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): p Partition number (2-4, default 2): 2 First sector (125056-30695423, default 126976): 125056 Last sector, +sectors or +size{K,M,G,T,P} (125056-30695423, default 30695423): 30695423 Created a new partition 2 of type 'Linux' and of size 14.6 GiB. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. </Code> To complete the operation, we still have to effectively enlarge the file system for it to take up he available complementary partition space: <Code:bash |Enlarge the File System to the full partition size:> > sudo e2fsck -f /dev/mmcblk0p2 e2fsck 1.42.12 (29-Aug-2014) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mmcblk0p2: 15631/46944 files (0.2% non-contiguous), 120088/187512 blocks > sudo resize2fs /dev/mmcblk0p2 resize2fs 1.42.12 (29-Aug-2014) Resizing the filesystem on /dev/mmcblk0p2 to 3821296 (4k) blocks. The filesystem on /dev/mmcblk0p2 is now 3821296 (4k) blocks long. </Code> ===== Startup Your RasPi ===== Insert the SD Card in the RasPi and power it... If you're using a model 3 Pi, you might experience an error reported at startup looking like: <Code:bash |Startup log error:> cfg80211: Calling CRDA to update world regulatory domain ... cfg80211: Exceeded CRDA call max attempts. Not calling CRDA. </Code> This seems to be because the CRDA package is not installed by default, installing the following seems to fix this: <Code:bash |Install crda & wireless packages> > apt-get install crda iw wireless-regdb > reboot </Code> === Transfer your SSH public key === Now is a good time to transfer your ''~/.ssh/id_rsa.pub'' key to the RasPi so you'll be able to SSH in without having to enter a password every time, from your workstation type: <Code:bash |Transfer your SSH public key:> > ssh-copy-id root@you.mini.bian.ip </Code> The IP of your installation is displayed in red during the boot sequence. ===== WiFi ===== **NOTE**: the following is based on RasPi 3 model experimentation, you might need to install some specific packages for your hardware. In order to enable Wifi and Bluetooth on the new Raspberry Pi 3, one need to install some complementary packages as follow: <Code:bash |Install WiFi & Bluetooth packages:> > apt-get update > apt-get install firmware-brcm80211 pi-bluetooth wpasupplicant wireless-tools </Code> To configure and use the WiFi network, you can scan for available SSIDs using: <Code:bash |Scan available WiFi networks> > iwlist scan Cell 02 - Address: 30:91:8F:15:C7:F7 Channel:8 Frequency:2.447 GHz (Channel 8) Quality=36/70 Signal level=-74 dBm Encryption key:on ESSID:"My-WiFi-SSID" Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s 24 Mb/s; 36 Mb/s; 54 Mb/s Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s Mode:Master Extra:tsf=0000000000000000 Extra: Last beacon: 70ms ago IE: Unknown: 0007444D5F62626F78 IE: Unknown: 010882848B962430486C IE: Unknown: 030108 IE: Unknown: 2A0100 IE: Unknown: 2F0100 IE: IEEE 802.11i/WPA2 Version 1 Group Cipher : CCMP Pairwise Ciphers (1) : CCMP Authentication Suites (1) : PSK IE: Unknown: 32040C121860 IE: Unknown: 2D1A1C1......000000 IE: Unknown: 3D16080......000000 IE: Unknown: 7F08040......0000040 IE: Unknown: DDAB005......000120 IE: Unknown: DD09001......0C0000 IE: Unknown: DD18005......322F00 </Code> You still need to modify 2 files: <Code:bash |/etc/network/interfaces> > nano /etc/network/interfaces </Code> <Code:bash |/etc/network/interfaces> ... allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf </Code> <Code:bash |/etc/wpa_supplicant/wpa_supplicant.conf> > nano /etc/wpa_supplicant/wpa_supplicant.conf </Code> <Code:bash linenums:1|/etc/wpa_supplicant/wpa_supplicant.conf> network={ ssid="YourSSID" psk="YourPassword" } </Code> Here, we use the ''manual'' setting with ''wpa-roam'', this [[http://raspberrypi.stackexchange.com/questions/9257/whats-the-difference-between-wpa-roam-and-wpa-conf-in-the-etc-network-inte|stackexchange thread]] seems to imply that this configuration should suspend the WiFi when the Ethernet cable is plugged and vice-versa. On the contrary, using ''manual'' with ''wpa-roam'', (this hasn't been tested by myself). Nevertheless, using the above settings had **both WiFi and Ethernet** activated at the same time. There is more to learn in this article about [[http://manual.aptosid.com/en/inet-setup-en.htm|Setting up for WiFi Roaming with wpa]]. ===== Bluetooth =====