Introduction
This is the chapter web page to support the content in Chapter 3 of the book: Exploring Raspberry Pi – Interfacing to the Real World with Embedded Linux. The summary introduction to the chapter is as follows:
This chapter exposes you to the core concepts, commands, and tools required to effectively manage the Raspberry Pi embedded Linux system. The first part of the chapter is descriptive; it explains the basics of embedded Linux and the Linux boot process. After that, you learn step by step how to manage Linux
systems. For this exercise, you are strongly encouraged to open a terminal connection to your Raspberry Pi or a terminal window on the Raspberry Pi and follow along. Next, the chapter describes the Git source code management system. This topic is an important one because the source code examples in this book are distributed via GitHub. Desktop virtualization is also described; it is useful for cross-platform development in later chapters. The chapter finishes by describing how you can download the source code examples for this book.
Learning Outcomes
After completing this chapter, you should be able to:
- Describe the basic concept of an embedded Linux system.
- Describe how an embedded Linux device, such as the RPi, boots the Linux OS.
- Describe important Linux concepts, such as kernel space, user space, and system initialization using systemd.
- Perform Linux system administration tasks on the RPi.
- Use the RPi file system effectively.
- Use a range of Linux commands for file and process management.
- Manage your own software development projects using Git.
- Install a Linux distribution on your desktop computer host OS using desktop virtualization tools, such as VirtualBox.
- Download the source code for this book using Git.
Useful Additional Content
VirtualBox: Installing a Linux Guest under a Windows Host OS
Here are some tips on installing a Linux guest VirtualBox VM under a Windows host:
- Enable VT-x/AMD-V in the system BIOS settings of your physical computer in order to run a 64-bit guest OS.
- Install VirtualBox (virtualbox.org) on your host OS.
- Download your favourite Linux distribution as an ISO file. In this book 64-bit Debian is used. Download the Net debian-jessie-DI-rc1-amd64-netinst.iso or equivalent from the page www.debian.org/releases/. Do not use the ia64 branch unless you are using a high-end Itanium-based server. Important: see note at the top of the page about Debian Wheezy.
- Start Oracle VM VirtualBox Manager and choose New. If available, give the installation 2GB+ memory. Create a virtual hard drive (VDI format, dynamic allocated) and make the size much greater than the 8GB it recommends. Choose the location on your computer to store the disk and use a minimum of 25–30GB! It is difficult to resize a disk after the fact. If you choose “dynamically allocated”, it will only occupy real disk space when you fill the Linux disk, so feel free to choose a large disk size.
- You now have a new VM that is powered off. Select it and click on settings. Under storage you should see your VDI (under SATA) and an “Empty” entry (under IDE). Select the “Empty” entry and click the disk icon under Attributes. Find and select the Linux ISO file that you downloaded, as shown in the figure below.
Figure 3-1: The VirtualBox VM configuration pane
- Start your VM and install Linux by booting off the virtual drive. If you see a message “No Boot Device,” go to Settings System and disable the floppy drive.
- Once your guest OS is running, choose Devices Install Guest Additions from the menu bar of your VirtualBox window. If all goes well, you will now be able to resize the window and cut-and-paste text between the host and guest OSs (by enabling Devices ⇒ Shared ⇒ Clipboard Bidirectional).
- Choose “Devices”->”Insert Guest Additions CD image…”
- If the guest additions do not install automatically, follow these steps (for Debian desktop — tested on Wheezy and Jessie images) in a terminal window:
1 2 3 4 5 6 7 |
molloyd@debian:~$ su - root@debian:~# apt-get update root@debian:~# apt-get install build-essential module-assistant root@debian:~# m-a prepare root@debian:~# cd /media/cdrom root@debian:~# sh ./VBoxLinuxAdditions.run root@debian:~# reboot |
- With your network settings set as NAT on Adapter 1 (default setting) you should now be able to ping 192.168.7.2 (your BBB when using Internet-over-USB), or its equivalent network IP address (if connected by regular Ethernet).
If you go to the VirtualBox System ⇒ Processor settings, you will see the number of cores that can be allocated to the guest OS. On an Intel i7 processor you will see either 16 or 24 as the upper limit, depending on your exact processor. On a 4-core processor, you will see one core per thread, so 8 “real” cores, and you will also see that number again in “virtual” cores. Do not use virtual cores, as they will be provided through time slicing and your machine may slow down considerably. The maximum number of cores you should allocate to your guest OS is the total number of real cores minus one.
VirtualBox: Useful Tools – Cairo Dock
The latest windowing interface for Debian Jessie contains some very nice features, but it is quite lean. One tool that is useful and will be familiar to Mac OS X users is the Cairo Dock. It is illustrated in Figure 2-A2 below. You can install it using the following step:
1 |
molloyd@DebianJessieVM:~$ sudo apt-get install cairo-dock |
Figure 2-A2: The Cairo Dock in action under Debian 8 (Jessie)
Debian 8 Jessie uses Gnome 3. To start up this dock automatically on boot you can perform the following steps:
1 |
molloyd@DebianJessieVM:~$ gnome-tweak-tool |
And then click “Startup Applications” on the left-hand menu. On the right-hand pane click on the “+” icon and add Cairo-Dock to the list.
External Resources
Recommended Books on the Content in this Chapter
Errata
None for the moment
I’m running Debian Jessie and cannot install VBox Guest Additions.
apt-get install build-essential module-assistant – causes Bash to ask for CDROM Debian install disk, which I don’t have.
m-a prepare – Bash responds with m-a command not found.
I’ve followed the book and this chapter’s installation guidance exactly. What am I doing wrong?
I figured out what’s wrong. In the source.list file, the first line pointed to the CDROM. After deleting this line, I was able to install the packages required.
Thanks John, That is very useful to know. Derek.
I cant get VBox Additions to Run to run, which source list file? I get a note saying it contains software that will automatically started, click run, get Oops unable tom locate the program. tried running .sh files and get command not found.
Also link above https://www.exploringrpi.com/chapter3/www.debian.org/releases/ needs to be fixed to http://www.debian.org/releases/
debian-jessie-DI-rc1-amd64-netinst.iso is not listed, but I assume the low end install netlist is required, the one offered was debian-8.5.0-amd64-netinst.iso
After installation, other desk tops? and Grup? for those first time Linux users, I assumed no other install and boot loader to send drive it created
Ok, apologies for reading too fast..
•If the guest additions do not install automatically, follow these steps (for Debian desktop… ) above was missed
only difference was my CD was cdrom0
last couple of notes and watch out, I had openelec open when it tried to remote connect, so I used its userid and password, worked great, however when i converted it back to rasp remote would not connect, I think it caches the key, which I the same I think is the same for both systems although it does not like that with user names an passwords, Tried putty and other they work as long as you don’t cache the key
I opened up the hidden fills and deleted all the Vinagre configuration and the .ssh that got me back to square one.
Thanks Ed for those posts, very useful additional information. Kind regards, Derek.
When I use this command: sudo systemctl isolate multi-user.target
I lose control of RPi. SSH freezes on the romote PC. If done locally the display shows a single “_” and there is no response to the keyboard. Powering down/up is the only way to get control back.
Any solution to make RPi headless from a remote location.
Regards,
John
Hi John,
That is strange. I just tried it there using SSH and it seems to be okay:
Please let me know if you worked out what is happening. Kind regards, Derek.
Has something changed with how the Jessie distro for RPi deals with secure web access? Specifically, I can no longer clone to the Pi using git. When I try to clone the code for the book I get:
“fatal: unable to access ‘https://www.github.com/derekmolloy/exploringRPi.git/’: gnutls_handshake() failed: The TLS connection was non-properly terminated.”
The same error results when I try to clone from a repo on my own git account, and it is definitely something that changed recently, probably with an apt update or upgrade, to one of my RPi 3 boards. I have worked with this board and install for several weeks and performed clones, pushes and pulls without issue, until now. As a test, I also tried using IceWeasle through a VNC connection to the Pi. It connects fine to any non-secured (“http://…”) sites, but fails trying to connect with any “https://…” sites, such as google. The error returned is:
“Error performing TLS handshake: GnuTLS error.”
As another test I made sure secure web access worked from the Debian VM I am connecting to the Pi with and everything works fine, suggesting it is something that changed on the Pi. I have other Pi boards (B+, 2 and 3) that all work fine but I have not run apt upgrade recently on any of them.
Any idea what might be happening here and how I might fix it? I’ve searched around the web for the error but find mostly references to issues with emacs or Linux server installation issues that didn’t help.
Thanks,
Mitchell
Hi Mitchell, I have not idea what is going wrong. There seems to be a stray “/” at the end of the the URL (i.e., “exploringRPi.git/”) but that is likely not the issue. It looks like a firewall problem, but I can’t see why your firewall would allow traffic from the Debian VM and other RPis, but not that upgraded Pi board. You may need to update your SSL certificates. I think it is something like
sudo update-ca-certificates
on the RPi but I don’t remember the exact syntax. Please let me know if you solve this. Thanks, Derek.I’ve got the serial connection going with PuTTY because I wanted to see the console output while booting. I was disappointed to see very little output. Apparently this newer version Raspberrian I have has silenced much of the output due to community feedback. I read a bit and discovered that the output can be turned back on by editing the /boot/cmdline.txt file and removing the word “quiet” from the text. Once removed I get a very satisfying dump of boot data. Apparently the amount of data can be further adjusted by adding “loglevel=x” where x can be a number from 1 to 5 (I believe 5 is the top limit). Unfortunately I can’t find any useful documentation on loglevel.
Hi,
When I typed this command in the terminal window “sudo systemctl isolate multi-user.target’, the terminal window freezes.
After that I can no longer ping the address, I get the message as “Host is Down”.
I tried ssh and it freezes again, and after a wait of 2 -3 mins I get a message saying “Operation timed out”. Tried powering on and off a few times but i can’t connect to the RPI3.
Could you please help?
Thanks
Hi,
Is there any solution on “sudo systemctl isolate multi-user.target”? I tried connecting the raspberry pi to the TV, but see no display as well. I can see the LED light for the SD card activity blinking. But nothing on the TV screen and cannot connect through the network.
Thanks,
I had the same issue. I entered the command on my ssh terminal and the connection closed. I had to unplug the power from the RPi and plug it back in in order to restart it, then it went back to the graphical target and I was able to ssh back into it.
Curious to see what might be the cause.
Errata: top of page 78 stat example, You can update the access and modify times artificially using touch -a text.txt
Should be test.txt
Current Raspbian has no .dtb files but .dtbo in the /root/overlays directory
What does these commands do?
root@debian:~# apt-get install build-essential module-assistant
root@debian:~# m-a prepare