Difference between revisions of "RPi raspi-config"

From eLinux.org
Jump to: navigation, search
(Created page with "This article applies to the Wheezy Raspbian official release of 15/7/2012. raspi-config was introduced with the advent of the Debian Wheezy image. It helps you configure your Pi...")
 
(Present tense, moved some historical stuff)
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
This article applies to the Wheezy Raspbian official release of 15/7/2012.
+
The raspi-config script helps you to configure your Pi.
  
raspi-config was introduced with the advent of the Debian Wheezy image. It helps you configure your Pi. It is a work in progress so the number of menu items and the ease of use of those items will increase with time. If anyone feels willing and able to improve raspi-config then please contact Alex Bradbury [https://github.com/asb/raspi-config].
+
== The raspi-config script ==
  
== The raspi-config ==
+
When you start your Pi the display shows the output from each of the start-up scripts (as lots of scrolling text). If starting for the first time using a new image you are logged in as a root user, and the raspi-config menu will then appear. It can also be started at any time from the command line or from a terminal window (see below).
  
When you start your Pi for the first time using the Wheezy image then, following lots of scrolling text with a couple of pauses lasting in total a few tens of seconds, the raspi-config menu will appear. It has the following entries:
+
It has the following entries (this is the layout from the Raspian 2012-12-16 image. It may be different on other images):
 +
 
 +
Raspi-config
 +
 
 +
info                Information about this tool
 +
expand_rootfs      Expand root partition to fill SD card
 +
overscan            Change overscan
 +
configure_keyboard  Set keyboard layout
 +
change_pass        Change password for 'pi' user
 +
change_locale      Set locale
 +
change_timezone    Set timezone
 +
memory_split        Change memory split
 +
ssh                Enable or disable ssh server
 +
boot_behaviour      Start desktop on boot?
 +
update              Try to upgrade raspi-config
 +
 
 +
    <Select>                    <Finish>
  
info Information about this tool
 
expand-rootfs Expand root partition to fill SD card
 
overscan Change overscan
 
configure-keyboard Set keyboard layout
 
change_pass Change password for ‘pi’ user
 
change_locale Set locale
 
change_timezone        Set timezone
 
memory_split Change memory split
 
ssh Enable or disable ssh server
 
boot_behaviour        Start desktop on boot?
 
update                Try to upgrade raspi-config
 
<Select> <Finish>
 
  
 
== Moving Around the Menu ==
 
== Moving Around the Menu ==
  
At any point from within any of the menu or sub-menu options the Tab key will toggle about the selected entry and the options at the bottom inside angle brackets, cursor keys move up and down menus. There is an exception to this and that’s with the change_locale option, ignore that exception for now it’s covered later.
+
It looks like its running as a graphical application but in fact it isn't; its using the command line and graphical tools for the layout of the text. Cursor up/down keys move the highlight up and down menus.
  
Some of the menu entries take quite a while to display. The user experience looks like its running a desktop but in fact it isn't; its using the command line and its graphics capabilities (remember VDU's?) so occasionally the screen will scroll a bit.
+
At any point from within any of the menu or sub-menu options the Tab key will switch from the selected menu entry and the "buttons" at the bottom (inside angle brackets). So, move the highlight to the menu option you want to use, press Tab, then press Return.
  
 +
Some of the menu entries take a while to read configuration information before they change what is displayed. Be patient.
  
 
== What raspi-config does ==
 
== What raspi-config does ==
  
Some menu entries modify the file /boot/config.txt. This file, out of the box, contains a number of commented out configuration entries; raspi-config adds entries at the end of this file. You can see what raspi-config has done to the file by viewing it on the Pi using Leafpad and, if you really mess things up you can edit the file from the SD card using Notepad on a Windows PC. More information on editing config.txt here [[R-Pi_ConfigurationFile]]
+
Some menu entries modify the file /boot/config.txt. This file, out of the box, contains a number of commented out configuration entries; raspi-config adds entries at the end of this file. You can see what raspi-config has done to the
 +
file by viewing it on the Pi using Leafpad. More information on editing config.txt here [[R-Pi_ConfigurationFile]]
  
Other entries modify Linux configuration files, some take effect immediately, others at the next boot.
+
Other entries modify Linux configuration files. Some take effect immediately, others at the next boot.
  
 +
== Running raspi-config another time ==
  
== INFO - Information About This Tool ==
+
Following the first boot, your raspberry pi will boot into the command prompt or desktop (you choose in raspi-config). You can run it at any time after that from the command line or in a terminal window by typing (case sensitive):
  
This would be really helpful if it actually explained the options in the menu, hopefully at least it will provide a reference to this Wiki page.  
+
  sudo raspi-config
  
It helpfully advises you may have difficulties if you have heavily customized your installation but as this is probably the first thing a rookie is going to see the likelihood of a heavily customized installation is small.
+
The sudo (do as superuser) is necessary because you will be changing files that you as user pi do not own.
  
raspi-config appears automatically at first boot. You can run it at any time after that by typing sudo raspi-config (case sensitive) at the command line or in a terminal window. The sudo (do as superuser) is necessary because you will be changing files that you as user pi do not own, its Debian's way of providing a root login.
+
== Menu Options ==
  
The lovely thing about the Pi is that, if you mess up, it will not be difficult to re-image.
+
Here is a description of each menu entry.
  
 +
=== info - Information About This Tool ===
  
== EXPAND-ROOTFS - Expand Root Partition to Fill SD Card ==
+
It helpfully advises that it is for initial configuration, and can be run at any time. You may have difficulties if you have heavily customized your installation as the changes it makes might not be correct if what it attempts to change is not what it expects.
  
This does what it says on the tin so if you have installed Wheezy on a 4GB or greater card use this option and AFTER REBOOT it will use all of the SD card. The Wheezy image takes nearly 2GB so if you are going to install additional software or large files its worth doing, however you don't need to do it on first boot. The downside of using all of a larger card is that it takes much longer to backup the image.
+
=== expand_rootfs - Expand root partition to fill SD card ===
  
 +
The usual distribution images are 2 GB. When you copy the image to a larger SD card you have a portion of that card unused. This option expands the initial image to expand to fill the rest of the SD card, giving you more space. You need to reboot the Raspberry Pi to make this available. THERE IS NO CONFIRMATION - SELECTING THE OPTION EXPANDS THE PARTITION.
  
== OVERSCAN - Change Overscan ==
+
=== overscan - Change overscan ===
  
What would you like to do with overscan
+
Old photographs had a border round the outside to allow for handling and mounting. Old TV sets had a significant variation in the size of the picture it produced; some had cabinets that overlapped the screen. Like the photographs, the TV pictures were given a black border so that none of the picture was lost. This is called overscan. Modern TVs and monitors don't need, and the signal doesn't have, the border. If the initial text shown on the screen disappears off the edge you need to enable overscan to add back the border.
<Disable>                      <Enable>
+
  
Any changes will take effect after a reboot. If you change a setting and end up losing the left side of the screen you can easily edit /boot/config.txt on a PC to undo the changes.
+
Any changes will take effect after a reboot. You can have greater control over the settings by editing boot/config.txt.
  
Televisions do not usually display the whole of the picture, they Overscan and crop off a few percent of the image. This is to hide the data signals such as teletext which use the outer lines of the picture (could be a hangover from analogue TV). Computers, including the Pi, use all the lines for real display so often the image displayed by computers on TV's is cropped.
+
On some displays, particularly monitors, just disabling Overscan will make the picture fill the whole screen and correct the resolution. For other displays it may be necessary to leave overscan enabled and adjust the Overscan values, more information here [[R-Pi_Troubleshooting#Big_black_borders_around_small_image_on_HD_monitors]].
  
To avoid losing the critical left column at first boot the clever Pi people have deliberately enabled Overscan and used positive Overscan vlauses to make the displayed image smaller, and to play safe much smaller. This means, depending on your monitor/TV, there may be black borders around the picture. LXDE will show the wrong resolution in its display information as it shows you the size of the framebuffer (display_size - overscan).
+
=== configure-keyboard - Set keyboard layout ===
  
On some displays, particularly monitors, just disabling Overscan will make the picture fill the whole screen and correct the resolution. For other displays it may be necessary to leave overscan enabled and fiddle with Overscan values, more information here [[R-Pi_Troubleshooting#Big_black_borders_around_small_image_on_HD_monitors]].
+
This option selects the keyboard being used, so that the characters produced are the same as those typed (important examples are # and /). It is slow to display, while it reads all the keyboard types. Changes usually take effect immediately, but may require a reboot.
  
 +
Brands of keyboards are chosen first followed by other choices to set up the nationality of the keyboard. The default is a Generic 105-key (Intl) PC. If you cannot find your keyboard on the list then use one of the generic keyboards. Check [http://en.wikipedia.org/wiki/Keyboard_layout | this page] for most keyboard layouts. The next screen gives the keyboard layout. If you are not using the first choice of English UK select Other and you will be faced with a long list of other national keyboards.
  
== CONFIGURE-KEYBOARD - Set keyboard layout ==
+
You then select specific options:
 +
* No AltGr key
 +
* No compose key
 +
* Shutdown XServer (use [Ctrl][Alt][Backspace] all pressed at the same time)
  
Slow to display and, if you select some of the non-default options, there will be a short delay while changes are made. Changes take effect immediately except for changes to X-server exit which require a reboot.
+
=== change_pass - Change password for ‘pi’ user ===
  
This menu for using different attached keyboards. Brands of keyboards are chosen first followed by other choices to set up nationality of keyboards etc.
+
The default user for the Raspian install is "pi" and its password is "raspberry". If you change the password, other people will need to know the new password, including you, to logon to the Raspberry Pi. Each user/password combination can be different on each SD card.
  
Default is Generic 105-key (Intl) PC. If you cannot find your keyboard on the list then use one of the generic keyboards but it’s probably not a big deal if you can't find yours on the list, have fun remember you can always, change it later or re-image if you're really stuck.
+
=== change_locale - Set locale ===
  
The next screen regards keyboard layout.  If you are not using the first choice of English UK select Other and you will be faced with a long list of other national keyboards. Funnily enough this list includes English UK.
+
This option selects the characters and other symbols being displayed on the screen, and is important if you want to use the non-english ones. It is slow to display, while it reads all the locale information. Changes usually take effect immediately, but may require a reboot.
  
Next screen is quite well documented on the screen you're probably going to run with one of the top two choices. These are: 
+
You usually select only the one(s) you want (press space); this will generate the configuration data for all those you select. The default setting is en_GB UTF-8 UTF-8
  
    The default for the keyboard layout
+
=== change_timezone - Set timezone ===
Or
+
    No AltGr key
+
  
To be honest if this is your first setup and you get this wrong it’s not going to break the bank and as I keep saying if in doubt re-image and start again.
+
This is where you setup your system clock; if it’s wrong it just means the date and time assigned to files you create (automatically when you make them) will be wrong. It is slow to display as there are lots of selections. First you select the continent, then select a City from that continent. You may have to select the one nearest to you.
  
Next screen; well if your using a standard keyboard then you probably don’t have a compose key and if your new to computing as intended you're not likely to need one for a while so I would suggest choosing
+
The Raspberry Pi does not have an onboard clock (you can add one), so the "clock" stops when you power it off. If you are connected to the internet the Raspberry Pi can be set up to get the time from an online time signal.
  
    No compose key
+
=== memory_split - Change memory split ===
  
The next screen is a useful one and the on screen documentation is actually quite clear provided you know what is meant by “X server” so here’s an outline:
+
The Raspberry Pi has two processors, one for calculation tasks (the CPU) and one for graphical tasks (the GPU). The CPU is described as the ARM; the GPU as the VideoCore. This version takes account of the 256 MB or 512 MB boards, and allows a dynamic reallocation of memory, whereas older versions of raspi-config only split the 256 MB and could not set the dynamic option. The best setting will depend on what type of applications you are running on your Raspberry Pi.
  
If you choose to boot to the command line (see later) then after login the Pi will tell you that you can run startx.  Startx is the command to run the windows (like) screen where you use a mouse to select options. 
+
=== ssh - Enable or disable ssh server ===
  
This is the X server and to get back to command line (that’s all the typed stuff) you can use [Ctrl][Alt][Backspace] all pressed at the same time to shut down this X server screen; you can always restart it by typing “startx”.  Always handy if you have a flaky mouse or are using a wireless mouse that eats batteries.
+
Enabling ssh will allow you to connect to your Raspberry Pi from another device on your network and use a terminal window remotely. You do not need a monitor or keyboard connected to your Raspberry Pi if you do this.
  
Of course this is pointless if you don’t remember the key combination when the time comes!
+
Unless you want to use the Raspberry Pi remotely you can disable this, as it stops the ssh service which takes a small amount of processing resources. If you want to set this up, see the [[RPi_A_Method_for_ssh_blind_login | ssh page]].
  
 +
=== boot_behaviour - Start desktop on boot? ===
  
== CHANGE_PASS - Change password for ‘pi’ user ==
+
The official images are supplied with the Raspberry Pi booting into a command line, presumably because problems with connecting the display are fewer and simpler. If you think you are ok with the GUI interface you can boot to this. You can change this at any time.
 
+
The default user for the Wheezy install is pi and its password is raspberry. Until you're familiar with the setup it’s probably better to leave this password as it is at least till you are happy changing stuff.  In addition you can re-run raspi-config to change it at any time.
+
 
+
If you screw this up be prepared to re-image and lose any work you have done and programs installed (you did back up your data didn't you). With Linux and Unix forgotten passwords are a killer the Raspberry Pi is one of the simpler systems. Let's face it till you know what your looking at, the out of the box solution of pi and raspberry are probably all you will need.
+
 
+
 
+
== CHANGE_LOCALE - Set locale ==
+
 
+
Slow to start up and there will be a delay while locales are generated.
+
 
+
You can tell this was written by a computer engineer and not a human how about this as an alternative. 
+
 
+
change_locale Tell the computer if you need non English characters. 
+
 
+
Sheesh! a computer aimed at children and new users and then you expect them to know what locale means (Google's your friend?). 
+
 
+
This menu option gives you a massive list of choices that look like they were written by one of the infinite monkeys of legend (goggle infinite monkeys Shakespeare if you don’t understand this reference). 
+
 
+
The default setting is 
+
 
+
    en_GB UTF-8 UTF-8  (ain't it nice to have a UK produced computer!)
+
 
+
English, Great Britain and UTF-8 is a code related to showing all of the characters usually needed to show English letters and other symbols on the screen. If you are working in some other language than English then you will probably need to play around with this. 
+
 
+
You can select multiple choices in the list the space bar toggles them on and off (this was the exception I mentioned earlier) and it’s a long list. Basically if you want to work in more than one language then you will need to make other choices from this list based on the languages you intend to use.
+
 
+
If you are working in English only the default choice is probably the only one you will need. 
+
 
+
 
+
== CHANGE_TIMEZONE - Set timezone ==
+
 
+
Slow to display.
+
 
+
This is where you setup your clock; now it’s no big issue if it’s wrong it just means the date and time assigned to files you create (automatically when you make them) will be out and its not hard to set this up.  (What is the effect if you are not connected to the internet and don't have time set with ntp?)
+
 
+
The set up consists of two layers basically to make your selection easier to find. 
+
 
+
First option screen think Continent; just to confuse things you have US and America because we all know USA is not part of America. Actually the US option just gives you a shorter list containing the US time zones that are included in the American list; they just made a shorter list under US for all those Good Old Boy American Citizens who don’t know about American places outside of the USA. (flames imminent!).
+
 
+
SystemV relies on you knowing what SystemV is (Think Unix and ignore it for now). 
+
 
+
Most people know where they are in the world for time zone; for me it’s Europe then London on the next screen but I’ve always been of the opinion that there should be ropes and lights around the M25 with signs saying “Danger hole in the world Keep Out” but then I’m not from London and the M25 was always the road to hell. 
+
 
+
 
+
== MEMORY_SPLIT - Change memory split ==
+
 
+
This allows you to choose how much of the RAM memory is set aside for the Broadcom Graphics Processing Unit (Videocore) and how much for the operation of the main ARM processor.
+
 
+
Three choices 32MiB for Videocore, 64MiB for Videocore, 128MiB for Videocore. First time users should leave it at the default 64MiB for the Videocore. There is more information on when to use the different options here [[RPi_Advanced_Setup]]. You can change it with raspi-config and it will take effect at the next reboot (check).
+
 
+
Now let’s assume your really fresh to writing code, as in never done this before ever. You're not going to be writing really complex Artificial Intelligence type programs and your also unlikely to be running cutting edge real time first person shooter games not yet anyways. I like the idea of having 128 meg for graphics.  As a new programmer your not likely to push graphics unless you want to do something with photos or live streaming (Watching Live TV on your Pi).
+
 
+
== SSH - Enable or disable ssh server ==
+
 
+
This change takes effect when???
+
 
+
This option enables or disables the ssh server, a program which sits quietly in the Pi looking for ssh connections from other computers.  The default setting is on and there's little reason for a new user to change this unless your home network has hostile users or is open to the Internet.
+
 
+
ssh means 'secure shell'. It is a communication protocol which will allow you to log into the Pi from another computer on your network using a program like Putty to provide a command line interface in a terminal window.
+
  
Putty is free and available to download. It’s free Open source and runs on both Windows and Linux. There are other things available for Mac’s (I’m not really familiar enough but I believe there’s an option in Xterm).  
+
* Desktop (GUI interface) - gives a picture based screen, similar to a Windows, Mac or smartphone, that requires a mouse to select actions (usually). This option also skips the login by using the pi user. Pressing the red Exit button on the right hand side of the screen will give the options to logout, shutdown or reboot. Using logout will give a GUI login screen. Using Ctrl-Alt-Backspace also gives a GUI login screen. To use a command line open the Terminal window. To get back to the command line, logout and press Ctrl-Alt-F1. To permanently get back the command line, run raspi-config and reset the boot behaviour and restart.
  
This option allows access to the Pi without a monitor attached to the Pi. OK it’s easier if you have one but let’s say you want to do some command line stuff and your partner/brother/sister whatever wants to use the TV for Corrie or suchlike. Its particularly useful for starting a VNC server on the Pi so you can use the Pi's desktop on another computer. More details here [http://myraspberrypiexperience.blogspot.co.uk/p/setting-up-vnc.html]
+
* Command line - gives a text based screen that requires the user to type commands on the keyboard only. Usually the mouse is not required, but some command line programs can use mouse control. You can switch to the GUI screen by typing "startx" and pressing 'Enter'. This time the red Exit button on the right hand side of the screen will only give the option to logout. This returns you to the command line. To stop or reboot the Raspberry Pi type "sudo halt" or "sudo reboot" and press 'Enter'.
  
Using Putty or the like is pretty straightforward. You will need to know the IP address of the Pi, either by watching the startup output as it scrolls by, typing sudo ifconfig at the Pi's command line or terminal window, or looking at your router. The IP address is dynamic and can change, particularly if you have not used the Pi for a day or so.
+
=== update - Try to upgrade raspi-config ===
  
However if you are using everything from the box as is. That is to say you have your HDMI connected to a TV and a Keyboard and Mouse on the Pi and you have the menu running then I suggest you could disable ssh just to be on the safe side security wise(note just a suggestion).
+
The raspi-config utility has changed quite a bit since it started, and is likely to continue to change. Use this option to check if your version of raspi-config is the latest, and if not download the latest version; you will need to be connected to the internet to update it. Once updating is complete, raspi-config will close. You should restart raspi-config with "sudo raspi-config" to make sure that you have completed all the options.
  
 +
=== <Finish> ===
  
== BOOT_BEHAVIOR  - Start Desktop on Boot? ==
+
Use this 'button' when you have completed your changes. You will be asked whether you want to reboot or not. When used for the first time its best to reboot. This should restart your Pi. There will be a delay if you have chosen to resize your SD card.
  
This gives you two modes of working:
+
= First-boot activity =
  
DESKTOP
+
When a new image that contains the raspi-config utility is booted the first time, the session starts with the raspi-config screen. Use the help above when using the utility on first boot. This behaviour is driven by the '''raspi-config.sh''' script in the '''/etc/profile.d''' directory.
When powered up the Pi will automatically log you in as pi user and display the desktop. Pressing the red Exit button on the right hand side of the screen will give the options to logout, shutdown or reboot. Logout returns to a login screen not to the command line. The command line is only accessible through a terminal window. The experience is very Windoze like, you may not need any linux commands ever, and its very quick to get to the desktop, its main downside being that since you are automatically logged in at power up there is no protection from hostile users in your household.
+
  
COMMAND LINE
+
<pre>
When powered up the Pi stays in the command line (the big black screen). After lots of scrolling text you will be asked for your username and password. If this is successful information about the last Login is displayed which is useful for finding out if it was you, your son/daughter/grandmother/cat that was the last to login and screw up your Pi. 
+
#!/bin/sh
 +
# Part of raspi-config http://github.com/asb/raspi-config
 +
#
 +
# See LICENSE file for copyright and license details
  
Then you see the standard copyright and NO WARRANTY message the latter just legalese for “your doing this at your own risk” that kind of goes without saying.
+
# Should be installed to /etc/profile.d/raspi-config.sh to force raspi-config
 +
# to run at initial login
  
Then the key line
+
# You may also want to set automatic login in /etc/inittab on tty1 by adding a
 +
# line such as:
 +
# 1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1 # RPICFG_TO_DISABLE
  
    Type ‘startx’ to launch graphical session
+
if [ $(id -u) -ne 0 ]; then
 +
  printf "\nNOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'\n\n"
 +
else
 +
  raspi-config
 +
  exec login -f pi
 +
fi
 +
</pre>
  
So, if at this point you type startx followed by hitting the Enter key you will be launched headlong into a windows style environment. When you have finished work Logout using the red Exit button (bottom right). Since you started from the command line this menu has only the Logout option which takes you back to the command line. To halt you must type sudo halt or to reboot sudo reboot. For halting wait until 'System Halted' is displayed before pulling the plug.
+
This runs the '''raspi-config''' script (found as '''/usr/bin/raspi-config'''). When that has completed, the script above shows the login prompt for the '''pi''' user.
  
If on the other hand you want to play in the rarefied atmosphere of the command line environs then type away. You are in the home directory of the pi user; typing ls followed by [enter] will display its files and directories. Directories are in blue so type cd python_games then ls to change folder and display its contents. When you have finished don't forget to type sudo halt and wait until 'System Halted' is displayed before pulling the plug.
+
When the '''raspi-config''' script runs, and the user selects the '''Finish''' option, the script above is deleted so that it will not run again. When the Raspberry Pi is first booted it uses the '''/etc/inittab''' script, which does an automatic login as '''root'''. The Finish option of the raspi-config script modifies part of the inittab script, from the login as root:
  
 +
<pre>
 +
...
 +
# 1:2345:respawn:/sbin/getty --noclear 38400 tty1 # RPICFG_TO_ENABLE
 +
1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1 # RPICFG_TO_DISABLE
 +
2:23:respawn:/sbin/getty 38400 tty2
 +
3:23:respawn:/sbin/getty 38400 tty3
 +
...
 +
</pre>
  
== UPDATE - Try to upgrade raspi-config ==
+
to the standard login action:
  
Unless there have been recommendations on the forum by someone from the core volunteer team to use this, don't.
+
<pre>
 +
...
 +
1:2345:respawn:/sbin/getty --noclear 38400 tty1
 +
2:23:respawn:/sbin/getty 38400 tty2
 +
3:23:respawn:/sbin/getty 38400 tty3
 +
...
 +
</pre>
  
We could get into the Catch 22 situation where a bug is introduced into raspi-config that stopped it working. This option runs the apt-get commands to update the raspi-config software from a remote repository. You will need to be connected to the internet to use it.
+
== History ==
  
 +
This utility script was first released with the Debian Wheezy image of 18 June 2012. It is expected to continue changing so the number of menu items and the ease of use of those items will increase with time. If anyone feels willing and able to improve raspi-config then please contact Alex Bradbury [https://github.com/asb/raspi-config].
  
== <FINISH> ==
+
== Is this useful? ==
  
Use this when you have completed your changes. You will be asked whether you want to reboot or not. When used for the first time its best to reboot. This should restart your Pi. Scrolling text should appear immediately and there will be a pause if you have chosen to resize your SD card.
+
This may be just a bit of background information, but it could be useful if you wish to distribute your own SD cards to friends, based on your own configuration. You may have added or removed packages, changed configurations, or any number of things that you and your friends think are useful.
  
[[Category:RaspberryPi]]
+
You can create a backup image of your SD card, but that image will not execute the raspi-config script on first boot; your friends may need to run it because they have different hardware. To make that script run automatically, copy the top script to '''/etc/profile.d/raspi-config.sh''' and change the '''/etc/inittab''' script back to the original lines.
  
=References=
+
[[Category:RPi Linux]]
<references/>
+

Revision as of 21:01, 12 March 2013

The raspi-config script helps you to configure your Pi.

The raspi-config script

When you start your Pi the display shows the output from each of the start-up scripts (as lots of scrolling text). If starting for the first time using a new image you are logged in as a root user, and the raspi-config menu will then appear. It can also be started at any time from the command line or from a terminal window (see below).

It has the following entries (this is the layout from the Raspian 2012-12-16 image. It may be different on other images):

Raspi-config
 
info                Information about this tool
expand_rootfs       Expand root partition to fill SD card
overscan            Change overscan
configure_keyboard  Set keyboard layout
change_pass         Change password for 'pi' user
change_locale       Set locale
change_timezone     Set timezone
memory_split        Change memory split
ssh                 Enable or disable ssh server
boot_behaviour      Start desktop on boot?
update              Try to upgrade raspi-config
 
    <Select>                    <Finish>


Moving Around the Menu

It looks like its running as a graphical application but in fact it isn't; its using the command line and graphical tools for the layout of the text. Cursor up/down keys move the highlight up and down menus.

At any point from within any of the menu or sub-menu options the Tab key will switch from the selected menu entry and the "buttons" at the bottom (inside angle brackets). So, move the highlight to the menu option you want to use, press Tab, then press Return.

Some of the menu entries take a while to read configuration information before they change what is displayed. Be patient.

What raspi-config does

Some menu entries modify the file /boot/config.txt. This file, out of the box, contains a number of commented out configuration entries; raspi-config adds entries at the end of this file. You can see what raspi-config has done to the file by viewing it on the Pi using Leafpad. More information on editing config.txt here R-Pi_ConfigurationFile

Other entries modify Linux configuration files. Some take effect immediately, others at the next boot.

Running raspi-config another time

Following the first boot, your raspberry pi will boot into the command prompt or desktop (you choose in raspi-config). You can run it at any time after that from the command line or in a terminal window by typing (case sensitive):

sudo raspi-config

The sudo (do as superuser) is necessary because you will be changing files that you as user pi do not own.

Menu Options

Here is a description of each menu entry.

info - Information About This Tool

It helpfully advises that it is for initial configuration, and can be run at any time. You may have difficulties if you have heavily customized your installation as the changes it makes might not be correct if what it attempts to change is not what it expects.

expand_rootfs - Expand root partition to fill SD card

The usual distribution images are 2 GB. When you copy the image to a larger SD card you have a portion of that card unused. This option expands the initial image to expand to fill the rest of the SD card, giving you more space. You need to reboot the Raspberry Pi to make this available. THERE IS NO CONFIRMATION - SELECTING THE OPTION EXPANDS THE PARTITION.

overscan - Change overscan

Old photographs had a border round the outside to allow for handling and mounting. Old TV sets had a significant variation in the size of the picture it produced; some had cabinets that overlapped the screen. Like the photographs, the TV pictures were given a black border so that none of the picture was lost. This is called overscan. Modern TVs and monitors don't need, and the signal doesn't have, the border. If the initial text shown on the screen disappears off the edge you need to enable overscan to add back the border.

Any changes will take effect after a reboot. You can have greater control over the settings by editing boot/config.txt.

On some displays, particularly monitors, just disabling Overscan will make the picture fill the whole screen and correct the resolution. For other displays it may be necessary to leave overscan enabled and adjust the Overscan values, more information here R-Pi_Troubleshooting#Big_black_borders_around_small_image_on_HD_monitors.

configure-keyboard - Set keyboard layout

This option selects the keyboard being used, so that the characters produced are the same as those typed (important examples are # and /). It is slow to display, while it reads all the keyboard types. Changes usually take effect immediately, but may require a reboot.

Brands of keyboards are chosen first followed by other choices to set up the nationality of the keyboard. The default is a Generic 105-key (Intl) PC. If you cannot find your keyboard on the list then use one of the generic keyboards. Check | this page for most keyboard layouts. The next screen gives the keyboard layout. If you are not using the first choice of English UK select Other and you will be faced with a long list of other national keyboards.

You then select specific options:

  • No AltGr key
  • No compose key
  • Shutdown XServer (use [Ctrl][Alt][Backspace] all pressed at the same time)

change_pass - Change password for ‘pi’ user

The default user for the Raspian install is "pi" and its password is "raspberry". If you change the password, other people will need to know the new password, including you, to logon to the Raspberry Pi. Each user/password combination can be different on each SD card.

change_locale - Set locale

This option selects the characters and other symbols being displayed on the screen, and is important if you want to use the non-english ones. It is slow to display, while it reads all the locale information. Changes usually take effect immediately, but may require a reboot.

You usually select only the one(s) you want (press space); this will generate the configuration data for all those you select. The default setting is en_GB UTF-8 UTF-8

change_timezone - Set timezone

This is where you setup your system clock; if it’s wrong it just means the date and time assigned to files you create (automatically when you make them) will be wrong. It is slow to display as there are lots of selections. First you select the continent, then select a City from that continent. You may have to select the one nearest to you.

The Raspberry Pi does not have an onboard clock (you can add one), so the "clock" stops when you power it off. If you are connected to the internet the Raspberry Pi can be set up to get the time from an online time signal.

memory_split - Change memory split

The Raspberry Pi has two processors, one for calculation tasks (the CPU) and one for graphical tasks (the GPU). The CPU is described as the ARM; the GPU as the VideoCore. This version takes account of the 256 MB or 512 MB boards, and allows a dynamic reallocation of memory, whereas older versions of raspi-config only split the 256 MB and could not set the dynamic option. The best setting will depend on what type of applications you are running on your Raspberry Pi.

ssh - Enable or disable ssh server

Enabling ssh will allow you to connect to your Raspberry Pi from another device on your network and use a terminal window remotely. You do not need a monitor or keyboard connected to your Raspberry Pi if you do this.

Unless you want to use the Raspberry Pi remotely you can disable this, as it stops the ssh service which takes a small amount of processing resources. If you want to set this up, see the ssh page.

boot_behaviour - Start desktop on boot?

The official images are supplied with the Raspberry Pi booting into a command line, presumably because problems with connecting the display are fewer and simpler. If you think you are ok with the GUI interface you can boot to this. You can change this at any time.

  • Desktop (GUI interface) - gives a picture based screen, similar to a Windows, Mac or smartphone, that requires a mouse to select actions (usually). This option also skips the login by using the pi user. Pressing the red Exit button on the right hand side of the screen will give the options to logout, shutdown or reboot. Using logout will give a GUI login screen. Using Ctrl-Alt-Backspace also gives a GUI login screen. To use a command line open the Terminal window. To get back to the command line, logout and press Ctrl-Alt-F1. To permanently get back the command line, run raspi-config and reset the boot behaviour and restart.
  • Command line - gives a text based screen that requires the user to type commands on the keyboard only. Usually the mouse is not required, but some command line programs can use mouse control. You can switch to the GUI screen by typing "startx" and pressing 'Enter'. This time the red Exit button on the right hand side of the screen will only give the option to logout. This returns you to the command line. To stop or reboot the Raspberry Pi type "sudo halt" or "sudo reboot" and press 'Enter'.

update - Try to upgrade raspi-config

The raspi-config utility has changed quite a bit since it started, and is likely to continue to change. Use this option to check if your version of raspi-config is the latest, and if not download the latest version; you will need to be connected to the internet to update it. Once updating is complete, raspi-config will close. You should restart raspi-config with "sudo raspi-config" to make sure that you have completed all the options.

<Finish>

Use this 'button' when you have completed your changes. You will be asked whether you want to reboot or not. When used for the first time its best to reboot. This should restart your Pi. There will be a delay if you have chosen to resize your SD card.

First-boot activity

When a new image that contains the raspi-config utility is booted the first time, the session starts with the raspi-config screen. Use the help above when using the utility on first boot. This behaviour is driven by the raspi-config.sh script in the /etc/profile.d directory.

#!/bin/sh
# Part of raspi-config http://github.com/asb/raspi-config
#
# See LICENSE file for copyright and license details

# Should be installed to /etc/profile.d/raspi-config.sh to force raspi-config
# to run at initial login

# You may also want to set automatic login in /etc/inittab on tty1 by adding a
# line such as:
# 1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1 # RPICFG_TO_DISABLE

if [ $(id -u) -ne 0 ]; then
  printf "\nNOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'\n\n"
else
  raspi-config
  exec login -f pi
fi

This runs the raspi-config script (found as /usr/bin/raspi-config). When that has completed, the script above shows the login prompt for the pi user.

When the raspi-config script runs, and the user selects the Finish option, the script above is deleted so that it will not run again. When the Raspberry Pi is first booted it uses the /etc/inittab script, which does an automatic login as root. The Finish option of the raspi-config script modifies part of the inittab script, from the login as root:

...
# 1:2345:respawn:/sbin/getty --noclear 38400 tty1 # RPICFG_TO_ENABLE
1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1 # RPICFG_TO_DISABLE
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
...

to the standard login action:

...
1:2345:respawn:/sbin/getty --noclear 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
...

History

This utility script was first released with the Debian Wheezy image of 18 June 2012. It is expected to continue changing so the number of menu items and the ease of use of those items will increase with time. If anyone feels willing and able to improve raspi-config then please contact Alex Bradbury [1].

Is this useful?

This may be just a bit of background information, but it could be useful if you wish to distribute your own SD cards to friends, based on your own configuration. You may have added or removed packages, changed configurations, or any number of things that you and your friends think are useful.

You can create a backup image of your SD card, but that image will not execute the raspi-config script on first boot; your friends may need to run it because they have different hardware. To make that script run automatically, copy the top script to /etc/profile.d/raspi-config.sh and change the /etc/inittab script back to the original lines.