Login Register



(Reading time: 2 - 3 minutes)

Using Your Raspi in Headless Mode

What it means to be in Headless Mode.

This means the Raspi is NOT connected to a keyboard,monitor, or mouse.

How can you use the Raspi if you are not connected to it?

The way this works is that you connect from another computer, either a desk top or a laptop through Secure Shell or SSH. During the initial setup you should have selected the SSH option from the raspi-configure window and turned it on.

What if you do NOT have a monitor or keyboard?

Luckily you can still set up SSH using your laptop or desktop computer system. The way you will do this is as follows:

  1. After you have installed the operating system on the new SD-card and it is still in your other computer open a file manager of your choice and look for a directory called “boot”. Do a “cd” to change to that directory. Once in that directory create an empty file using the command “touch ssh”. Now insert this card into your Raspi and power it up by connecting the power supply. Because that “ssh” file exists your Raspi will now have SSH enabled and you can access it from your other computer provided you know the Raspi’s IP address.

  2. There are several ways you can discover the Raspi’s address:

    1. Make sure that your Raspi is connected to the same network as your other computer. If you other computer is running Linux (as it should be) just enter the following command from a terminal “nmap -sn 192.168.1.0/24 (or 192.168.0.0/24 depending on how your router is configured)”. You may have to use “sudo” in front of the above command. When I ran the command with the sudo it showed the ip addresses and the words (Raspberry Pi Foundation) for 3 of my Raspis.

    2. You can also try the command “ping raspi” or “ping raspberrypi”. However neither of these commands worked on my systems, maybe because I had already changed the names of my Raspis.

Now from a terminal on your other computer enter the command “ssh This email address is being protected from spambots. You need JavaScript enabled to view it. or whatever the ip address what that you found in the above steps. It will now ask for your Raspi password. Enter it and do whatever you need to do on the Raspi.

(Reading time: 2 - 3 minutes)

Change your location.

This article will show you how to change your location data in the new Raspi.

Using the Raspi configuration tool.

  1. Select option #4 Localisation Options from the main menu screen.

  2. Press the Tab Key” to select “OK” and then press the “Enter key” at the end of each step to proceed to the next step.

  3. Select option #I1 Change Local

    1. If not in the UK scroll down to the item that has a ”* en_GB.UTF-8 UTF-8” in it and press the space bar to remove the “*”.

    2. Scroll up or down to find your language and location. Mine is en for English and US for US and then UTF-8. I would then press the space bar to select this location.

    3. The next screen that pops up will ask you to select another option. I would select en_US.UTF-8 as I am the only user and speak that language. Read the statement at the top of the screen if more people will use your Raspi and they speak a different language.

    4. It will then take you back to the main menu.

  4. Repeat #1

    1. Select I2 Timezone

      1. Select your area from the list provided and press “Enter”

      2. Select your city or region from the list provided. Press the first letter of the city or region and it will take you to the part of the list that starts with that letter. Then scroll up or down to select the nearest city or region to where you are.

  5. Repeat #1 again.

    1. Select I3 Change Keyboard Layout.

    2. Select your keyboard from the list provided. If your exact keyboard is not shown, select one that is close to it. Mine is a “Rapoo” keyboard which is not on the list so I select “Dell 101-key PC and this works for me.

    3. The next screen to pop up lists a lot of English(UK) keyboards and at the bottom of the list there is “Other” which is what I choose as I do not have UK keyboard.

    4. The next screen lists many different languages and I select “English (US).

    5. Now it lists many different English (US) keyboards so I scroll to the top of the list where it says “English (US).

    6. It now lists “AltGr” keys. Read the statement at the top of the screen to see what this means. I select “No AltGr key”.

    7. Now comes something about a “Compose Key”. I select “No Compose Key”.

  6. Repeat #1 once again.

    1. Select I4 Change Wi-Fi Country.

    2. It will now give you a list of countries for you to check yours to set the country where the wi-fi will be used. It will show you the country you have selected and after selecting OK it will take you back to the main menu. This ends the setting of the localization settings. You should now change your password.

(Reading time: 3 - 6 minutes)
Popular

Initial Setup of a new Raspi

This article will explain how to do an initial setup of your new Raspberry Pi computer.

Items you will need

  1. A Raspberry Pi computer (any model)

  2. A power source (one as specified for your model)

  3. A keyboard & mouse (optional) I will show you later how you can setup your computer without having either these or the monitor. This is known as using it HEADLESS from another computer either your desktop or laptop.

  4. A HDMI monitor (optional)

  5. A case (optional)

  6. A device for burning (loading the software) to a micro-SD card, either internal or external. I have one that looks like a snowman and plugs into a USB port.

  7. If no software is included on a micro-SD then you will need a blank one or one that can be reformatted.

  8. Download Operating System software from the Raspberry Pi download page .

  9. Software for burning the operating system to the micro-SD card. I use a program from https://www.balena.io/etcher/ called Etcher. It is available for Linux and the 2 other unmentionable operating systems.

  10. After the software is loaded on the micro-SD insert in to the Raspi computer with the contacts facing up. Then connect the power supply. If you are using a monitor you will see a lot of lines scroll up on the screen. You will then see a menu if using the Graphical User Interface (GUI) with the Raspian/Buster software.

  11. On the upper left will be a icon of a raspberry.

    1. Click on that and scroll down until you see a menu item called “Raspberry Pi Configuration”.

  1. Dec 23, 19 On the “Localisation tab” you should set all 4 of the items for your local area. Today I discovered a problem with my Raspi is that if you live in any country other than the UK, you should NOT change the password first if you use special characters in your password. You should first change “Location/Keyboard” from the Raspberry Pi Configuration or sudo raspi-config if in the terminal mode, to your current location and then change your password. The reason for this is that the default keyboard is set to a UK location and some of the keys are different on the UK keyboard from keyboards from other countries. I found this out the hard way as I changed my password and then the keyboard location and was NOT able to log in again as I use some special characters in my password. For information on how to do this see: Chapter 14.

  2. The next item you should select is “Change Password” and enter your own secure password.

  3. Another item you will see is “Boot”. This will allow you to select where you want it to boot to when it is turned on. It will be either “Desktop” or CLI which means “Command Line Interface”, or to the terminal. This option will only be available if you install Buster-Full or Buster-Desktop. Buster-Lite does not have a “Desktop” to start, only a CLI.

  4. On the “Interfaces tab” I generally select “SSH Enabled” so I can connect with my laptop to the Raspi. This is required if you plan to use your Raspi in the headless mode. If you have a camera attached to the Raspi you could also check the enabled button for that.

  5. You can go back to this menu option at any time in the future if you need to change any of the items by clicking on the “Raspi Configuration” menu option or from a terminal enter sudo raspi-config.

  6. You might want to check out the other options presented on the menu. After you have made your changes it will ask if you want to reboot. In order for your changes to take effect it will require you to reboot so just select “Yes”.

  7. Also on the top line menu will be a small black box with a “>_” in it and if you mouse over it it should show the word “Terminal”. Click on this and it will open a terminal screen or more than one screen. I close all of the extra ones by clicking on the X in the upper right corner. You should then enter “sudo apt update”. It may ask for your password, if so enter it. It will then display a number of lines of text, which will scroll by too fast to be read so don’t worry about them. It will then show either a number of applications to be upgraded or say “All applications are up to date.”, which means you are good to go. If it shows a number to be upgraded enter “sudo apt upgrade -y”. It will then do the upgrade. If it is the first time this is done there will probably be a lot to upgrade so it will take awhile. These commands should be run on a regular basis as there are generally new upgrades being published on a regular basis. You can then close the terminal window and do whatever you need to do.

As an additional security option you should perform the following in a terminal window

  1. Enter sudo add new user name. You will then be asked for a password. You should then enter sudo adduser new user name sudo. This will add the new user to the sudoers group so you can perform root actions. Then log out and log back in again as the new user. Then enter sudo visudo. The first time you run this command it will ask which editor you want to use. I generally choose “nano”. Scroll to the end of the file and enter new user name ALL=(ALL) NOPASSWD: ALL Press CTL_X, Y and ENTER to close and save the file. When you enter a sudo command it will no longer ask for your password. This is optional as it will lessen security but will increase productivity.

  2. You should now delete the PI user with the following command: sudo userdel pi as this improves security if the bad guys try to log in as pi and it is no longer there.

Summary

You should now have your Raspi up and running with a lot to learn about it and how it can help you with your daily computer tasks. One thing to remember is the Raspi has a limited amount of memory and the processor is not as fast as your laptop or desktop computers. This means it could crash more often if you have a lot of windows open and any action will take longer due to the slower speed. Supposedly the model 4 has eliminated some of these problems.