source_id
int64 1
4.64M
| question
stringlengths 0
28.4k
| response
stringlengths 0
28.8k
| metadata
dict |
---|---|---|---|
7,177 | I wanted to prepare a distro for some friends. As I didn't have anything else lying around, I used a 16Gb SD card. I started with the default Debian Weezy 2Gb image and did not do any resizing. Now, as I am done, I wanted to create an image of what I did, but I get a 16Gb file, containing 14Gb of unpartitioned (not partitioned and free) space at the end. [I used Windows // Win32DiskImager as I have nothing free to stick into the rPI right now] Can I just truncate the image file right behind the partitioned space and transfer the leading part onto a smaller card, then? | I finally found a resource that is explaining my question. http://softwarebakery.com/shrinking-images-on-linux Short: Yes, truncating is possible! Summary of the process: Extracting the partition information from the image using fdisk : $ fdisk -lu image.img
Disk image.img: 4096 MB, 4096000000 bytes, 8000000 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
Disk identifier: 0x000a1bc7
Device Boot Start End Blocks Id System
image.img1 2048 5872026 5869978 b W95 FAT32 We see, that the partition has a size of about 2,8Gb (5872026 * 512), the rest is unpartitioned . So, everything after the end of the partition can be removed. This will be done with the tool truncate . Don't forget to add 1 to the number of sectors, as block-numbers start at 0. $ truncate --size=$[(5872026+1)*512] image.img Edit: For those being too lazy to switch to Linux: Also works on Windows with Cygwin 's fdisk.exe and truncate.exe ! What is Cygwin? I may cite: "Cygwin: Get that Linux feeling - on Windows" ( https://www.cygwin.com/ ). It is a set of executeables that can run under Windows, but provide all the command line programs you usually know from Linux.
Cygwin can take very long to install if you select every package during install, but to follow this example, simply make sure, that besides the default configuration, also the packages util-linux (fdisk) and coreutils (truncate) are selected. Depending on your environment, you man need to add /usr/bin and /usr/sbin to your $PATH . | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7177",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/1390/"
]
} |
7,223 | Has anyone used their Raspberry Pi as a routing device? Mainly I want to use it to monitor my network, and it would be great if it had an input and output for Ethernet, but it doesn't, so I am wondering if it is very effective to monitor the network by having the Ethernet input and then using a USB dongle as a Wi-Fi router. Has anyone done anything like this? Does it slow the Internet down by much? | I've been using my model B as a router with traffic shaping, using just the one Ethernet port it comes with. Here's a quick-and-dirty on how: Enable IPv4 Forwarding , so your Pi acts as a router by forwarding any traffic it receives Configure your Pi with static network configuration so it will not be influenced by DHCP changes suggested below. Here are the contents of my /etc/network/interfaces as reference: # pi@flux:/home/pi/projects/adsl/rrdlogger (master *)
# cat /etc/network/interfaces
auto lo
iface lo inet loopback
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.1
netemask 255.255.255.0
gateway 192.168.1.254 # IP of my ADSL router box
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp Now change your network's DHCP settings such that the default gateway/router is your Pi. This likely means changing the settings on your existing ADSL router box. In my example above, my Pi's IP address is 192.168.1.1 . When your devices next reconnect to the network, they will be told your Pi is their gateway to the internet, and all they internet-bound traffic will be sent to it. Your Pi will in turn relay all that traffic to your usual router. You might need to disconnect and then reconnect your devices for these changes to take effect. Now you can create or install a tool to do your monitoring for you, such as vnstat . Traffic Shaping As for traffic shaping, here's another quick-and-dirty guide which will make use of my own personal variant of wondershaper . For this to be useful you need to know how fast your internet connection is. You can usually find this from your (original) router's web interface, but failing that you can get an estimate using a speedtest . sudo apt-get install iptables wget https://raw.github.com/meermanr/adsl/master/wondershaper/wondershaper sudo ./wondershaper eth0 will print the current status of traffic shaping. Obviously the expected status is there is no shaping, which means there's a single rule in effect, called pfifo_fast : ( eth0 is the name of the wired network adaptor on a model B. See ifconfig for the names of interfaces on your system) # pi@flux:/home/pi/projects/adsl/wondershaper (master *)
# sudo ./wondershaper eth0
qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 1908 bytes 15 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0 sudo ./wondershaper eth0 3000 370 , where: 3000 is my internet connection's downlink speed in kbit . So 3Mbit == 3000kbit 370 is my internet connection's uplink speed, in kbit again. sudo ./wondershaper eth0 should now show much more output: # pi@flux:/home/pi/projects/adsl/wondershaper (master *)
# sudo ./wondershaper eth0
qdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 0
Sent 1858 bytes 9 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc sfq 40: parent 1:40 limit 127p quantum 1526b depth 127 divisor 1024 perturb 10sec
Sent 1858 bytes 9 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc sfq 10: parent 1:10 limit 127p quantum 1526b depth 127 divisor 1024 perturb 10sec
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc sfq 20: parent 1:20 limit 127p quantum 1526b depth 127 divisor 1024 perturb 10sec
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc sfq 30: parent 1:30 limit 127p quantum 1526b depth 127 divisor 1024 perturb 10sec
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc ingress ffff: parent ffff:fff1 ----------------
Sent 768 bytes 12 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
class htb 1:1 root rate 370000bit ceil 370000bit burst 10Kb cburst 1599b
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 3459453 ctokens: 540531
class htb 1:10 parent 1:1 leaf 10: prio 1 rate 370000bit ceil 370000bit burst 1599b cburst 1599b
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 540531 ctokens: 540531
class htb 1:20 parent 1:1 leaf 20: prio 2 rate 246000bit ceil 246000bit burst 1599b cburst 1599b
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 813000 ctokens: 813000
class htb 1:30 parent 1:1 leaf 30: prio 3 rate 74000bit ceil 74000bit burst 1599b cburst 1599b
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 2702687 ctokens: 2702687
class htb 1:40 root leaf 40: prio 0 rate 100000Kbit ceil 100000Kbit burst 512Kb cburst 1600b
Sent 3486 bytes 15 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 15 borrowed: 0 giants: 0
tokens: 654609 ctokens: 1250 Your outbound network traffic is now being shaped by your Pi, and your inbound traffic is being throttled slightly to ensure that the Pi, and not your original routing box, has control of traffic. To disable shaping, just run sudo ./wondershaper eth0 clear . You can change the uplink and downlink rates without clearing first, but it doesn't hurt. Update: You also need to disable the transmission of ICMP redirects , since we need all traffic to go through the Pi for shaping to happen. It turns out that the Linux kernel is smart enough to figure out that the clients on your home network could talk directly to the ADSL box, rather than bounce traffic through the Pi, and it tells them this at every opportunity. The clients then send their traffic directly to your ADSL box, and the Pi doesn't get a chance to shape it. Disable it on the fly like so (lost when you next reboot): echo 0 | sudo tee /proc/sys/net/ipv4/conf/*/send_redirects Update the following to set this during boot: /etc/sysctl.conf net/ipv4/conf/eth0/send_redirects = 0 (Thanks to https://unix.stackexchange.com/a/58081/22537 for this tip) You may also be interested in my personal notes on configuring a Linux gateway: http://www.robmeerman.co.uk/unix/gateway | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7223",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/7161/"
]
} |
7,261 | As from my previous question, I asked what the power off button in the corner does. Then somebody said if you boot into the GUI automatically, it will give you some options. How do I boot into the GUI at startup? | Assuming that you are using Raspbian, it is actually rather simple to do what you ask. Simply open the terminal, and type in the following: sudo raspi-config The following window should show up Navigate to boot_behaviour and click enter. This should make it so that the GUI interface starts automatically. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7261",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/3720/"
]
} |
7,500 | Is there a command line package/application to get a good (maybe visual) overview over the free/used space left on Pi's SD-card. ls -lh is nice but it does not show me how much space the content of a folder uses. Also it would be helpful if it gives me a fast comparable overview. You know, like tree to ls is. My Pi is accessed via ssh , so it has to be command line or some kind of a remote application I can run on Ubuntu Linux 13.04. Background: I set up bittorrent sync on my Pi and it works fine, but now I'd like to know available free-space. I read somewhere, deleted files are cached in a hidden folder or the native trash. So I'd want to watch this, but also the entire files/folders on SD-Card. | Use the command ncdu . It is a console program to display disc usage. It has a ncurses GUI.
I usually run ncdu -x <some folder> , the x switch is there to not cross filesystem boundaries. apt-get install ncdu ncdu man page | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7500",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/5494/"
]
} |
7,524 | What I would like to see is the cheapest way possible to control my lights using my Raspberry Pi. What I imagine to control it I build an interface on my smartphone by which I can send commands to my Raspberry Pi. The Raspberry Pi would then send a package (or something else) to a thing I can put inside my power socket (so I don't see it). Note that this thing should be connected through Wi-Fi (how else is it going to receive the message from my Raspberry Pi?). What is this thing and what is the cheapest possible way possible, as I am planning to connect a dozen or so lights? | I'm using these items: Receivers ON-OFF to control my lights (you typically put a device in the walloutlet or instead of the walloutlet). They work in the 433 MHz band (ISM). Out of the box you have a remote control which sends a signal to the receiving device and switch it on or off. In my case, I created this situation: Created an HTML site on my Raspberry Pi ( /switch.html ) I call that page on my smartphone On the page are four buttons (I control four devices / lights) When I click a button, it asynchronously fires a call to /switch.php (the .php is on the Raspberry Pi) The switch.php calls a switch.py program which controls the 433 MHz
sender (see below) The 433 MHz sender does the same thing as the out of the box remote
control. This is the sender, that is, the replacement for the standard remote control: 433 MHz Wireless Transmitter Module Superregeneration for Arduino I also created a scenario for out-of-house use. I didn't want to connect my Raspberry Pi via my homerouter directly to the Internet, so I built myself another webpage (at my own domain) which does not control the Raspberry Pi directly, but it sends an email to a (known only to me) email ( Gmail ) address. The Raspberry Pi checks that email account every 10 minutes to see if there is any email. In that email I for instance say A on or B off. So when we get home late and the lights are already off, we navigate to the site on my mobile (plans are to make it an Android app), click the button, the page gets posted and at the server an email gets sent, and in the next 0-10 minutes the Raspberry Pi checks the email, sees four new emails (A on, B on, C on and D on) and switches the lights on. How to get started So, to get started, these are the things I've done to get it all working.
In my case, I programmed the control of the 433 MHz sender in Python (which is an easy language if you already know how to program). First you install the rpi.gpio libary. This library is used to control the little pins on your Raspberry Pi from your Python script. See Install RPi.GPIO Python Library . Then you can optionally read the article Tutorial: How to use your Raspberry Pi like an Arduino , it's about what you can do with the rpi.gpio library, for instance blinking LEDs . It's not mandatory for the Elro light switching however. Then you get the awesome code for the Elro commanding by HeikoHeiko, at http://pastebin.com/aRipYrZ6 . You paste that code in a file named ' switchelro.py '. You then change the string on line 94 to your own jumper settings (as you have set in your remote control and the walloutlet device. Check wether the combination remote-walloutlet device works before trying it with the Raspberry Pi. If it doesn't work with the standard components, it will probably fail with the Raspberry Pi too). You then change the number of the pin your sender is attached to on line 97. The pin number can be gotten from RPi Low-level peripherals and in File:RPi P1 header.png . You have to use the 1..26 count (the black image), not the GPIO34, GPIO24, etc. (green image). Then you type this on the command prompt: sudo python switchelro.py 2 1 which means 'turn on B' (following this schema: A = 1, B = 2, C = 4, D = 8, E = 16 for the first number, and 1=on, 0=off for the second). I changed the repeat = 10 on line 30 to repeat = 20 in the beginning (I don't remember why) and that works. I never retried it with the setting '10'. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7524",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/775/"
]
} |
7,640 | My Raspberry Pi is not discoverable via its hostname in my LAN. I have a couple of other Ubuntu machines in the LAN, and they are all pingable via their hostnames. On my Raspberry Pi: pi@raspberrypi ~ $ hostname
raspberrypi On another machine in the same LAN: ping raspberrypi
ping: unknown host raspberrypi | You have to use avahi-daemon (zeroconf) if you want to connect via a hostname instead of an IP address. From the Raspberry Pi documentation on RPi Advanced Setup : Install avahi with the following commands on the Raspberry Pi: sudo apt-get install avahi-daemon Update boot startup for avahi-daemon sudo insserv avahi-daemon Apply the new configuration with: sudo /etc/init.d/avahi-daemon restart The Raspberry Pi should now be addressable from other machines as raspberrypi.local, for example: ssh [email protected] or http://raspberrypi.local if you have HTTP service installed. If you couldn't connect from Windows PCs via SSH probably you haven't installed the Bonjour service. Get Bonjour for Windows: Download Bonjour Print Services for Windows v2.0.2 . Just install it. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7640",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/827/"
]
} |
7,913 | I'm thinking of installing my Pi down at my wife's stables which have a 40W solar charged 12V DC lighting circuit. Since the Pi runs at 5V I'm thinking that a quick and easy way to step down the voltage safely would be to use a microUSB mobile phone car charger such as this Also I figure that the Pi should only be drawing about 2.5W (5V x 500mA) so the demand on the available power should be fine & the phone charger can cope with up to 850mA current so should be able to cope with a Pi. I'll then use one of these for the display (12V so should be simple). So the questions: Am I making sense here? Are there any other gotchas you can think of that I need to be worried about? | Go to a hobby store (or DX.com) and buy a BEC (battery eliminator circuit) intended for model aircraft. $5 gets you a very efficient switch mode voltage regulator, good for around 3A. I use these with all my Pis. Here is an example: http://dx.com/p/hobbywing-5v-6v-3a-switch-mode-ultimate-bec-ubec-15149 | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7913",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/7901/"
]
} |
7,918 | I run RaspBMC. If I recall correctly, the man utility is NOT installed by default with RaspBMC (although I may be mistaken). The problem is, packages installed prior to installing the actual man utility do not install their man pages. This includes the packages that come pre-installed with the system. Example: I tried with udisks-glue (which comes pre-installed) $ man udisks-glue
No manual entry for udisks-glue After re-installing that package, the man page is there. $ apt-get remove udisks-glue
$ apt-get install udisks-glue
$ man udisks-glue
[Man page gets displayed] The question is: can I somehow install all the missing man pages easily? From what I can see, installing the man pages is a step that's run for each apt-get install command: Unpacking udisks-glue (from .../udisks-glue_1.3.4-1_armhf.deb) ...
Processing triggers for man-db ...
[...] Using divide-and-conquer, I assume this could be obtained by: getting a list of all installed packages ( dpkg -l | grep ??? | cut ??? | ??? ) finding a way to tell apt-get to re-install a package without messing with the config (a remove + install kinda fits the bill, but I don't think it plays nice with dependencies) EDIT: this should do it : sudo apt-get install --reinstall packagename run 2. over each item in 1. | Go to a hobby store (or DX.com) and buy a BEC (battery eliminator circuit) intended for model aircraft. $5 gets you a very efficient switch mode voltage regulator, good for around 3A. I use these with all my Pis. Here is an example: http://dx.com/p/hobbywing-5v-6v-3a-switch-mode-ultimate-bec-ubec-15149 | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7918",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/7203/"
]
} |
7,978 | I get an I/O error at boot and then get this 'error':
(I am running the latest version of Raspbian) Entering kdb (current=0xca82ac80, pid 1) due to keyboard entry
kdb> _ And I have seen it before, and was explained that my SD card got corrupted since I did not shutdown correctly. One week later, I didn't deal with this error, until the power flickered on/off thrice and now I can't boot again. It seems like I am re-preparing my SD card ever day!!! I don't like this, not to mention I love my Pi's capabilities. But this 'breakpoint' is driving me crazy! Is there some way I can prevent this or strengthen something so it doesn't happen if the power goes out? Any suggestions? Thanks! P.S. My zip file was not corrupted and my extraction service is Win32DiskImager | I'm not going to write about checking your HW and compatible SD card lists, because you most probably have already checked all these. What I'm about to write is the permanent solution, that allows to nip the problem in the bud, and permanently fix the issue. If you don't want your SD card to get broken when you flip the power switch, you have to use it in a read-only mode. If there's nothing being written to your SD card, it won't get damaged no matter what you do. Obvious (but non-working) solution would be an attempt to flip "read-only" switch on the side of the SD card, unfortunately this does not work because the schematics shows this switch is routed nowhere and its position is generally ignored. Another, more subtle (but working) approach would be modifying your /etc/fstab to mount all your partitions read-only. The drawback of this approach is your logs have to be written somewhere else (USB stick, RAM drive?) and in case of RAM drive the logs won't persist during reboot. To do this: Copy an RPi image to your SD card using any method you like. Boot from SD and raspi-config will start automatically. Do not "Expand filesystem", just set up your time zone and international settings. Run sudo fdisk /dev/mmcblk0 , press 'p' to print the current partition table. Then enter the following commands: n Create a new partition
[enter] Make a primary partition
[enter] Use the default number
[#] 1 greater than the end of mmcblk0p2
[enter] Expand to the end of the SD card
w Write the partition table and exit Edit /etc/fstab . It should look something like the following: proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat ro 0 0
/dev/mmcblk0p2 / ext4 ro 0 0
/dev/mmcblk0p3 /home ext4 defaults,errors=remount-ro 0 1
none /var/run ramfs size=1M 0 0
none /var/log ramfs size=1M 0 0 Run sudo partprobe to recognize the new partition. Format your new partition with sudo mkfs --type ext4 /dev/mmcblk0p3 . Reboot. If for some reason you need to make changes to your system, you can remount the read-only partitions with write access: sudo mount -o remount,rw /dev/mmcblk0p2 | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7978",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/7839/"
]
} |
7,987 | I have bought a Model A Pi, and I successfully configured it with a USB Wifi dongle on Raspbian. I recently prepared an SD card with the latest version of Arch Linux ARM and I am trying to get it set up with WiFi. I was trying to follow a Raspbian WiFi tutorial (thinking it could be the same as Arch Linux ARM) which said that there is a directory /etc/network/ and you could set up WiFi from the interface file, but no directory /etc/network/ exists. I heard about netctl but I have no Idea how to use it! I do have a supported USB WiFi dongle. Could someone please show me how I can setup WiFi on Arch Linux ARM? Thanks! | The deprecated netcfg used /etc/network.d/ to store profiles. The successor of netcfg is netctl . In order to setup a wireless network, install netctl using sudo pacman -S netctl . Next, you have to create a network profile. /etc/netctl/examples/ contains some examples. Let's assume you want to setup a WPA2-PSK network. Simply copy over the example file and start editing: /etc/netctl# install -m640 examples/wireless-wpa wireless-home
/etc/netctl# cat wireless-home
Description='A simple WPA encrypted wireless connection'
Interface=wlan0
Connection=wireless
Security=wpa
IP=dhcp
ESSID='MyNetwork'
# Prepend hexadecimal keys with \"
# If your key starts with ", write it as '""<key>"'
# See also: the section on special quoting rules in netctl.profile(5)
Key='WirelessKey'
# Uncomment this if your ssid is hidden
#Hidden=yes Edit MyNetwork and WirelessKey as needed. Note the 640 permissions, you do not want to leak your wireless passphrase to the world! Proceed with testing: # netctl start wireless-home If you do not get an error, you should be connected. Let's test this: $ ping 8.8.8.8 To make this network start on boot: # netctl enable wireless-home | {
"source": [
"https://raspberrypi.stackexchange.com/questions/7987",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/7839/"
]
} |
8,180 | I just got my Pi today, and of course I can't even use it because I got the wrong HDMI to DVI converter but that's besides the point and question. My question is the following: I have decided to ditch Gmail and to setup my own email server. First I know I will buy a domain name, I then want to use my Pi to send and receive email in place of Gmail. Do I have to install a web-server first? How should I go about this. What is the best way to go about it? I will be setting up two email addresses for this account and we should both be able to log into our respective emails simultaneously. I have the Model B pi with a 4GB card with an OS preloaded from Canakit. There is a similarly related post here but this person is beyond where I already am. Pi Email Server | I have set up my pi for use as a web and mail server and it works just fine. So far I have been running from a standard 4GB SD card (with a few modifications described below) and it has had an uptime so far of a little over three months. It is not hard and there are many tutorials out there for setting these things up. Incidentally, I used most of the Ubuntu tutorials for setting up mail related items (postfix, dovecot, etc.). You should realize that there are very few differences between setting up a server on a raspberry pi and other machines so general Debian/Ubuntu guides should mostly apply to raspbian. That being said there are a number of issues with the pi itself that you should address. Extend the lifespan of your SD card as described in this post. I would say the more suggestions you take the better. Remove the default user (pi). Remove the graphical desktop as described in this post. Use the pi setup tool to minimize the amount of RAM used by the graphics processor (Hint: If you just set up ssh it does not need any). A few general server notes: Set up your ports on the router (25 for mail, 22 for ssh, 80 for web and or the related ports for imap and pop3). Setup the pi with a static IP address on the local network so the router has something to forward traffic to. Use fail2ban or similar blacklisting tool. There are a lot of script kiddies out there. With the server itself I used the Ubuntu community wiki to set up postfix with greylisting and dovecot. I would not bother with CLAM as it uses a lot of resources and simple greylisting removes something like 90% of spam mail anyway. Another point is that if you don't care about the server being available 99.9% of the time you don't need to pay for a static IP. As long as the server is connected on a dynamic IP from you ISP it is not likely to change unless you unplug your router for a longer period of time. I have been having the same dynamically allocated IP for as long as the pi has been connected to the internet. And should it change it is a simple update of my DNS manangers website and a few hours later it is back online. For webmail you will need a webserver. I would recommend nginx with roundcube. Plus side for using a webbased client is that you only need to open port 80 as all communication with between the mail server and client happens on the local machine. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8180",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8213/"
]
} |
8,182 | I have 2 temp probes from a Maverick ET-7 (common on Amazon.com). I would like to setup my Raspberry Pi to read temps from these. I purchased a breadboard and Pi cobbler + cable from Adafruit. Is this possible? Where should I begin? - thanks EDIT: At this point I am looking to physically connect those generic food temp probes to the Pi. I am not attempting to read the wireless signal from the ET-7. | I have set up my pi for use as a web and mail server and it works just fine. So far I have been running from a standard 4GB SD card (with a few modifications described below) and it has had an uptime so far of a little over three months. It is not hard and there are many tutorials out there for setting these things up. Incidentally, I used most of the Ubuntu tutorials for setting up mail related items (postfix, dovecot, etc.). You should realize that there are very few differences between setting up a server on a raspberry pi and other machines so general Debian/Ubuntu guides should mostly apply to raspbian. That being said there are a number of issues with the pi itself that you should address. Extend the lifespan of your SD card as described in this post. I would say the more suggestions you take the better. Remove the default user (pi). Remove the graphical desktop as described in this post. Use the pi setup tool to minimize the amount of RAM used by the graphics processor (Hint: If you just set up ssh it does not need any). A few general server notes: Set up your ports on the router (25 for mail, 22 for ssh, 80 for web and or the related ports for imap and pop3). Setup the pi with a static IP address on the local network so the router has something to forward traffic to. Use fail2ban or similar blacklisting tool. There are a lot of script kiddies out there. With the server itself I used the Ubuntu community wiki to set up postfix with greylisting and dovecot. I would not bother with CLAM as it uses a lot of resources and simple greylisting removes something like 90% of spam mail anyway. Another point is that if you don't care about the server being available 99.9% of the time you don't need to pay for a static IP. As long as the server is connected on a dynamic IP from you ISP it is not likely to change unless you unplug your router for a longer period of time. I have been having the same dynamically allocated IP for as long as the pi has been connected to the internet. And should it change it is a simple update of my DNS manangers website and a few hours later it is back online. For webmail you will need a webserver. I would recommend nginx with roundcube. Plus side for using a webbased client is that you only need to open port 80 as all communication with between the mail server and client happens on the local machine. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8182",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8138/"
]
} |
8,195 | I'm looking to set up a simple LAMP server. I do know how do this manually. I am not looking for a guide as to how to setup a LAMP server. Is there a pre-built LAMP server image that already has PHP, MYSQL, Apache, etc., already installed? I'd like to skip the manual CLI install work. | I have set up my pi for use as a web and mail server and it works just fine. So far I have been running from a standard 4GB SD card (with a few modifications described below) and it has had an uptime so far of a little over three months. It is not hard and there are many tutorials out there for setting these things up. Incidentally, I used most of the Ubuntu tutorials for setting up mail related items (postfix, dovecot, etc.). You should realize that there are very few differences between setting up a server on a raspberry pi and other machines so general Debian/Ubuntu guides should mostly apply to raspbian. That being said there are a number of issues with the pi itself that you should address. Extend the lifespan of your SD card as described in this post. I would say the more suggestions you take the better. Remove the default user (pi). Remove the graphical desktop as described in this post. Use the pi setup tool to minimize the amount of RAM used by the graphics processor (Hint: If you just set up ssh it does not need any). A few general server notes: Set up your ports on the router (25 for mail, 22 for ssh, 80 for web and or the related ports for imap and pop3). Setup the pi with a static IP address on the local network so the router has something to forward traffic to. Use fail2ban or similar blacklisting tool. There are a lot of script kiddies out there. With the server itself I used the Ubuntu community wiki to set up postfix with greylisting and dovecot. I would not bother with CLAM as it uses a lot of resources and simple greylisting removes something like 90% of spam mail anyway. Another point is that if you don't care about the server being available 99.9% of the time you don't need to pay for a static IP. As long as the server is connected on a dynamic IP from you ISP it is not likely to change unless you unplug your router for a longer period of time. I have been having the same dynamically allocated IP for as long as the pi has been connected to the internet. And should it change it is a simple update of my DNS manangers website and a few hours later it is back online. For webmail you will need a webserver. I would recommend nginx with roundcube. Plus side for using a webbased client is that you only need to open port 80 as all communication with between the mail server and client happens on the local machine. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8195",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/4361/"
]
} |
8,220 | I downloaded RPi.GPIO 5.3a from here: https://pypi.python.org/pypi/RPi.GPIO I extracted the tar file, cd into the folder and ran: sudo python setup.py install It ran through a bunch of stuff and doesn't seem to have failed. The last line of its work is this: Writing /usr/local/lib/python2.7/dist-packages/RPi.GPIO-0.5.3a.egg-info After that it was done and gave me back control. Now I type sudo python then import RPi.GPIO and I see ImportError: No module named GPIO Can anyone point me to exactly what steps I need to take to get the python GPIO library installed correctly so I can import it and manipulate the GP pins? I've found a mish mash of different processes online (this was the one that came up most often) but I have thus far been unable to get any of them to work. | Not sure if this is helpful, but under the latest copy of Raspbian I was able to install RPi.GPIO directly from the main repositories using apt-get as follows: sudo apt-get update
sudo apt-get -y install python-rpi.gpio If you're running Python 3 ( idle3 on the command line) instead of Python 2 ( python on the command line) you need to install the RPi.GPIO library with this command instead: sudo apt-get -y install python3-rpi.gpio | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8220",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/2990/"
]
} |
8,231 | The Raspberry Pi lacks a hardware clock. How do I force NTPD to update date/time immediately after every boot? I'm running Raspbian and the Raspberry Pi is connected using an Ethernet cable. | After searching around, this method worked for me.
As you know, the Raspberry Pi 3 has NTP disabled by default.
So by just typing this, the NTP support will be enabled: sudo timedatectl set-ntp True Check result with timedatectl status In case of warning, you may have to run sudo timedatectl set-local-rtc true too. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8231",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/7435/"
]
} |
8,475 | I am wanting to learn about the BIOS on a Raspberry Pi motherboard. What is the BIOS called? Does it have a specific name or is it just called a BIOS on a Raspberry Pi? | The firmware is closed-source proprietary code programmed into the SoC (System on a Chip) processor, which cannot be modified. Upon power-up the firmware will initiate a bootloader on the SD card. I do not believe that any other services are provided through the SoC firmware, so it is not really a "BIOS" (Basic Input/Output System) per se. After this point everything else comes from the SD card. According to the software section of the wiki , the boot order is as follows: First stage bootloader - This is used to mount the FAT32 boot partition on the SD card so that the second stage bootloader can be accessed. It is programmed into the SoC itself during manufacture of the RPi and cannot be reprogrammed by a user. Second stage bootloader (bootcode.bin) - This is used to retrieve the GPU firmware from the SD card, program the firmware, then start the GPU. GPU firmware (start.elf) - Once loaded, this allows the GPU to start up the CPU. An additional file, fixup.dat, is used to configure the SDRAM partition between the GPU and the CPU. At this point, the CPU is release from reset and execution is transferred over. User code - This can be one of any number of binaries. By default, it is the Linux kernel (usually named kernel.img), but it can also be another bootloader (e.g. U-Boot), or a bare-bones application. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8475",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8192/"
]
} |
8,658 | Can I get Git on Raspbian to back-up my C/C++ files? Do I need to download anything to use Git on my Raspberry Pi? Where can I learn to use it? | You may use: $ sudo apt-get install git to install Git and then read the Pro Git book (by Scott Chacon and Ben Straub) about how to use it. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8658",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/-1/"
]
} |
8,734 | I am trying to execute a script when my Raspberry Pi boots up. I would like the web browser to open up automatically. I have tried to find a simple solution, (like dropping my script in some "startup" directory or something similar) but I am not seeing anything like that. I have looked into Upstart , but I'm struggling to grasp how that works. Any scripts I've tried have not worked when I test them out. | This Answer is obsolete - and contains methods which were WRONG even when it was written. Unfortunately this still gets flagged as a Suggestion by StackOverflow. For running Midori on startup, take a look at this tutorial . For DIY solutions, read on. You can add your script executable command to the bottom of .bashrc that will run your script every time open a terminal (or run a new instance of bash ) . Make sure you are in the pi folder: $ cd ~ Create a file and write a script to run in the file: $ sudo nano superscript Save and exit: Ctrl + X , Y , Enter Open up .bashrc for configuration: .bashrc is NOT intended to run scripts. It is run each time a non-login interactive shell is started and is used to configure the shell. ~/.bashrc: executed by bash(1) for non-login shells . $ sudo nano .bashrc Scroll down to the bottom and add the line: ./superscript Save and exit: Ctrl + X , Y , Enter If you are looking for a solution that works on bootup to the console , take a look at this link . Basic rundown: Create a file for your startup script and write your script in the file: $ sudo nano /etc/init.d/superscript Save and exit: Ctrl + X , Y , Enter Make the script executable: $ sudo chmod 755 /etc/init.d/superscript Register script to be run at startup: $ sudo update-rc.d superscript defaults If you want a script to run when you boot into the LXDE environment , you could take a look at this Raspberry Pi forum post : Navigate to ~/.config/lxsession/LXDE-pi Open the autostart file in that folder: $ sudo nano autostart Add @midori on a new line. If you want to run something like a python script, put something like @python mypython.py on a new line. Running a script file would be @./superscript , but for some reason the script runs in an infinite loop (perhaps this will stop that). Save and exit: Ctrl + X , Y , Enter Restart your Raspberry Pi into the LXDE environment. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8734",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8784/"
]
} |
8,851 | I'm struggling with my configuration of my Raspberry Pi. I want to achieve the following: eth0: will be used with a static ip and can only connect to the local area network (this will be my NFS server)
wlan0: Should connect to my wireless network for internet access For some reason I'm unable to activate both connection at the same time (yes I have a good power supply). The ethernet will disable the wireless for no reason at all. If i finally get the both up then I'm unable to ping google.com. My question how should I do this correctly? I have the following in my interfaces file: auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 0.0.0.0
#auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface home inet static
address 192.168.0.157
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
iface default inet dhcp Kind Regards, and thank you very much! | This applies to Raspbian Wheezy prior to 2015-05-05 for later (and Jessie/Stretch) See How do I set up networking/WiFi/Static IP As suggested by the community, my answer extracted from the question. I got it working right now so I'll share all my configuration files with the community. Firstly lets look at the wpa_supplicant.conf file: pi@raspberrypi ~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="****"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="****"
id_str="home"
priority=5
} Next my new update interfaces file pi@raspberrypi ~ $ sudo cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
address 192.168.0.157
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
iface default inet dhcp And now comes the tricky part, you have to disable the hotplugging of the eth0 device (else it will disable your wlan0). You do this by edting the following file: pi@raspberrypi ~ $ sudo cat /etc/default/ifplugd
INTERFACES="eth0"
HOTPLUG_INTERFACES="eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop" I also have the following in my startup script, this will make sure my wifi does get started up (sometimes for no reason at all it would not start). You also have to kill the ifplugd daemon on the eth0 device: pi@raspberrypi ~ $ sudo cat /etc/rc.local
#!/bin/sh -e
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
# Disable the ifplugd eth0
sudo ifplugd eth0 --kill
sudo ifup wlan0
exit 0 And that should work! | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8851",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/1497/"
]
} |
8,858 | I am designing a system using a Raspberry Pi (Model B - 512mb) that depends on OpenCV libraries for Haar-like feature detection, and fswebcam/gpio/libgphoto2. I need more speed than Python can offer. My interface requires only text of different sizes and colours and rectangles. The image below shows a very rough paint mockup of the interface required. I was able to produce the interface in half an hour using the PyGame engine, which runs at sufficient CPU requirements. I can also run the application from the terminal before startx , which runs great, with the Esc key set to exit the application. I am not too keen to have the standard menu or minimise and exit controls that normal applications have, because this will run on a 5" display with no mouse. I am looking for a solution like this that I can do with C++, or perhaps a good tutorial on a way to bridge python with C++. Will GTK suit my needs for this. When using GTK, there are the following packages: libgtk2.0-0 : GTK+ graphical user interface library
libgtk2.0-0-dbg : GTK+ libraries and debugging symbols
libgtk2.0-0-udeb : GTK+ graphical user interface library - minimal runtime
libgtk2.0-bin : programs for the GTK+ graphical user interface library
libgtk2.0-common : common files for the GTK+ graphical user interface library
libgtk2.0-dev : development files for the GTK+ library
libgtk2.0-doc : documentation for the GTK+ graphical user interface library Which of these do I need to install to use GTK for this purpose, I would like to keep things as lightweight as possible? Is there another similar engine I can use for C++ like PyGame that may be better than GTK? Note: This is a refined (yet related) post to the one I made on StackOverflow , which got no replies. | This applies to Raspbian Wheezy prior to 2015-05-05 for later (and Jessie/Stretch) See How do I set up networking/WiFi/Static IP As suggested by the community, my answer extracted from the question. I got it working right now so I'll share all my configuration files with the community. Firstly lets look at the wpa_supplicant.conf file: pi@raspberrypi ~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="****"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="****"
id_str="home"
priority=5
} Next my new update interfaces file pi@raspberrypi ~ $ sudo cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
address 192.168.0.157
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
iface default inet dhcp And now comes the tricky part, you have to disable the hotplugging of the eth0 device (else it will disable your wlan0). You do this by edting the following file: pi@raspberrypi ~ $ sudo cat /etc/default/ifplugd
INTERFACES="eth0"
HOTPLUG_INTERFACES="eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop" I also have the following in my startup script, this will make sure my wifi does get started up (sometimes for no reason at all it would not start). You also have to kill the ifplugd daemon on the eth0 device: pi@raspberrypi ~ $ sudo cat /etc/rc.local
#!/bin/sh -e
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
# Disable the ifplugd eth0
sudo ifplugd eth0 --kill
sudo ifup wlan0
exit 0 And that should work! | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8858",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8875/"
]
} |
8,922 | I can view videos using OMXPlayer: omxplayer -o hdmi video.h264 How do I do the same for still images? | You can use the command-line fbi app ("framebuffer image viewing"). The framebuffer is also what oxmplayer uses. Fbi is available from the raspbian repos and should be in any other GNU/Linux distro as well; it is not specific to the pi. It takes a filename or series of filenames, and you can use shell globbing for this, so e.g.: fbi *.jpg Will show all the .jpg files in your current directory. For instructions on how to advance from one picture in the list to the next, see the KEYS section of man fbi . You can also set an automated slideshow with the -t option. You may get this error: ioctl VT_GETSTATE: Invalid argument (not a linux console?) Even when logged in on a VT. The solution is to specify the framebuffer device, which should be: fbi -d /dev/fb0 [...] If you are using ssh, try: fbi -T 1 [...] Where "1" is the number of your current VT ("virtual terminal", aka. VC, "virtual console"; these are accessed via ctrl-alt-F[1-6] ). You do not have to be logged in on the VT where the image will be displayed, so you can log in remotely and use this to put images on a display attached to the pi (presuming the correct VT is on screen). -T is not in the man page, but it is listed with fbi --help . Note you cannot use this to view the image on a remote terminal; those aren't associated with the framebuffer. A couple of other useful options are -a , which will zoom the images to fit on the screen if they are too large, and --edit , which allows you to rotate images (I believe they are then saved with that rotation, you may want to check that if it presents an issue). | {
"source": [
"https://raspberrypi.stackexchange.com/questions/8922",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8344/"
]
} |
9,034 | I want to change the default governor on my pi from ondemand to performance. Is there a way of doing this? | I don't think you can change the default without recompiling the kernel. By that I mean, the one the kernel chooses when booted up. However, you can tell it to use a different governor while running, so if you want to effectively set the default without recompiling, you can add something to /etc/rc.local or some other start-up script. The /sys directory is not on disk; it's an in RAM fake filesystem that is actually an interface for getting information from and sending commands to the kernel. This is all relative to /sys/devices/system/cpu , so: > cd /sys/devices/system/cpu You also need to be root to do the writes ( echo blahblah > ). Anyway, relative to the above directory, to see the available governors: > cat cpu0/cpufreq/scaling_available_governors
conservative ondemand userspace powersave performance Apparently yours is ondemand (but read "Gotcha" below about this); to check: > cat cpu0/cpufreq/scaling_governor
ondemand To change it: echo performance > cpu0/cpufreq/scaling_governor Note this either has to be done root, or like this sudo sh -c "echo performance > cpu0/cpufreq/scaling_governor" Just plain sudo will not work because there is a redirect, > . You'll now notice the /sys/devices/system/cpu/cpufreq directory, (NOT the same as /sys/devices/system/cpu/cpu0/cpufreq !), which formerly contained filehandles for configuring the ondemand governor, is empty. Gotcha... On Raspbian there is an init script, the confusingly named raspi-config (no, it has nothing to do with the other one, which is run on first boot by the also confusingly named apply_noobs_os_config.sh ), which uses this technique to set the governor to ondemand unless the shift key is held down (the stock Raspbian kernel has powersave compiled in). It doesn't do anything else, so it is safe to disable this ( systemctl disable raspi-config ), or you could edit it as per Gorkamorka's answer , but then you run the risk of having it un-edited by a system update, etc. -- who knows what anyone plans to do with that. You could try adding the non-sudo version above to /etc/rc.local . This may happen after the raspi-config script has exited. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/9034",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8825/"
]
} |
9,257 | I posted a question previously on how to set up a static IP address on the rpi and eventually figured out , along with some others , that the answer was to change wpa-roam to wpa-conf when pointing to /etc/wpa_supplicant/wpa_supplicant.conf , but why does this work? i.e. when I have this in my /etc/network/interfaces file: auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1
broadcast 192.168.0.255
network 192.168.0.0
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf Assuming that /etc/wpa_supplicant/wpa_supplicant.conf has been properly configured, this method doesn't work. This is the relevant output from iwconfig : wlan0 unassociated Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency=2.437 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0 As well as from ifconfig : wlan0 Link encap:Ethernet HWaddr ec:1a:59:64:3a:36
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:847 errors:0 dropped:1029 overruns:0 frame:0
TX packets:759 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:677394 (661.5 KiB) TX bytes:133345 (130.2 KiB) But everything magically starts working once you change wpa-roam to wpa-conf and run sudo /etc/init.d/networking restart . When would you use wpa-roam , and when would you use wpa-conf ? | wpa-roaming is a method with which you can browse and connect to wireless networks. The result of the following setup is that if an ethernet cable is not attached, wlan0 takes precedence and connects you to your desired wireless network or to an available open wireless network or a predetermined wireless network. If you connect an ethernet cable, the cabled network connection immediately shuts down WiFi access and eth0 then connects you to the cabled network. By unplugging the network cable the wireless connection will instantly be available again. Source : http://manual.aptosid.com/en/inet-setup-en.htm I assume that, wpa-conf is the static configuration which not needed for roaming through network interfaces. I couldn't find any relevant and detailed document for this. By the way I have same issue with my WiFi configuration. My WiFi does not work when wired ethernet unplugged. So i changed wpa-roam to wpa-conf as like you, it worked. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/9257",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/9048/"
]
} |
9,260 | I recently bought a cheap a USB Audio card and I have some issues with it. It records audio so awful. Apparently the volume of the mic in is so loud and distorts. I figured out this in alsamixer. The input or output volumes assigned to this device cannot be changed. My USB Audio card is listed by lsusb: CODE: SELECT ALL
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 1130:f211 Tenx Technology, Inc. TP6911 Audio Headset Another problem is that the recorded audio plays a little fast, maybe the sampling rate is also wrong. | wpa-roaming is a method with which you can browse and connect to wireless networks. The result of the following setup is that if an ethernet cable is not attached, wlan0 takes precedence and connects you to your desired wireless network or to an available open wireless network or a predetermined wireless network. If you connect an ethernet cable, the cabled network connection immediately shuts down WiFi access and eth0 then connects you to the cabled network. By unplugging the network cable the wireless connection will instantly be available again. Source : http://manual.aptosid.com/en/inet-setup-en.htm I assume that, wpa-conf is the static configuration which not needed for roaming through network interfaces. I couldn't find any relevant and detailed document for this. By the way I have same issue with my WiFi configuration. My WiFi does not work when wired ethernet unplugged. So i changed wpa-roam to wpa-conf as like you, it worked. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/9260",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/1160/"
]
} |
9,298 | What is the maximum amount of current that can be pulled from a single GPIO pin? Does the maximum current decrease if current is being pulled from multiple GPIO pins? From my research, I've found: An Arduino can pull 40 mA People on the forums hint at 50 mA as an answer Searching the data sheet returns no results Some discussion was brought up on electronics.stackexchange.com | This answer is OBSOLETE. The Pi 3.3V rail is widely assumed to provide 50mA, but this is not officially documented for recent Pi models. The original Pi has an on-board linear regulator which was limited, but the B+ and later have a switch mode regulator which can supply more. The regulator chip (which supplies both 3.3V and 1.8V) is rated at 1A. Raspberry Pi Power Limitations This is an interesting question because it has a not so concrete answer. The power rails... The 5 V rail appears to passed straight through from the USB and the current is therefore limited to whatever the USB port can supply minus the current being drawn by the board. (Source 1) The 3.3 V rail can supply a maximum of 50 mA. (Source 1) The GPIO... So here it gets a little foggier. There isn't any current limiting features on the board, so if you demand a certain amount of current from a pin, it will attempt to drive it until something breaks. Saying that, from the research I've done, the absolute maximum you should draw from a single pin is 16 mA. HOWEVER, a pin is driven by the 3.3 V rail, which can't drive more than 50 mA! So it's a balancing act. It is recommended though, that a series resistor is placed on the GPIO to limit the current and prevent damage. The board was really designed to be buffered before being connect to peripheral devices. (Source 2) (Source 3) Source 2 and 3 link to pages that explain the operation of the Pi's driver set up on the GPIO. It's worth a read though may be a bit outside the scope of the question. To summarise from another source, the GPIO output current is... A maximum of 16mA per pin with the total current from all pins not exceeding 50mA[sic] (Source 4) | {
"source": [
"https://raspberrypi.stackexchange.com/questions/9298",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/7427/"
]
} |
9,590 | Can I start tightvncserver to show the same screen on hdmi screen and vncclient? I tried -alwaysshared, but could see no difference. Edit I want to remotely control Pi, using keyboard, mouse on remote (Mac), and have display on Pi hdmi screen as well as remote. I used to do this in the distant past, running Linux from a Windows PC. Further research indicates tightvncserver can't do this (so what does -alwaysshared do?). I also tried x11vnc, but can't get this to do anything on the Mac. | You should install x11vnc and configure it to get same screen on HDMI and also vnc client. apt-get install x11vnc then run x11vnc command with parameters. x11vnc -display :0 -usepw -listen IP_of_pi -allow allowed_ip_address
-display : screen number to get
-usepw : use password security
-listen : IP address of server (Pi IP)
-allow : allowed client IPs (client IP, in your case Mac IP address) Then use a VNC client on your Mac, i prefer 'Chicken of VNC' and connect to Pi IP address. Update: To tune VNC connection for performance you can use those parameters. -noxdamage -ncache 10 -ncache_cr You can find more parameters and definitions of x11vnc at http://www.karlrunge.com/x11vnc/x11vnc_opts.html Good information about x11vnc : http://www.karlrunge.com/x11vnc/ | {
"source": [
"https://raspberrypi.stackexchange.com/questions/9590",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8697/"
]
} |
9,912 | When compiling a package for the Pi I came across a message like this: CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-mcpu=cortex-a8
and
CFLAGS += -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard I know the difference between -march and -mtunu , but what is the difference between armv7-a and arm1176jzf-s ? if I'm looking at a new Pi how do I know what flags and argument I should use? | At a command prompt, type cat /proc/cpuinfo to view CPU information. The ARM11 chips use version 6 of the ARM instruction set, ARMv6. More recent chips from the ARM Cortex range like the Cortex A7, A8 etc all use the ARMv7 instruction set. All Pi boards are shipped with an ARM11. The options on the second line look like a better fit for building software for the Pi. The first set of options appears to be for a newer generation of ARM chip. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/9912",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/9753/"
]
} |
10,060 | I want to set my keyboard settings to Swedish, but on the Raspbian configuration tool my keyboard is not on the list. Update : Changing XKBLAYOUT to "se" doesn't work. And internationalization in raspi-config doesn't either. My keyboard is a Logitech Wireless Touch Keyboard K400r, if that might help. | Take a look at the Raspberry Pi wiki on re-mapping the keyboard with Debian Squeeze : Re-mapping the keyboard with Debian Squeeze If different letters appear on-screen from that which you typed, you
need to reconfigure you keyboard settings. In Debian, from a command
line type: sudo dpkg-reconfigure keyboard-configuration Follow the prompts. To apply the changes type: sudo setupcon Or: From the command line type: sudo nano /etc/default/keyboard Then find where it says XKBLAYOUT=”gb” and change the gb to the two letter code for your country. Here is the list of current country codes from Wikipedia if you don't know your country code (use the codes in the column labeled alpha-2). Another way you can try switching the keyboard layout: $ setxkbmap de
$ setxkbmap fr
$ setxkbmap us | {
"source": [
"https://raspberrypi.stackexchange.com/questions/10060",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/2978/"
]
} |
10,251 | I need to SSH my Pi over wifi but because it is a model A board (using a usb hub is not possible - ever) and I have no ethernet, i can't configure the Pi to connect to my secured wifi network. I want to have the SD card plugged into my laptop and I want to edit a file with the wifi configuration information in it so my Pi will connect to my network automatically at start-up so I can then SSH it to get control. I know how to enable SSH on a headless system thanks to this answer . Edit .
Ive been searching around and I'm wondering if I'm able to just edit the file /etc/network/interfaces while the SD card is in my PC and put in all the network ssid, psk and wlan0 stuff in it. Will this work? Thanks | There are some great answers here, but many are out of date. Even this one has aged somewhat. There are now (at least) two ways of doing this: 1: Raspberry Pi Imager The Raspberry Pi Foundation's Raspberry Pi Imager now has an advanced options menu which is accessed by the keyboard shortcut Ctrl + Shift + X : You can set hostname, allow SSH (including changing user password), configure wifi and set locale. Note that this tool also appears to have telemetry built in, which can be turned off from the GUI. 2: Traditional CLI method Since May 2016, Raspbian has been able to copy wifi details from /boot/wpa_supplicant.conf into /etc/wpa_supplicant/wpa_supplicant.conf to automatically configure wireless network access: If a wpa_supplicant.conf file is placed into the /boot/ directory, this will be moved to the /etc/wpa_supplicant/ directory the next time the system is booted, overwriting the network settings; this allows a Wifi configuration to be preloaded onto a card from a Windows or other machine that can only see the boot partition. — The latest update to Raspbian - Raspberry Pi , 2016-05-13 Since the /boot partition is accessible by any computer with an SD card reader, wifi configuration is now much simpler. A typical wpa_supplicant.conf file is: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=«your_ISO-3166-1_two-letter_country_code»
network={
ssid="«your_SSID»"
psk="«your_PSK»"
key_mgmt=WPA-PSK
} Replace «your_ISO-3166-1_two-letter_country_code» with your ISO Country Code (such as CA for Canada), «your_SSID» with your wireless access point name and «your_PSK» with your wifi password. If you don't wish to store your wifi password in plain text, you can use the wpa_passphrase utility to store the hashed password: wpa_passphrase «your_SSID» The utility will prompt for the password, and will return the hexadecimal hash value. Note that this hashed password is stored without quotes in the /boot/wpa_supplicant.conf , eg: psk=b76dc68cb76bfea7232e32634f859ca760cd8abeee318a346b51d3bde00b8965 Note that the country , ctrl_interface and update_config lines are required in file as created in /boot : if they are missing the system will not connect to the network. The above process can be repeated to correct the omissions. This process has been tested with both Raspbian and Raspbian Lite as of the November 2018 release. In addition, you may wish to add Secure Shell (SSH) access to your headless Raspberry Pi. SSH is disabled on Raspbian by default for security reasons. You can enable it by creating a file called /boot/ssh : For headless setup, SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card. When the Pi boots, it looks for the 'ssh' file; if it is found, SSH is enabled and then the file is deleted. The content of the file doesn't matter: it could contain either text or nothing at all. — SSH (Secure Shell) - Raspberry Pi Documentation If you enable SSH access, you should change the password of the standard pi user as soon as possible. As the default password ( raspberry ) is widely known, your Raspberry Pi is effectively open to everyone on your network until you change the password. You can do this with the passwd command. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/10251",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/966/"
]
} |
10,371 | I've noticed that I don't get any HDMI output to a monitor if I connect the HDMI cable to the Pi after I plug in the power supply, because I have two RPis for one monitor -- one running Raspbmc, the other running RetroPie. Does anyone else have this problem / is this normal? If it is normal, why? And if not, what am I doing wrong with my setup? | Open /boot/config.txt and apply this settings: hdmi_force_hotplug=1 to force hot plugin of your screen, increase config_hdmi_boost to boost the signal. Lower values are meant to be for short HDMI cables, larger for longer ones. But this can also apply for (older) HDMI displays, whose HDMI receivers are not sensitive enough, irrespective of cable length. You can find more info here: elinux.org . | {
"source": [
"https://raspberrypi.stackexchange.com/questions/10371",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/9048/"
]
} |
10,384 | I want to do speech processing on Raspberry Pi to detect specific people (something like unique identification). I would prefer to use only the on-board processor for this, you could assume that internet is not accessible. Also, what are the limitations with the Raspberry Pi performing speech processing? If I want to use this as a automatic attendance machine, how should I proceed? | This is the main project my Raspberry Pi is dedicated to right now, so I figure I can add my two cents. Keep in mind this project is still very much a work in progress. I chose to use the C programming language for this project exclusively on the Raspbian OS, and that may have affected some of my decisions and instructions. I'm going to only list free and open source software , since that is all that I use. For the installation instructions, I will assume you have a fully up-to-date system . Speech Recognition Here are some options for speech recognition engines: Pocketsphinx - A version of Sphinx that can be used in
embedded systems (e.g., based on an ARM processor). Pros : Under active development and incorporates features such as fixed-point arithmetic and efficient algorithms for GMM computation. All the processing takes place on the Raspberry Pi, so it is capable of being used offline. It supports real time speech recognition Cons : It is complicated to set up and understand for beginners. For me, it was too inaccurate for my application. All the processing takes place on the Raspberry Pi, making it a bit slower. Installation instructions : Download the latest stable versions of Sphinxbase and Pocketsphinx : $ wget http://sourceforge.net/projects/cmusphinx/files/sphinxbase/0.8/sphinxbase-0.8.tar.gz
$ wget http://sourceforge.net/projects/cmusphinx/files/pocketsphinx/0.8/pocketsphinx-0.8.tar.gz Extract the downloaded files: $ tar -zxvf pocketsphinx-0.8.tar.gz; rm -rf pocketsphinx-0.8.tar.gz
$ tar -zxvf sphinxbase-0.8.tar.gz; rm -rf sphinxbase-0.8.tar.gz To compile these packages, you'll need to install bison and the ALSA development headers. NOTE : It is important that the ALSA headers be installed before you build Sphinxbase. Otherwise, Sphinxbase will not use ALSA. It also appears that ALSA will not be used if PulseAudio is installed (a bad thing for developers like me). $ sudo apt-get install bison libasound2-dev cd into the Sphinxbase directory and type the following commands: $ ./configure --enable-fixed
$ sudo make
$ sudo make install cd into the Pocketsphinx directory and type the following commands: $ ./configure
$ sudo make
$ sudo make install Test out Pocketsphinx by running: $ src/programs/pocketsphinx_continuous -samprate 48000 If you want to tweak it, I recommend you read some information on the CMUSphinx Wiki . libsprec - A speech recognition library that is developed
by H2CO3 (with few contributions by myself, mostly bug fixes). Pros : It uses the Google Speech API , making it more accurate. The code is more easy to understand (in my opinion). Cons : It has dependencies on other libraries that H2CO3 has developed (such as libjsonz ). Development is spotty. It uses the Google Speech API, meaning processing doesn't take place on the Raspberry Pi itself, and requires an internet connection. It requires one small modification to the source code before compilation to work properly on the Raspberry Pi. Installation instructions : Install libflac , libogg and libcurl : $ sudo apt-get install libcurl4-openssl-dev libogg-dev libflac-dev Download the most recent version of libsprec $ wget https://github.com/H2CO3/libsprec/archive/master.zip Unzip the downloaded package: $ unzip master.zip; rm -rf master.zip You should now have a folder named libsprec-master in your current directory. Download the most recent version of libjsonz : $ wget https://github.com/H2CO3/libjsonz/archive/master.zip Unzip the downloaded package: $ unzip master.zip; rm -rf master.zip You should now have a folder named libjsonz-master in your current directory. cd into the libjsonz-master directory, compile, and install: $ cd libjsonz-master
$ mv Makefile.linux Makefile
$ make
$ sudo make install cd out of the libjsonz-master directory and into the libsprec-master/src directory. Edit line 227: $ err = snd_pcm_open(&handle, "pulse", SND_PCM_STREAM_CAPTURE, 0); We need this to say: $ err = snd_pcm_open(&handle, "plughw:1,0", SND_PCM_STREAM_CAPTURE, 0); This is so that the program will use ALSA to point to the USB microphone. Compile and install: $ mv Makefile.linux Makefile
$ make
$ sudo make install You can now use the library in your own applications. Look in the example folder in libsprec-master for examples. Julius - A high-performance, two-pass large vocabulary
continuous speech recognition ( LVCSR ) decoder software for
speech-related researchers and developers. Pros : It can perform almost real-time speech recognition on the Raspberry Pi itself. Standard speech model formats are adopted to cope with other free modeling toolkits. Cons : Spotty development, with it's last update being over a year ago. It's recognition is also too inaccurate and slow for my usage. Long installation time Installation instructions : There are a few packages that we need to install to get the system working properly: $ sudo apt-get install alsa-tools alsa-oss flex zlib1g-dev libc-bin libc-dev-bin python-pexpect libasound2 libasound2-dev cvs Download Julius from the CVS source: $ cvs -z3 -d:pserver:[email protected]:/cvsroot/julius co julius4 Set the compiler flags by the environment variables: $ export CFLAGS="-O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -pipe -fomit-frame-pointer" cd into the folder julius4 and type the following commands $ ./configure --with-mictype=alsa
$ sudo make
$ sudo make install Julius needs an environment variable called ALSADEV to tell it which device to use for a microphone: $ export ALSADEV="plughw:1,0" Download a free acoustic model for Julius to use. Once you have downloaded it, cd into the directory and run: $ julius -input mic -C julius.jconf After that you should be able to begin speech input. Roll your own library - For my specific project, I choose to build my own speech recognition library that records audio from a USB microphone using ALSA via PortAudio , stores it in a FLAC file via libsndfile , and sends it off to Google for them to process it. They then send me a nicely packed JSON file that I then process to get what I said to my Raspberry Pi. Pros : I control everything (which I like). I learn a lot (which I like). Cons : It's a lot of work . Also, some people may argue that I'm not actually doing any processing on the Raspberry Pi with this speech recognition library. I know that . Google can process my data much more accurately that I can right now. I'm working on building an accurate offline speech recognition option. Speech Synthesis Here are some options for speech synthesis engines: tritium - A free, premium quality speech synthesis engine written completely in C (and developed by yours truly). Pros: Extremely portable (no dependencies besides CMake to build), extremely small (smallest one that I could find), easy to build. Cons: The speech output itself can be inaccurate at times. The support for a wide variety of languages is lacking as I am the sole developer right now with little free time, but this is one of the future goals of the project. Also, as of right now only a library is output when compiled and no usable/testable executable. eSpeak - A compact open source software speech synthesizer for Linux, Windows, and other platforms. Pros : It uses a formant synthesis method, providing many spoken languages in a small size. It is also very accurate and easy to understand. I originally used this in my project, but because of the cons I had to switch to another speech synthesis engine. Cons : It has some strange dependencies on X11 , causing it to sometimes stutter. The library is also considerably large compared to others. Installation instructions : Install the eSpeak software: $ sudo apt-get install espaek To say what you want in eSpeak: $ espeak "Hello world" To read from a file in eSpeak: $ espeak -f <file> Festival - A general multi-lingual speech synthesis system. Pros : It is designed to support multiple spoken languages. It can use the Festvox project which aims to make the building of new synthetic voices more systematic and better documented, making it possible for anyone to build a new voice. Cons : It is written in C++ (more of a con to me specifically). It also has a larger code base, so it would be hard for me to understand and port the code. Installation instructions : Install the Festival software: $ sudo apt-get install festival festival-freebsoft-utils To run Festival, pipe it the text or file you want it to read: $ echo "Hello world" | festival --tts Flite - A small run-time speech synthesis engine derived from Festival and the Festvox project. Pros : Under constant development at Carnegie Mellon University. Very small engine compared to others. It also has a smaller code base, so it is easier to go through. It has almost no dependencies (a huge pro for me, and another reason I decided to use this engine in my project). Cons : The speech output itself is not always accurate. The speech has a very metallic, non-human sound (more than the other engines). It doesn't support very many languages. Installation instructions : Install the Flite software: $ sudo apt-get install flite To run Flite: $ flite -t "text that you want flite to say" Answers to your specific questions : What are the limitations with the Pi performing speech processing? Programmers don't have limits. :P On a more serious note, the Raspberry Pi has plenty of resources to handle speech processing. As long as the person performing the speech processing knows what they are doing, the Raspberry Pi should be able to handle it just fine. I want to use this a automatic attendance machine, how should I
proceed? None of these option are accurate enough to tell the difference between specific people yet . That is something I am working on in my project (and probably will be for a while). If you are looking for an better option for automatic attendance, I would look into facial recognition . There are more limitations on facial recognition for the Raspberry Pi though, so keep that in mind. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/10384",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/9043/"
]
} |
10,442 | I am wondering what the boot sequence of the Raspberry Pi is in a typical setup (say NOOBS), from power application (or warm reset if that's different) up to, say, the apparition of the logo; or where that is described. Beside a most needed general picture of that sequence, I'm most interested in the early stages: What's the reset vector for the ARM CPU, and how/where is that defined? From what memory are the first ARM CPU instructions fetched? Where is that, and what technology is used to store this code? Is that ARM32 or Thumb (or perhaps Jazelle) code? Does that depend on the low order bit of the reset vector? Is source (or disassembly, or dump) of that early boot code available? If not, is anything technical preventing the use of the JTAG port to determine that? As for legal, I'm ready to assume the risk of trusting my understanding of the law applicable where I live (France), which is that I'm fully allowed to analyze my own computer, at least in the absence of an explicit contractual requirement not to do so. In what order are peripherals initialized, and by what piece of code? Beside the ARM CPU, is there some processor/automata running in the BCM2835, and in the affirmative how does its boot sequence relate to the ARM CPU? I'm ready to dive into the ARM CPU's Technical Reference Manual and BCM2835 ARM Peripherals , or any other doc. Update: After posting, I found this and this , stating the BCM2835's GPU is acting as a master to the ARM, and is heavily involved in the boot sequence. | The boot sequence of the Raspberry Pi is basically this: Stage 1 boot is in the on-chip ROM. Loads Stage 2 in the L2 cache Stage 2 is bootcode.bin . Enables SDRAM and loads Stage 3 Stage 3 is loader.bin . It knows about the .elf format and loads start.elf start.elf loads kernel.img . It then also reads config.txt , cmdline.txt and bcm2835.dtb If the dtb file exists, it is loaded at 0×100 & kernel @ 0×8000 If disable_commandline_tags is set it loads kernel @ 0×0 Otherwise it loads kernel @ 0×8000 and put ATAGS at 0×100 kernel.img is then run on the ARM. Everything is run on the GPU until kernel.img is loaded on the ARM. I found this diagram quite useful: | {
"source": [
"https://raspberrypi.stackexchange.com/questions/10442",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/10318/"
]
} |
10,480 | I just got my Camera Board and a Model A Raspberry Pi to use as a security camera for my house. I had been using Motion with a Logitech C170 USB camera on my Model B board and it worked great except for the quality. I was expecting the Raspberry Pi Camera Board to show up as /dev/video0 but when I run Motion I get an error: Failed to open video device /dev/video0: No such file or directory The camera works fine with raspistill -d . This has to work with Motion as it has to take videos/pictures when movement is detected and I have to be able to access it from work. This question was no good for me as it never answered my question and I'm not using python. | You can access the camera board on /dev/video0 by running the command: sudo modprobe bcm2835-v4l2 This will have to be run on every boot of the device. Or you can put modprobe bcm2835-v4l2 in /etc/rc.local to make it run on every boot automatically. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/10480",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/966/"
]
} |
11,631 | I go back and forth from home to school with my Pi. I just got the WiFi working last night at home using wpa.conf instead of wpa_supplicant.conf as the book I was using had the walk thru for that instead. I've noticed lots seem to use wpa_supplicant but I not sure why... Anyway, I know how to make the WiFi IP static for my home network but how do I set things up for auto-connecting to my school WiFi and use a different static IP for that network? For the network do I just add another network={} in my wpa.conf file?
For the second static IP how do I bind that to the school network? | This post was OK at the time for Wheezy. DO NOT USE Edit /etc/wpa_supplicant/wpa_supplicant.conf and add id_str="school" under the schools wpa info and id_str="home" under your homes wpa info. Your file should now look similar to this: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SCHOOLS NETWORK NAME"
psk="SCHOOLS PASSWORD"
id_str="school"
}
network={
ssid="HOME NETWORK NAME"
psk="HOME PASSWORD"
id_str="home"
} Then set up /etc/network/interfaces with iface school inet static and iface home inet static in it so it looks like the following: This applies to Raspbian Wheezy prior to 2015-05-05 for later (and Jessie) See How do I set up networking/WiFi/Static IP auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface school inet static
address <school address>
gateway <school gateway>
netmask <school netmask>
iface home inet static
address <home address>
gateway <home gateway>
netmask <home netmask> | {
"source": [
"https://raspberrypi.stackexchange.com/questions/11631",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/4191/"
]
} |
11,684 | What I want to do is to connect through SSH and HTTP to my Raspberry Pi without having to connect it to the router. I use the Adafruit's Web IDE to create and run my programs, and I'd like to access the web page with my Pi only connected to the PC via Ethernet. Actually, I need also to have Internet connection to the Pi, as Adafruit's IDE needs Bitbucket authentication. I tried bridging the Wi-Fi interface (because I connect to the internet through Wi-Fi in my PC) and the Ethernet interface but it didn't work. I've tried it with a Mac and the Internet sharing option and it works fine because I can go to the web page typing http://raspberrypi.local .
But now I'm in a laptop with Windows 8 and it's impossible to work out a way. I know there are lots of questions like this one but no one was accurate enough to my case. Thank you in advance. | Here are the steps to share your PC's wireless internet connection with a Pi: Connect the Pi to PC's ethernet port using a regular ethernet cable Go to "Network Connections" on the Windows PC and select the "Wireless Network Connection" Right-click and select properties. In the "Sharing" tab under "Internet Connection Sharing" enable both checkboxes. Restart your PC. This step is very important. Now your Pi will obtain an IP address from your PC and can access internet through your PC If need to find the IP address of the Pi to SSH or to remote login from the PC, run "ping raspberrypi" command where "raspberrypi" is the hostname of your Pi. Note that you have to have samba running on your Pi for the ping command to work. If you need additional details with screenshots on how to share internet connection please see the post, Connecting to Pi from Laptop's Ethernet Port , that explains how to connect to Pi through the Ethernet port on a Windows machine. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/11684",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/10532/"
]
} |
11,845 | I have a raspberry pi, I've downloaded quite a few extras on it. I would like to be able to check how much memory I have left on my SD card. Is there a command that tells you memory available? Is the info in a file somewhere? Or do I have to check it with another computer? | df -h /dev/root Filesystem Size Used Avail Use% Mounted on
/dev/root 2.3G 2.1G 86M 97% / | {
"source": [
"https://raspberrypi.stackexchange.com/questions/11845",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/10718/"
]
} |
12,258 | I'm trying to follow the instructions here in order to install puredata on my Pi. I'm getting the following error: W: GPG error: http://backports.debian.org squeeze-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 When I try sudo apt-get update with the repositories in: http://ftp.uk.debian.org/debian/ http://backports.debian.org/debian-backports So I tried sudo wget -O - http://backports.org/debian/archive.key | apt-key add - but there is no server at backports.org. So my question is where is the archive.key for these repositories? | Try this answer: No PUbKey Error . I am not sure but I think you only need the generic debian key here. I tried it on my system and it added ok. Let me know if that resolves it for your use. So, to be clear, and using the OP as source for the key in the following example: gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553
gpg -a --export 8B48AD6246925553 | sudo apt-key add - | {
"source": [
"https://raspberrypi.stackexchange.com/questions/12258",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/11233/"
]
} |
13,137 | Normal filesystem images can be easily mounted: mount system.img /mnt Examined, and modified. But when I try this with a Raspberry Pi system image (e.g. raspbian), I get: mount: unknown filesystem type '(null)' And no matter what I try with -t , it won't work. How can I mount this image? | This question is answered as part of the answer to other questions, but it deserves canonical treatment here so it does not have to keep being repeated. You can't mount the image as a whole because it actually contains two partitions and a boot sector. However, you can mount the individual partitions in the image if you know their offset inside the file. To find them, examine the image as a block device with fdisk -l whatever.img . The output should include a table like this: Device Boot Start End Blocks Id System
whatever.img1 8192 122879 57344 c W95 FAT32 (LBA)
whatever.img2 122880 5785599 2831360 83 Linux These are the two partitions. The first one is labelled "FAT32", and the other one "Linux". Above this table, there's some other information about the device as a whole, including: Units: sectors of 1 * 512 = 512 bytes We can find the offset in bytes by multiplying this unit size by the Start block of the partition: 1st partition 512 * 8192 = 4194304 2nd partition 512 * 122880 = 62914560 These can be used with the offset option of the mount command. We also have a clue about the type of each partition from fdisk . So, presuming we have directories /mnt/img/one and /mnt/img/two available as mount points: mount -v -o offset=4194304 -t vfat whatever.img /mnt/img/one
mount -v -o offset=62914560 -t ext4 whatever.img /mnt/img/two If you get an "overlapping loop" error here, your version of mount requires you to specify the size as well as the offset of the first partition. Unmount that, and use the number of blocks (57344) * 512 (= 29360128): mount -v -o offset=4194304,sizelimit=29360128 \
-t vfat whatever.img /mnt/img/one The second partition doesn't need a sizelimit since there's nothing after it in the image. You can now access the two partitions. If you do not intend to change anything in them, use the -r (read-only) switch too. If you do change anything, those changes will be included in the .img file. Note that the first partition is probably mounted on /boot in the second partition when the system is running. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/13137",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/5538/"
]
} |
13,358 | I'm trying to run: sudo update-rc.d avahi-daemon defaults But i get the error: insserv: warning: script 'mathkernel' missing LSB tags and overrides I've read that it has something to do with the wolfram engine.
Any solutions? | If look at the /etc/init.d/skeleton script, in the beginning of it there are two marks : ### BEGIN INIT INFO and ### END INIT INFO . All the data inside those marks is the configuration for runtime dependences and you can look them up in the Debian Wiki . Your script is missing these tags and configuration so insserv just uses some defaults. This is just a warning and is not something to worry about, but you can fix it very easily and then you can be Linux Standards Base -compliant (That's what LSB means). The easiest way to fix the warning, is to copy the LSB tags from the skeleton script to the beginning of your mathkernel script and just change skeleton to mathkernel . | {
"source": [
"https://raspberrypi.stackexchange.com/questions/13358",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/11125/"
]
} |
13,398 | I am attempting to stop people from being able to browse directories on my server. I have a fully functioning public facing LAMP on my pi but when you type in a dir name or my ip address you can see the DIR info. Here is a live example http://anthonyrussell.info/postimages/ I was told to change this by editing the httpd.conf file but when I search for it, it doesn't exist. What am I missing? | On Debian (the operating system Raspbian is based on) and Raspbian the config file is apache2.conf (not httpd.conf ) and it should be in /etc/apache2 . | {
"source": [
"https://raspberrypi.stackexchange.com/questions/13398",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/9045/"
]
} |
13,558 | Raspberry Pi Model B OS: Raspbian I am running my Pi headless (currently through a direct Ethernet connection). I have a USB WiFi dongle. I would like to have the WiFi start up at boot and connect by DHCP. http://rpi.tnet.com/project/faqs/headlessportablewifi suggests that I don't need to actually change /etc/network/interfaces from the default: auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp I have configured /etc/wpa_supplicant/wpa_supplicant.conf for my network. When I boot the Pi, WiFi does not immediately connect. But if I SSH in and run sudo ifup wlan0 , the Pi connects fine. Isn't this something the Pi should do in its own boot process? I could presumably write tell some dotfile to run this command, but I would like to do it the proper way (and learn how my system works). I know I can also set a static IP address for each WiFi network I want to use: How to setup multiple WiFi networks? . But I would prefer to have a simple solution where I only have to enter a couple lines on /etc/wpa_supplicant/wpa_supplicant.conf to add a new WiFi network. What is the piece I am missing here? | The default Raspbian /etc/network/interfaces configuration does not connect to WiFi on boot. The key lines of the interfaces man-page are: Lines beginning with the word "auto" are used to identify the
physical interfaces to be brought up when ifup is run with the
-a option. (This option is used by the system boot scripts.) ... Lines beginning with the word "auto" are used to identify the
physical interfaces to be brought up when ifup is run with the
-a option. (This option is used by the system boot scripts.) The first missing piece was the line auto wlan0 . As far as I know, it can go anywhere in the file. That works until you try booting without the ethernet cable plugged in. Then, WiFi doesn't connect on boot and has to be manually triggered by running sudo ifup wlan0 or unplugging and reinserting the Wi-Fi dongle. The problem is caused by the ifplugd daemon, which turns network devices on and off when you plug them in or remove them. You can reconfigure it, or you can simply remove it with sudo apt-get purge ifplugd . If you have removed ifplugd , you should add the following lines to /etc/network/interfaces so that the ethernet connection will also connect when plugged in: auto eth0
allow-hotplug eth0 I'm not sure if the auto lines are strictly necessary or if hotplug handles booting correctly in the absence of ifplugd , but this worked for me. My working file reads: auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp | {
"source": [
"https://raspberrypi.stackexchange.com/questions/13558",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/12696/"
]
} |
13,563 | I have got a new Raspberry Pi, and I am eager to work on it, but I am not able to connect to the network from it. I connect to the Raspberry Pi using SSH. When I try doing the apt-get update
apt-get install tightvnc I get the error Temporary failure resolving 'mirrordirector.raspbian.org' It looks like many of them have had this issue. I tried several ways suggested by those who got it working that way. I checked this link and this link and edited the resolv.conf file. The resolv.conf file was having the line nameserver 10.42.0.1 before I edited it. I added the lines, nameserver 8.8.8.8
nameserver 8.8.4.4 I connected to the Raspberry Pi using the IP address 10.42.0.69. I don't think so that should be added to resolv.conf file as well. I have tried editing the /etc/network/interfaces file as well to set a static IP address, but I reverted it back after I found out that I can also assign a static IP address using this command sudo ifconfig eth0 192.168.x.x netmask 255.255.255.0 . I like this one because I didn't have to make the interfaces file dirty. The /etc/network/interfaces looks like this: auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp So, yes, this is a DHCP from a home router. OS: Raspbian I cannot ping 8.8.8.8 or any other external IP address. However, I can ping the IP address to my laptop to which I have connected the Raspberry Pi. I have tried re-flashing the SD card, but I reached nowhere. | The default Raspbian /etc/network/interfaces configuration does not connect to WiFi on boot. The key lines of the interfaces man-page are: Lines beginning with the word "auto" are used to identify the
physical interfaces to be brought up when ifup is run with the
-a option. (This option is used by the system boot scripts.) ... Lines beginning with the word "auto" are used to identify the
physical interfaces to be brought up when ifup is run with the
-a option. (This option is used by the system boot scripts.) The first missing piece was the line auto wlan0 . As far as I know, it can go anywhere in the file. That works until you try booting without the ethernet cable plugged in. Then, WiFi doesn't connect on boot and has to be manually triggered by running sudo ifup wlan0 or unplugging and reinserting the Wi-Fi dongle. The problem is caused by the ifplugd daemon, which turns network devices on and off when you plug them in or remove them. You can reconfigure it, or you can simply remove it with sudo apt-get purge ifplugd . If you have removed ifplugd , you should add the following lines to /etc/network/interfaces so that the ethernet connection will also connect when plugged in: auto eth0
allow-hotplug eth0 I'm not sure if the auto lines are strictly necessary or if hotplug handles booting correctly in the absence of ifplugd , but this worked for me. My working file reads: auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp | {
"source": [
"https://raspberrypi.stackexchange.com/questions/13563",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/12687/"
]
} |
13,895 | I had this problem when I got my new Wi-Fi dongle and have seen a few people with the same issue. Basically when I have one interface configured and want to swap to the other one, it throws up this error: RTNETLINK answers: File exists Failed to bring up eth0 or something similar. /etc/network/interfaces file: auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
iface wlan0 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1 | I think a solution can be found in this blog post Solving “RTNETLINK answers: File exists” when running ifup ; it certainly fixed it for me. Basically you can only have one gateway assigned in your interfaces file. Remove any duplicate lines that determine the gateway so that it only appears once. Modified /etc/network/interfaces file: auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
iface wlan0 inet static
address 192.168.1.3
netmask 255.255.255.0
#gateway 192.168.1.1 <= Either comment or remove this line All credit to Lennart for solving this issue! | {
"source": [
"https://raspberrypi.stackexchange.com/questions/13895",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/11165/"
]
} |
13,936 | I need to find the Raspberry PI IP address on local network without connect the Raspberry to a monitor. How do I do it on Linux or Mac OS systems? | All raspberry devices MAC addresses started with B8:27:EB (for RPi4 B they start with dc:a6:32 , replace where appropriate). So, on * nix systems, this can be accomplished by executing the following command: nmap -sP 192.168.1.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}' where 192.168.1.* will be your local network mask. You will get an answer like: Nmap scan report for raspberrypi.localnetwork.lan (192.168.1.179) The 192.168.1.179 is the Raspberry Pi IP address on you network. If you are on a Mac system you can use Homebrew to install nmap : brew install nmap On Windows , you might use Wireshark and use the following display filter: eth.addr[0:3] == B8:27:EB | {
"source": [
"https://raspberrypi.stackexchange.com/questions/13936",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/4001/"
]
} |
13,941 | So, I've successfully set up a Raspberry Pi over SSH and have installed and configured Raspbian (2014-01-07-wheezy-raspbian) on it. I intend to keep this a headless system. I'm currently travelling and don't have access to a router or a stable internet connection besides my phone's Wi-Fi hot spot feature. I don't have a USB Wi-Fi adapter for the Pi either. Thus, the only way I can connect my Pi to the internet would be via my laptop which is connected to the hot spot via Wi-Fi and to the Pi via an Ethernet cable. After making all the physical connections, I have enabled ICS on the Wi-Fi network to share the connection over Ethernet. The IP for the LAN is set to be assigned automatically whereas I've set the Raspberry Pi's IP as static in the cmdline.txt file. The following are the IPs of all the devices in question. Windows Phone (192.168.137.1) Laptop Wi-Fi (192.168.137.47) Ethernet (169.254.88.195) Raspberry Pi (169.254.88.200) My laptop is able to ping both an internet server as well as the Pi whereas the Pi is not able to reach an internet server. Any ideas? Networking is not really my strong suit so I would really appreciate some proper explanations and solutions, if possible. On Windows Windows IP Configuration
Host Name . . . . . . . . . . . . : Sidhartha-NB
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Mixed
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : mshome.net
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek PCIe FE Family Controller
Physical Address. . . . . . . . . : F0-DE-F1-9D-1E-FC
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::b18f:4472:8367:58c3%15(Preferred)
Autoconfiguration IPv4 Address. . : 169.254.88.195(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 418438897
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-9B-EA-C5-74-DE-2B-91-FE-D1
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%2
fec0:0:0:ffff::2%2
fec0:0:0:ffff::3%2
NetBIOS over Tcpip. . . . . . . . : Enabled
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . : mshome.net
Description . . . . . . . . . . . : Atheros AR9285 Wireless Network Adapter
Physical Address. . . . . . . . . : 74-DE-2B-91-FE-D1
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::3801:7d16:54af:653b%13(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.137.47(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : 25 February 2014 01:38:43
Lease Expires . . . . . . . . . . : 04 March 2014 01:38:43
Default Gateway . . . . . . . . . : 192.168.137.1
DHCP Server . . . . . . . . . . . : 192.168.137.1
DHCPv6 IAID . . . . . . . . . . . : 292871723
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-9B-EA-C5-74-DE-2B-91-FE-D1
DNS Servers . . . . . . . . . . . : 192.168.137.1
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
Physical Address. . . . . . . . . : 60-D8-19-ED-78-4E
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.{A627A3AA-3D22-4C8D-BE44-C8AB3B8CE420}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft ISATAP Adapter
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.mshome.net:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : mshome.net
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter Teredo Tunneling Pseudo-Interface:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv6 Address. . . . . . . . . . . : 2001:0:9d38:6abd:14f4:11ca:3f57:76d0(Pref
erred)
Link-local IPv6 Address . . . . . : fe80::14f4:11ca:3f57:76d0%14(Preferred)
Default Gateway . . . . . . . . . : ::
NetBIOS over Tcpip. . . . . . . . : Disabled
Tunnel adapter isatap.{17C6D3A4-3281-4D06-BBCC-182D42C5F72A}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter 6TO4 Adapter:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft 6to4 Adapter
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Pinging 169.254.88.200 with 32 bytes of data:
Reply from 169.254.88.200: bytes=32 time=1ms TTL=64
Reply from 169.254.88.200: bytes=32 time<1ms TTL=64
Reply from 169.254.88.200: bytes=32 time<1ms TTL=64
Reply from 169.254.88.200: bytes=32 time<1ms TTL=64
Ping statistics for 169.254.88.200:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms On Raspberry Pi pi@raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
pi@raspberrypi ~ $ ping 8.8.8.8
connect: Network is unreachable
pi@raspberrypi ~ $ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
pi@raspberrypi ~ $ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether b8:27:eb:dc:e5:68 brd ff:ff:ff:ff:ff:ff
inet 169.254.88.200/16 brd 169.254.255.255 scope global eth0
valid_lft forever preferred_lft forever | All raspberry devices MAC addresses started with B8:27:EB (for RPi4 B they start with dc:a6:32 , replace where appropriate). So, on * nix systems, this can be accomplished by executing the following command: nmap -sP 192.168.1.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}' where 192.168.1.* will be your local network mask. You will get an answer like: Nmap scan report for raspberrypi.localnetwork.lan (192.168.1.179) The 192.168.1.179 is the Raspberry Pi IP address on you network. If you are on a Mac system you can use Homebrew to install nmap : brew install nmap On Windows , you might use Wireshark and use the following display filter: eth.addr[0:3] == B8:27:EB | {
"source": [
"https://raspberrypi.stackexchange.com/questions/13941",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/12928/"
]
} |
14,611 | I recently bought a Raspberry Pi, type B model. I want to set it up directly to my laptop screen, without any other monitor. I have not set it up yet. How do I connect my laptop's screen as the Raspberry Pi's display? I do not want to buy an HDMI cable. Instead I want to try from Ethernet or the USB. | This is only for command-line interface, not for the Graphical UI. The easiest way would be connecting via SSH with a program called PuTTY (Windows), M-remote (Windows) or using the Terminal application in OS X or any Linux (no installation, already available). Terminal: enter the command ssh pi@raspberrypi Putty: select protocol SSH and enter hostname raspberrypi M-Remote: select SSH (2) , hostname raspberrypi , username pi , password raspberry Now connect. If this FAILS, try finding out what IP address is assigned to the Raspberry Pi. (For example, by using your browser to take a look at your modems website (if you don't know where, you could try http://192.168.0.1/ or http://192.168.1.1/ or http://192.168.0.254/ or http://192.168.1.254/ or http://192.168.0.138/ or http://10.0.0.1/ or http://10.0.0.138/ or http://10.0.0.254/ or http://10.0.1.1/ or http://10.0.1.254/ ) Look up the device named something like raspberrypi and copy the IP address. Paste it into the command you tried from above where it now states raspberrypi and you're good to go! Now (or after you've entered the password raspberry ) you're connected to the command line interface of the Raspberry Pi, and you can do (almost) anything you could when you would be connected with a monitor, mouse and keyboard and NOT booted into the graphical user interface. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/14611",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/13552/"
]
} |
15,192 | I am trying to install Raspbian from NOOBS, but I have no other screen/keyboard available than my laptop screen/keyboard. I find enough information about using a laptop screen/keyboard for a Pi, but then you already need to have an OS installed. But I have no OS installed, because my SD card contains NOOBS and I want to install Raspbian using NOOBS. How can I do that with only my laptop screen and keyboard? I'm running Windows 7 on my laptop. | This no longer works since ssh is not enabled. Using only the laptop's screen and keyboard (both before and
after installation), install and configuration for headless
operation using SSH is possible using NOOBS (they call it
"silent install"). It does not require a separate screen or keyboard/mouse. It does require an SD card reader on the
laptop (built in or external USB), though. The only thing required on the Raspberry Pi side is an Ethernet connection (to SSH into it from a host
system). Alternatively, using special hardware
(USB-to-serial adapter), it possible to use
some GPIO pins on the Raspberry Pi. [3] This can be done deleting a few folders, editing two files
on the SD card and setting some symbolic links in /etc/init.d (make a backup copy first of the SD card content
if you only have the SD card with NOOBS on it). The security
conscious may want to change the default password before installation. Prerequisites: A host computer capable of running an SSH client and of
reading/writing the file system on the Raspberry Pi's SD
card ( ext4 ). The operating system could be Windows, Mac
or Linux. This could be a computer that is normally
running Windows, but which has a DVD drive so Ubuntu can
be started in trial mode using a LiveCD . An Ethernet connection to the Raspberry Pi and accessible
by the host computer TCP/IP -wise (the host computer could
itself use Ethernet or a wireless connection). A text editor on the host system that can correctly
handle Unix end-of-line characters. For example, UltraEdit on Windows that I have used for testing. Notepad++ and Vim on Windows should
also be fine. An SD card reader (to make crucial changes to the SD card
during the process, both pre-install og post-install). HowTo Pre-install For instance, to automatically install Raspbian (the
recommended choice) when power is applied to the Raspberry
Pi with the SD card in, do the following offline (on the host system,
Windows, Mac or Linux): Download and prepare NOOBS ( NOOBS 1.3.10 ,
released 2014-09-09, is a 704 MB download)
on a sufficiently large SD card, 4 GB or greater. This can involve using SDFormatter with option
"FORMAT SIZE ADJUSTMENT" set to "ON"
to format the entire SD card as one big FAT32 formatted
partition). See the linked page for details. In the os folder on the SD card with NOOBS, delete all
folders except Raspbian (folders Arch , RaspBMC , Pidora , OpenELEC , RISC_OS , and data_partition for NOOBS 1.3.7.
And only Data_Partition for NOOBS 1.3.10). Edit file \os\Raspbian\flavours.json , so it only
contains the desired version of Raspbian, "Raspbian"
(not "Raspbian - Boot to Scratch"). Before: {
"flavours": [
{
"name": "Raspbian - Boot to Scratch",
"description": "A version of Raspbian that boots straight into Scratch"
},
{
"name": "Raspbian",
"description": "A Debian wheezy port, optimised for the Raspberry Pi"
}
]
} After: {
"flavours": [
{
"name": "Raspbian",
"description": "A Debian wheezy port, optimised for the Raspberry Pi"
}
]
} Delete the extra file(s) that your text editor may produce (such as a .bak file). Edit file recovery.cmdline (in SD card root folder) to append silentinstall to the arguments list. Before (may differ depending on NOOBS version): runinstaller quiet vt.cur_default=1 coherent_pool=6M elevator=deadline After (may differ depending on NOOBS version): runinstaller quiet vt.cur_default=1 coherent_pool=6M elevator=deadline silentinstall Delete the extra file(s) that your text editor may produce (such as a .bak file). Optional: To hold the option open of connecting a TV to the
video output, also add display=3 (3 for PAL, 4 for NTSC): runinstaller quiet vt.cur_default=1 coherent_pool=6M elevator=deadline silentinstall display=3 Optional: change the default user name and password by editing \os\Raspbian\os.json : Before: {
"name": "Raspbian",
"url": "http://www.raspbian.org/",
"version": "wheezy",
"release_date": "2014-01-07",
"kernel": "3.10",
"description": "A community-created port of Debian wheezy, optimised for the Raspberry Pi",
"username": "pi",
"password": "raspberry"
} After: {
"name": "Raspbian",
"url": "http://www.raspbian.org/",
"version": "wheezy",
"release_date": "2014-01-07",
"kernel": "3.10",
"description": "A community-created port of Debian wheezy, optimised for the Raspberry Pi",
"username": "pi",
"password": "DerSkalMangeFlereJobsTilI2014tOverHeleVerden11111111111111111111df11111111111111111111"
} Delete the extra file(s) that your text editor may produce (such as a .bak file). Put the SD card into the Raspberry Pi, connect it with an
Ethernet cable such that the host system with the SSH client
can see it and such that DHCP is available to the
Raspberry Pi (for instance, most NAT -routers have a DHCP server
built in). Perhaps disconnect the system from the
Internet until the password has been changed. Power the Raspberry Pi on to start the installation.
And wait! This can take a while, like half an hour or more.
To be sure, leave it alone for a few hours. An install time
of 19 minutes and 20 seconds has been measured when
using NOOBS 1.3.10 (from power up till the first
successful ping). The current drawn was 400 - 480 mA
and fell to 370 mA after the first ping succeeded. Post-install Find the Raspberry Pi's IP address (assigned by DHCP)
somehow. For instance, guess it from the IP address range
that a DHCP server in a NAT router uses and ping those addresses
(mine is set up to use
192.168.0.100 - 192.168.0.255 and often it is
assigned 192.168.0.100 or 192.168.0.101). Wireshark can also be used for this purpose, especially if it
is in an environment with a lot of devices. This is much easier to do
if the MAC address of the Raspberry Pi is known, and it can be
obtained by temporary using step 4 below. This step is not necessary if a fixed IP address is set in step 4 below. Ping from the host to test if there is a connection. SSH is not enabled by default for Raspbian in NOOBS version 1.3.7 - despite what some pages claim. (It may be different for Arch Linux.) However, it is for Raspbian in NOOBS version 1.3.10, and this step may no longer be necessary (however, any purchased Raspberry Pi may be delivered with an SD card with an older version of NOOBS, and it may be worth saving the 700 MB download). The easiest way to enable it is described in Oli's
answer to Prepare for ssh without a screen (on this site) and is to change the symbolic links
in /etc/init.d (in root ). For instance, booting from the Ubuntu 13.04 LiveCD with
a USB card reader on the host system and issuing these
commands in Terminal will be sufficient: sudo su
cd /media/ubuntu/root
for i in 2 3 4 5; do sudo ln -s /etc/init.d/ssh etc/rc$i.d/S02ssh; done Optional: set a fixed IP address if this makes it
easier and the kind of network allows it. On a home
network this could be by assigning an IP address outside
of the IP address range used by a NAT router's DHCP server,
for example, 192.168.0.93. In file cmdline.txt (in folder boot off the root of the SD card) add this at the end of the long line: ip=192.168.0.93 The end result may be something like: dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait ip=192.168.0.93 Like for step 3, the file to edit would be /media/ubuntu/root/boot/cmdline.txt . Note: without extra parameters after the IP address there is no connection to the Internet and thus step 11 below will fail. If the LiveCD method has been used for step 3 and 4: Shutdown
Ubuntu (to write out the changes and unmount the SD
card). Start the Raspberry Pi up with the SD card inserted. SSH to the Raspberry Pi using the IP address found in step 1 or step 4 (for instance, using PuTTY on Windows) and log in: login as: pi
[email protected]'s password: raspberry (or the password that was set in os.json, see 6 in *Pre-install*.) Change to a new password: su pi
passwd Optional: do further configuration of the Raspberry Pi sudo raspi-config Optional: enable TV output Open config.txt in vi : sudo vi /boot/config.txt Outcomment this line (NOOBS may have inserted an
extra line with this enabled), so it reads (insert # at the beginning of the line): #hdmi_force_hotplug=1 Uncomment this line ( 2 is for PAL; use 0 for NTSC),
so it reads (remove the # at the beginning of the line): sdtv_mode=2 :wq Restart to see the effect: sudo shutdown -r now Even Raspbian delivered with NOOBS 1.3.10 has the very serious Shellshock vulnerability that is in Bash , and you do not want the Raspberry Pi to be left unpatched. To test whether the Raspberry Pi is vulnerable to Shellshock, issue: env x='() { :;}; echo "WARNING: SHELLSHOCK DETECTED"' bash --norc -c ':' 2>/dev/null; To refresh the repositories and upgrade Bash, issue: sudo su
apt-get update && apt-get install --only-upgrade bash When testing this, I used: NOOBS 1.3.7 and NOOBS 1.3.10. UltraEdit on Windows as it handles text files with Unix
line endings without any problems. Windows XP 64-bit (yes, I know) Sources: NOOBS at GitHub , sub section How to Automatically Install an OS Running the Raspberry Pi headless with Debian Linux (However, this presumes SSH is enabled by default
which is not the case with version 1.3.7 of NOOBS). New Out Of Box Software (NOOBS) headless install onto a Raspberry Pi . YouTube video. It uses special hardware (USB cable with a built-in USB-to-serial converter) to connect to the TX/RX pins on the GPIO. Effectively, it is like connecting an old-fashioned dump terminal to the Raspberry Pi. Raspberry Pi Remote Connections – Without A Network! .
Describes how to connect a computer directly to the Raspberry
using a normal Ethernet cable (a special cross-over is not needed) and
how to set a static IP address on the Raspberry Pi (however, the example
precludes connection outside the current subnet and thus connection
to the Internet). Mounting the root filesystem via NFS (nfsroot) ,
near "This parameter tells the kernel".
Formal documentation for setting a static IP address as
in source 4 and 8 other parameters that should allow
connection to the Internet, but it is not clear exactly
what those parameters should be... Setting Up Ethernet ,
near "Method 1: Editing /boot/cmdline.txt".
Example of the more advanced uses of "ip=" from
which it may be possible to deduct how to set it up
such that a connection to the Internet is possible. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/15192",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/13917/"
]
} |
15,250 | I have 16 GB SD card where I installed Raspbian using Win32 Disk Imager. After burning the image in Windows it shows only around 40+ MB of free space. Since Raspbian image is around 2 GB where is rest of the memory? In Linux, using GParted I am getting following result (here it shows 12.54 GB unused that itself is the blank memory in card): | The image creates 2 disk partitions SDB1 and SDB2 in the image above. SDB1 is formatted as a fat16 filesystem, this partition is the only one seen by Windows and hence the small amount of free space it reports. Gparted sees both the fat formatted partition and the ext4 formatted partition. By default the image does not use all of the space available on larger SD cards - such as yours. There is an option in the raspi-config file which will run the first time you boot your Pi to expand the root partition and use the SD card's full capacity. If you have already booted the Pi you can access the config options by running: sudo raspi-config To see how much space is available on the Pi enter the following at the command line: df -h ref: df man page | {
"source": [
"https://raspberrypi.stackexchange.com/questions/15250",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/14240/"
]
} |
15,568 | I have raspberry Pi model B whith raspbian OS which has been working well for 2-3 months and since last week I've noticed that every time when logging in ( over ssh ) when inputting username there is a delay ( well over 1 minute ) before system respond with password line. Is this a sign of malfunctioning SD card or something else...? ( Also, I've noticed that doing certain commands, like arp,netstat etc is taking a longer time to compute..) | It could be that your Pi is trying to do a reverse DNS lookup of the client's connecting hostname for security reasons, which is okay, but leads to the timeouts if you don't have a working reverse DNS. when you do finally login, try adding UseDNS no to your /etc/ssh/sshd_config file, and see if that helps improve things, of course don't forget to reload and you are good to go! service ssh reload And you should have a near instant SSH You can also try SSH-ing with the -v verbose option to provide output to the client that may help in diagnosing where the timeouts are occuring. This behaviour isn't unique to the Raspberry Pi nor Raspbian also see SuperUser: Top causes of slow ssh logins where UseDNS no is the common solution. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/15568",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/14274/"
]
} |
17,017 | I'm using 2 separate scripts, Scale1.py and Scale2.py . To run them I enter sudo python Scale1.py or sudo python Scale2.py from the terminal command line. I would like to have a line in the Scale2.py script in which if I press a button, the program breaks and runs Scale1.py . Something like this, which doesn't work. if GPIO.input(23) == False:
break(sudo python Scale1.py) | os.system("sudo python scale1.py") first you will need to import the os module import os I don't have a pi with me atm to test, but this comes from the second answer to this question: https://stackoverflow.com/questions/89228/calling-an-external-command-in-python | {
"source": [
"https://raspberrypi.stackexchange.com/questions/17017",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/14624/"
]
} |
19,354 | How can I fix a Raspberry Pi with Rainbow screen on boot up? I have good voltage coming in and I believe I've formatted and setup the SD card properly. I have two of these boards that do the same thing; I bought them months ago but I am only getting to them now. I bought them off of Amazon and It's way to late to return or exchange them I've been told. | Do you mean a screen like this?: If you using a RPi 3 B+, it may just be out of date firmware (see here ) - you need to use newer image with the right firmware such as the offical Raspbian image - older and derivative images may still need to be updated for now (e.g. OctoPrint [1] [2] [3] ) Various troubleshooting methods can be found here : With current firmware, a coloured splash screen (actually its just
four pixels "blown up" by the GPU to full screen) is displayed after
GPU firmware ( start.elf ) is loaded. This should be replaced by linux
console a second later. However if the coloured screen remains, it
suggests the kernel.img file is failing to boot. Try replacing it with
a known good one. Immediately after displaying the splash screen, the PI starts
consuming a little more current. If the PI resets at that moment, it
is an indication that the power supply isn't able to deliver the full
current your PI requires, but dips its output voltage below a minimum
when loaded with the full current the PI needs. In some cases (Stuck on the Rainbow Screen), freezing at this point
has been fixed by adding boot_delay=1 to the config.txt file. This
can be done from a Windows PC, which should show several files in the
FAT partition on your SD card including bootcode.bin , kernel.img , and config.txt . You can open config.txt in wordpad or any text editor. Add boot_delay=1 and save the file. Don't forget to 'eject' the card
before removing it from the card reader. If you are reading the SD card
from a working Pi, you can edit the file with sudo nano
/boot/config.txt Kernel Panic on boot Text appears on screen, but then hangs with debug messages. This can
be caused by USB devices such as keyboards. Try again with nothing in
the USB. Raspberry Pi shuts down (or restarts) soon after booting up This is caused by a power supply producing too low a voltage. See Troubleshooting power problems Pi boots sometimes but not always With a known good power supply and known good SD card, the R-Pi boots
occasionally, but other times shows only a tiny green flicker from the
"OK" LED and it fails to start, even with no USB devices and no
Ethernet. This has been reported several times [4] [5] [6] and remains
an open issue. Low voltage or an improper SD card can cause it. Some
SD cards will work until they warm up slightly, and then fail [7] . When exposed to 21 C room temperature the warmest part of an uncased working R-Pi should be 41 C [8] . The wiki has a list of working SD
cards. Buy from a reliable vendor as it has been claimed that 1/3 of
all "Sandisk" labelled memory cards are counterfeit. It could be that the SD memory card is not making proper contact with the Raspberry Pi. Look at the SD card holder on the Raspberry Pi
carefully. At first glance it may look fine, but the contacts must be
springy and they must protrude at least 2mm as measured from the lower
edge of the holder to the top of the contact bulge. Variations happen
due to the solder process and the type of holder used. Some of the
solder residue falls into the contact cavity, restricting the
springiness and the height that the contact protrudes. You can fix
this yourself, but remember you can void your warranty. The contacts
are delicate, so be careful. Insert a needle pin under the contact
bulge and pull lightly up until the one end of the contact unclips.
Clean the cavity where the contact unclipped from any solder or other
residue by blowing into the cavity. Clip the contact back into the
cavity by lightly pushing it into the cavity. Do this for all the
contacts. Refer to these photos: Media:SDcardHolder.JPG , Media:UnclipContact.JPG , Media:UnclippedContact.JPG I would try other SD cards and power supplies, and check the Pi for defects, as well as different raspberry pi image . You may also want to try a different SD card reader, as some may format the card unreliably. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/19354",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/17338/"
]
} |
19,705 | I purchased a small USB sound card. My Pi recognizes the device: $ lsusb
Bus 001 Device 004: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller If I run alsamixer and set the audio to USB PnP Sound Device , I can hear audio through the USB sound card. To make it permanent I type: $ sudo alsactl store But after reboot, the default is no longer the USB sound card. So then I try to see a list of playback devices: $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0 I edit /etc/asound.conf to look like this to set the default: $ sudo nano /etc/asound.conf
pcm.!default {
type hw
card 1
device 0
} Do a reboot and still my default is not the USB sound card. When I try: $ aplay /usr/share/sounds/alsa/Front_Center.wav -D sysdefault:CARD=1 I hear sound from the USB card. I also tried the following: $ sudo nano /etc/modprobe.d/alsa-base.conf change the index from -2 to 0: options snd-usb-audio index=0 Reboot and still it did not set the default. I even commented out the line and no luck. So how do I set the USB card as my default Audio Device? Edit dpkg -s pulseaudio Displays: Package: pulseaudio
Status: install ok installed
Priority: optional
Section: sound
Installed-Size: 4413
Maintainer: Pulseaudio maintenance team <[email protected]>
Architecture: armhf
Multi-Arch: foreign
Version: 2.0-6
Depends: libasound2 (>= 1.0.24.1), libc6 (>= 2.13-28), libcap2 (>= 2.10), libdbus-1-3 (>= 1.1.1), libfftw3-3, libgcc1 (>= 1:4.4.0), libice6 (>= 1:1.0.0), libltdl7 (>= 2.4.2), liborc-0.4-0 (>= 1:0.4.16), libpulse0 (= 2.0-6), libsamplerate0 (>= 0.1.7), libsm6, libsndfile1 (>= 1.0.20), libspeexdsp1 (>= 1.2~beta3.2-1), libstdc++6 (>= 4.1.1), libsystemd-daemon0 (>= 31), libsystemd-login0 (>= 31), libtdb1 (>= 1.2.7+git20101214), libudev0 (>= 146), libwebrtc-audio-processing-0, libx11-6, libx11-xcb1, libxcb1, libxtst6, adduser, lsb-base (>= 3.2-13), consolekit, udev (>= 143), libasound2-plugins
Recommends: pulseaudio-module-x11, gstreamer0.10-pulseaudio, rtkit
Suggests: pulseaudio-utils, pavumeter, pavucontrol, paman, paprefs
Breaks: libltdl3 (<< 1.5.24-1)
Conffiles:
/etc/init.d/pulseaudio 8580c855e4547e8a3c84dca96d9bbd7e
/etc/default/pulseaudio ee26e4427d72cf16a59b1a8ce2712c66
/etc/xdg/autostart/pulseaudio.desktop 5e19ffbe14d21702be1edd3256c4265d
/etc/xdg/autostart/pulseaudio-kde.desktop fd20c58d32035e908a0866784e4e3511
/etc/pulse/system.pa 408f6d6119d7afce522ab1b394709134
/etc/pulse/default.pa a9ac2a96744beae0913865fafd3d2582
/etc/pulse/daemon.conf 6c9e4c973cabb406beee3ec81c63fcd7
/etc/dbus-1/system.d/pulseaudio-system.conf 69d56dc5342bf589a2e199541709a452
Description: PulseAudio sound server
PulseAudio, previously known as Polypaudio, is a sound server for POSIX and
WIN32 systems. It is a drop in replacement for the ESD sound server with
much better latency, mixing/re-sampling quality and overall architecture.
. Then: cat /proc/asound/modules Displays: 0 snd_bcm2835
1 snd_usb_audio | Turns out that the OP was thinking along the correct path with his trying $ sudo nano /etc/modprobe.d/alsa-base.conf and changing the index from -2 to 0 via adding options snd-usb-audio index=0 to the file. However, this wasn't working. The correct way to do it is to add options snd-usb-audio index=0 followed by options snd_bcm2835 index=1 . Essentially what doing this is forcing the default sound module ( snd_bcm2835 ) to be disabled while the usb sound module ( snd-usb-audio ) is enabled. What I believe was previously happening with just adding options snd-usb-audio index=0 was that the snd-usb-audio module and the snd_bcm2835 were conflicting, with both being enabled. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/19705",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/13281/"
]
} |
22,040 | I'm working on a project in which I need to take about 30 images per second (no movie) using the Raspberry Pi camera module. I'm using the Picamera library ( http://picamera.readthedocs.org/en/latest/api.html ) for that but the problem is, that taking a picture takes about 0.2 - 0.4 seconds which is way to long. I have already set the use_video_port property to True , which helped a bit, but the time is still to long. Does anyone of you know how to take pictures in a short time (about 0.025s) using Python and the Raspberry Pi camera module? | To take pictures in 0.025s with picamera you'll need a frame-rate greater than or equal to 80fps. The reason for requiring 80 rather 40fps (given that 1/0.025=40) is that currently there's some issue which causes every other frame to get skipped in the multi-image encoder so the effective capture rate winds up as half the camera's framerate. The Pi's camera module is capable of 80fps in later firmwares (see camera modes in the picamera docs), but only at a VGA resolution (requests for higher resolutions with framerates >30fps will result in upscaling from VGA to the requested resolution, so this is a limitation you'd face even at 40fps). The other problem you'll likely encounter is SD card speed limitations. In other words, you'll probably need to capture to something faster like a network port or in-memory streams (assuming all the images you need to capture will fit in RAM). The following script gets me a capture rate of ~38fps (i.e. just above 0.025s per pic) on a Pi with overclocking set to 900Mhz: import io
import time
import picamera
with picamera.PiCamera() as camera:
# Set the camera's resolution to VGA @40fps and give it a couple
# of seconds to measure exposure etc.
camera.resolution = (640, 480)
camera.framerate = 80
time.sleep(2)
# Set up 40 in-memory streams
outputs = [io.BytesIO() for i in range(40)]
start = time.time()
camera.capture_sequence(outputs, 'jpeg', use_video_port=True)
finish = time.time()
# How fast were we?
print('Captured 40 images at %.2ffps' % (40 / (finish - start))) If you wish to do something in between each frame, this is possible even with capture_sequence by providing a generator function instead of a list of outputs: import io
import time
import picamera
#from PIL import Image
def outputs():
stream = io.BytesIO()
for i in range(40):
# This returns the stream for the camera to capture to
yield stream
# Once the capture is complete, the loop continues here
# (read up on generator functions in Python to understand
# the yield statement). Here you could do some processing
# on the image...
#stream.seek(0)
#img = Image.open(stream)
# Finally, reset the stream for the next capture
stream.seek(0)
stream.truncate()
with picamera.PiCamera() as camera:
camera.resolution = (640, 480)
camera.framerate = 80
time.sleep(2)
start = time.time()
camera.capture_sequence(outputs(), 'jpeg', use_video_port=True)
finish = time.time()
print('Captured 40 images at %.2ffps' % (40 / (finish - start))) Bear in mind that in the example above, the processing is occurring serially before the next capture (i.e. any processing you do will necessarily delay the next capture). It is possible to reduce this latency with threading tricks but doing so involves a certain amount of complexity. You may also wish to look into unencoded captures for processing (which remove the overhead of encoding and then decoding JPEGs). However, bear in mind that the Pi's CPU is small (especially compared to the VideoCore GPU). While you may be able to capture at 40fps, there is no way you're going to be able to perform any serious processing of those frames at 40fps even with all the tricks mentioned above. The only realistic way of performing frame processing at that rate is to ship the frames over a network to a faster machine, or perform the processing on the GPU. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/22040",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/18985/"
]
} |
22,394 | I have a Model B Raspberry Pi, but what are the differences between this and the new Model B+? Also apart from the physical differences, what could I do with a B+ that I can't do with my Model B? | Here's a list of the key differences (taken from my own blog at http://www.recantha.co.uk/blog/?p=10323 ) 4 USB ports – for the first time, you’ll be able to have a keyboard, mouse and wifi dongle plugged in without needing a powered hub. Bear in mind, you will probably need a more powerful power supply for the B+ if you want to use all 4 ports. They’re recommending a 2A supply. Of course, if you’re just using a mouse and a keyboard then a 1A supply will probably be absolutely fine. Better USB hot plug capability – you should be able to plug in your wifi dongles in without reboots! A new Ethernet port with activity lights. The USB and Ethernet ports are now all in a straight line, rather than in the B’s staggered arrangement. The yellow composite video port has gone and there is now a combined 3.5mm jack that provides audio and the analogue video signal. The HDMI port, the CSI (camera) and DSI (display) ports have all moved slightly. The micro USB power socket has changed sides. This means that all the ports are on the same side of the Pi – so cable management is much better with the B+. The B+ sports a 40-pin GPIO header (compared to the B’s 26) and no longer has a P5 and P3 header. All the GPIO is on that one header now. The 26 pins to the left (nearest the corner) are backwards compatible so all your add-on boards will work (with the exception of any audio boards like the Wolfson which requires the P5 header which is, of course, not on the B+). 4 mounting holes, conveniently located on the corners of the board rather than the 2 oddly-placed holes on the B. On the back, the B+ uses a micro SD card (as opposed to the B’s full size SD card) with a push-push action (i.e. you push it in and it locks in place, you push it again and it clicks out). The card still protrudes slightly (presumably to make it easy to remove) but the (metal) slot is a vast improvement on the flimsy plastic of the B. Much clearer silk screen labelling in general. Lower power requirements – it will use between 0.5 watts and 1 watt less than the model B. Much better audio output thanks to a dedicated power supply. Rounded corners! (Still doesn’t fit in an Altoids tin but who cares! The aesthetic change is welcome) In terms of doing new things with it, obviously you've got more GPIO pins, so if you want more inputs or outputs then the B+ is for you. Plus it's much easier to plug USB things in to (less need for a powered hub). If you're doing robotics with a portable power supply, the B+ will last longer on it thanks to the lower power consumption. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/22394",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/19315/"
]
} |
22,928 | Searching on Newegg for "raspberry pi", the results included many heatsinks and as well as a few other types of cooling systems, yet these items do not seem to appear when looking through the stores of the official distributors . Does the Raspberry Pi need some sort of cooling system for its processor such as a heatsink? If one is not always required, are there special situations where a cooling system would be necessary (operating in an outdoor environment where temperatures may reach 35°C during the day)? Or is the temperature more related to how hard the processor is working? Do home-made cases for the Raspberry Pi need to include some sort of ventilation or fan to avoid temperature buildups? | I would like to add this image: note that from the picture, the main component that gets hot is the USB/ethernet hub - by far, this MAY warrant a heatsink if you are using those components heavily, it has restricted airflow due to a case/etc. and it is in a warmer environment, or some combination thereof. The second component that gets warm in the image is the 3.3v regulator - this is to be expected from a linear regulator, and basically a non-issue in the new + editions of the pi. These pieces are designed to heat up (that is how they work), so I would not be concerned with this piece needing a heatsink. Finally, the CPU (and memory which is above the CPU) - this is unlikely to need a heatsink since it will throttle itself if it gets too hot - if you do notice throttling, then you may want a heatsink (and you could run into this if you overclock.. but if you really are THAT desperate for more CPU power, perhaps the Pi isn't for you...) edit to add new model: Giles Read has added a heatmap image of the Pi 2: Seems like the quad core CPU is more power hungry, but looking at the scale on the right helps bring it into perspective: under 40 degrees Celsius is fine for a CPU package, no heatsink needed and to quote from the RPi foundation No. The chip used in the Raspberry Pi is equivalent to a chip used in a cellphone, and does not become hot enough to need any special cooling. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/22928",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/19874/"
]
} |
23,029 | On the model B+ there are four screws that can be used to attach your device either to a base or firmly inside of a case or other enclosure. What is the size of these screws? That is, if you are walking down the isle of a hardware store, what numbers should you be looking for? | tl;dr: Those models that have holes in the PCB are made for M2.5 (or UNC 3-48) screws and a length fitting to the enclosure or respective counterpart. Pi 1 B+ contains four M2.5 mounting holes - supposedly drilled to 2.75 +/- 0.05 mm. This information is taken from the "Raspberry Pi B+ Mechanical Schematic" (official drawing by J. Adams, 07/03/2014, to be found at RS Components). Pi 1 B (rev 2) contains two M2.5 mounting holes (as derived from own measurements, diameter is roughly 2.8 mm). See also http://www.raspberrypi.org/upcoming-board-revision/ that describes the existance of drilled holes of 2.9 mm diameter for M2.5 screws. Pi 1 B (rev 1) does not have any mounting holes. Pi 1 A shares the board layout with the Pi 1 B (suggested by TomG and supported by available pictures). Addendum (per jmb's comment, thanks!): https://www.raspberrypi.org/documentation/computers/raspberry-pi.html has now mechanical drawings for the Pi 4B, Pi 3B+, Pi 3B, Pi 3A+, the Zero (v1.2), the Zero W, Pi 1B+, Pi A+ available. They show the size and position of the holes as well as board outline and position of connector. These models all share the 2.75 mm (or 2.7 mm respectively) holes. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/23029",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/19874/"
]
} |
23,034 | I have several Raspberry Pis that need extra pressure on the SD card in order to boot up. I have a temporary fix that involves scraps of envelope flaps glued onto the card but they become unstuck over time. Does anyone have a better method of maintaining pin contact with their SD cards? Pins look normal to me. Paper trick | tl;dr: Those models that have holes in the PCB are made for M2.5 (or UNC 3-48) screws and a length fitting to the enclosure or respective counterpart. Pi 1 B+ contains four M2.5 mounting holes - supposedly drilled to 2.75 +/- 0.05 mm. This information is taken from the "Raspberry Pi B+ Mechanical Schematic" (official drawing by J. Adams, 07/03/2014, to be found at RS Components). Pi 1 B (rev 2) contains two M2.5 mounting holes (as derived from own measurements, diameter is roughly 2.8 mm). See also http://www.raspberrypi.org/upcoming-board-revision/ that describes the existance of drilled holes of 2.9 mm diameter for M2.5 screws. Pi 1 B (rev 1) does not have any mounting holes. Pi 1 A shares the board layout with the Pi 1 B (suggested by TomG and supported by available pictures). Addendum (per jmb's comment, thanks!): https://www.raspberrypi.org/documentation/computers/raspberry-pi.html has now mechanical drawings for the Pi 4B, Pi 3B+, Pi 3B, Pi 3A+, the Zero (v1.2), the Zero W, Pi 1B+, Pi A+ available. They show the size and position of the holes as well as board outline and position of connector. These models all share the 2.75 mm (or 2.7 mm respectively) holes. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/23034",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/3027/"
]
} |
23,038 | I'm using a Raspberry Pi with RetroPie and I'm quite happy with it; there's only one exception: when I choose a file to launch inside emulationstation, usually it only takes few moments to load the emulator and the file. BUT when I exit the emulator to go back to emulationstation it takes a lot of time. Really! Sometimes it takes up to 20-25 seconds to go back to the launcher. I already tried to install RetroPie on a faster micro-sd card (I believe it's a class 10 card), but IMHO it's still really slow. Please, could you tell me if there is anything I can do on the configuration to speed up this process ? Many thanks | tl;dr: Those models that have holes in the PCB are made for M2.5 (or UNC 3-48) screws and a length fitting to the enclosure or respective counterpart. Pi 1 B+ contains four M2.5 mounting holes - supposedly drilled to 2.75 +/- 0.05 mm. This information is taken from the "Raspberry Pi B+ Mechanical Schematic" (official drawing by J. Adams, 07/03/2014, to be found at RS Components). Pi 1 B (rev 2) contains two M2.5 mounting holes (as derived from own measurements, diameter is roughly 2.8 mm). See also http://www.raspberrypi.org/upcoming-board-revision/ that describes the existance of drilled holes of 2.9 mm diameter for M2.5 screws. Pi 1 B (rev 1) does not have any mounting holes. Pi 1 A shares the board layout with the Pi 1 B (suggested by TomG and supported by available pictures). Addendum (per jmb's comment, thanks!): https://www.raspberrypi.org/documentation/computers/raspberry-pi.html has now mechanical drawings for the Pi 4B, Pi 3B+, Pi 3B, Pi 3A+, the Zero (v1.2), the Zero W, Pi 1B+, Pi A+ available. They show the size and position of the holes as well as board outline and position of connector. These models all share the 2.75 mm (or 2.7 mm respectively) holes. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/23038",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/20034/"
]
} |
23,182 | I am new to the Raspberry Pi and even new to the Raspberry Pi camera. I have seen a lot of tutorials online for the Raspberry Pi camera but have yet to find on that lets me stream straight from the Raspberry Pi camera like you can with a webcam (using SimpleCV or OpenCV). Was hoping someone could point me in the right direction. | The solution suggested by Diego is good except that it's pretty slow and has a huge video delay since the vlc there re-streams a stream of the raspvid. Since 12/2013 there is an official v4l2 driver available: http://www.ics.com/blog/raspberry-pi-camera-module#.VJFhbyvF-b8 This renders the mentioned re-streaming obsolete. Simply load the module and use it: sudo modprobe bcm2835-v4l2
cvlc v4l2:///dev/video0 --v4l2-width 1920 --v4l2-height 1080 --v4l2-chroma h264 --sout '#standard{access=http,mux=ts,dst=0.0.0.0:12345}' This creates an http stream at port 12345, you can use other formats too, like the rtcp one from the Diego's answer. Read more on it here: https://web.archive.org/web/20151012014829/http://www.videolan.org:80/doc/streaming-howto/en/ch03.html | {
"source": [
"https://raspberrypi.stackexchange.com/questions/23182",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/15032/"
]
} |
24,092 | I'm interested in compiling a custom kernel for the pi. I have the source from the github archive , which includes a make target for a default configuration: make ARCH=arm bcmrpi_defconfig But (as with normal linux distro kernels) this includes a lot of stuff I will never need, and some things that I'd like to change. What are the options that are actually required to make various common pi-centric things work? | Starting with the default configuration, or one you know works already, is a good idea. Beware that for the Pi 2 , you should use: make bcm2709_defconfig Instead of bcmrpi_defconfig . Note that if you want to avoid clobbering an existing kernel install of the same version, set the General setup -> Local version - append to kernel release string to a unique value. I've used the actual labels from .config here, sans CONFIG_ ; if you are using e.g., make menuconfig , you can find the relevant option with the search (forward slash / ). These labels are also used at the top of the "Help" page for each option. Note that the term enable(d) refers to something which causes an option to appear, distinct from actually selecting the option to be built. Where there are differences between the A/B/B+/A+ boards and the Pi 2, this is indicated. In some places this is the difference between the Broadcom 2708 and 2709 families, but in other places, the Pi 2 uses the same 2708 (or 2835) option as the other boards. System For A/A+/B/B+: ARCH_BCM2708 (System Type -> Arm System Type -> Broadcom BCM2708 family) For Pi 2: ARCH_BCM2709 (System Type -> Arm System Type -> Broadcom BCM2709 family) ...This is at the very bottom of the list and not in alphabetical order. SMP (Kernel Features -> Symmetric Multi-Processing) NEON (Floating Point Emulation -> Advanced SIMD (Neon) Extension support) And "Support for NEON in kernel mode". Kernel Memory Split: Because of problems with a couple of pieces of legacy software , the default config may use 3G/1G here which will leave 25% of the Pi 2's RAM unavailable to user space. If you are concerned about this, check Kernel Features -> Memory Split . SD card These can't be modules, obviously, since they are needed to access /lib/modules ; they must be built-in. They're in the "Device Drivers" section of menuconfig. MMC (MMC/SD/SDIO card support): Necessary to get options for the mmc driver, but not sufficient. Within those options: MMC_BCM2835 (MMC support on BCM2835). MMC_BCM2835_DMA (DMA support on BCM2835 Arasan controller): Enabled but not selected by MMC_BCM2835. MMC_SDHCI (Secure Digital Host Controller Interface support) Since the root partition is usually ext formatted, you also want that built in: EXT4_FS (The Extended 4 (ext4) filesystem) under "File Systems". Probably ext2 and ext3 are a good idea too. The boot partition is vfat, so: VFAT_FS (VFAT (Windows-95) fs support) is under "File Systems -> DOS/FAT/NT Filesystems". Miscellaneous These are various things you (almost certainly) need, so I've listed them first. VFP (VFP-format floating point maths) under "Floating point emulation". UNIX (Unix domain sockets) under "Networking support". Basic system software will require this even if you are not doing any real networking. BINFMT_ELF (Kernel support for ELF binaries) under "Userspace binary formats". TTY (Enable TTY) under "Device Drivers -> Character Devices"; this enables VT (Virtual terminal) and UNIX98_PTYS (Unix98 PTY support) which you should select. VT then enables VT_CONSOLE (Support for console on virtual terminal) and CONSOLE_TRANSLATIONS (Enable character translations in console) which should also be selected. PROC_FS , SYSFS , and TMPFS under "File Systems -> Pseudo Filesystems". SERIAL_AMBA_PL011 (ARM AMBA PL011 serial port support) under "Device Drivers -> Character Devices -> Serial Drivers" and SERIAL_AMBA_PL011_CONSOLE (Support for console on AMBA serial port). Raspbian systems will complain about "/dev/ttyAMA0: No such file or directory" without this. MAILBOX and BCM2708_MBOX (on 4.x kernels). This is Device Drivers->Mailbox Hardware Support and the BCM 2708 option in the submenu. See zub's answer . USB USB (Support for Host-side USB), in "Device Drivers -> USB Support", enabling USB_DWCOTG (Synopsis DWC host support) down the page, which should also be selected. USB_ANNOUNCE_NEW_DEVICES (Device Drivers -> USB Support -> USB announce new devices). USB_DEFAULT_PERSIST (Device Drivers -> USB Support -> Enable USB persist by default). For keyboards and mice: HID_GENERIC (Generic HID driver) in "Device Drivers->HID support" Then in "USB HID support": USB_HID (USB HID transport layer) INPUT_MOUSEDEV (Mouse interface) in "Device Drivers -> Input Device Support". For hard drives: SCSI (SCSI device support) and then BLK_DEV_SD (SCSI disk support) in "Device Drivers -> SCSI Support". USB_STORAGE (USB Mass Storage support) in "Device Drivers -> USB Support". For tethering Android devices, see my answer here . Ethernet USB must be enabled first. NET (Networking support), a top level option; inside that are: PACKET (Packet socket). INET (TCP/IP networking). This should enable a variety of IP related defaults which you can leave. NETFILTER (Network packet filtering framework), necessary for the kernel "ip tables" packet filter firewall. NETDEVICES (Network device support) in "Device Drivers", then: NET_CORE (Network core driver support). USB_NET_DRIVERS (USB Network Adapters) -> USB_USBNET (Multi-purpose USB Networking Framework). USB_NET_SMSC95XX (SMSC LAN95XX based USB 2.0 10/100 ethernet devices) Sound To enable the onboard sound: SOUND (in Device Drivers), then: SND (Advanced Linux Sound Architecture) and in that: SND_ARM (ARM sound devices) and finally in that SND_BCM2835 (BCM2835 ALSA driver) Video CONFIG_BCM2708_VCHIQ (Device Drivers -> Misc Devices -> Videocore VCHIQ). There's nothing further required for X server support; there are no DRI driver options for the pi's SoC. If you want to use the framebuffer, which allows applications such as fbi and omxplayer to display graphics outside of X: FB (Device Drivers -> Graphics Support -> Frame buffer Devices -> Support for frame buffer devices), then in the same menu, FB_BCM2708 (BCM2708 framebuffer support). If you do this and you want the penguin (or rather, the raspberry) on the boot console, remember LOGO (Bootup logo) under Graphics Support. You may also want to look at options under System Type -> Broadcom2708 (or 9) Implementations . GPIO / I 2 C BCM2708_GPIO (System Type -> Broadcom BCM2708 Implementations) Or for the Pi 2, the corresponding BCM2709 option. GPIO_SYSFS (Device Drivers -> GPIO Support) for the /sys/class/gpio interface. I2C (Device Drivers -> I2C support), which enables I2C_CHARDEV (I2C device interface). Then under "I2C Hardware Bus support": I2C_BCM2708 (BCM2708 BSC). Raspicam MEDIA_CAMERA_SUPPORT (Device drivers -> Multimedia Support -> Cameras/video grabbers support). V4L_PLATFORM_DRIVERS (Device drivers->Multimedia Support -> V4L Platform Devices"). This enables a submenu where you want to select: CONFIG_SOC_CAMERA (SoC Camera Support). CONFIG_VIDEO_BCM2835 (Broadcom BCM2835 camera interface driver). This enables "Broadcom BM2835 MMAL camera interface driver ( CONFIG_VIDEO_BCM2835_MMAL ) which you should also select. Thermal sensor You have a choice here; if you try to choose both, the first one will be cancelled (although you can build one as a module, change the config, build the other, and use them both if you really want to). SENSORS_BCM2835 (Device Drivers->Hardware Monitoring support->Broadcom BCM2835 HWMON Driver). This is at the bottom of the list if you don't select "BCM2835 Thermal Driver", below. It gives you access to thermal stuff in /sys/devices/platform/bcm2835_hwmon -- temp1_input and temp1_max . The former is the same /sys/devices/virtual/thermal/thermal_zone0/temp ; the latter is always 85000 (i.e. 85 °C). THERMAL_BCM2835 (Device Drivers->Generic Thermal sysfs driver->BCM2835 Thermal Driver). Also choose Device Drivers->Hardware Monitoring support (but not the individual driver in that menu) so that "Expose thermal sensors as hwmon device" appears here and you can choose that (4.0.y seems to not have this). Choosing this will unchoose SENSORS_BCM2835, above. It gives you access to the easier to remember and find /sys/class/devices/virtual/thermal/thermal_zone0 which includes temp and trip_point_0_temp (the same as temp1_max , above). Various userspace monitors will probably prefer this and may not work without it. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/24092",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/5538/"
]
} |
24,770 | I forgot the password to my Pi, but don't have access to a compatible monitor/keyboard. I've seen methods like these but they all involve editing cmdline.txt and then booting with a monitor and keyboard attached to run passwd pi from the main console. Is there a way I could do a similar thing (or something completely different to the same effect) but where I can interact via SSH/console cable? | The password isn't actually stored anywhere on the system, a one way hash of it is . This means even if you have the hash, you won't be able to deduce the password. The hash itself is stored in /etc/shadow . Take the SD card out and stick it in another linux system; any common distro (ubuntu, fedora, arch, etc.) should do. On that system, create a new temporary user -- do all this via sudo or as root: > useradd tmpuser
> grep tmpuser /etc/shadow
tmpuser:!:16406:0:99999:7::: The last line of output is just an example but that's more or less what you should see. There might be two exclamation marks. Now open /etc/shadow , find that line (the one starting with tmpuser , or whatever name you used) and remove the ! (or two) from between the first two colons, so it is tmuser::16406... . This makes this a passwordless account. Now: > su tmpuser
> passwd
Enter new UNIX password: Go ahead and enter a password. This creates a hash in /etc/shadow ; if you run grep tmpuser /etc/shadow you'll now see a long string between the first two colons; it probably begins with $6$, , eg. tmpuser:$6$jlBY96dq$V7tFs2xEv.a3kXArkyTEcEbGDX43d6UpzMcy/aplV8khxUFJKPMg0ugGBfWVZMpJRpaMXAATEAb5inu7/G.Iz1:16406:0:99999:7::: If that's not there try sudo pwconv and check again ( man pwconv explains this). Now open the /etc/shadow file on the second partition of the SD card , i.e., the one used on the pi. In there you'll find a line beginning with pi or whatever user it is you are interested in. It will have a long string between the first two colons as above. Erase that (only the stuff between the first two colons!) and replace it with the string from tmpuser on the current system. You could just remove it and leave the account passwordless, but I think you may then have problems with ssh . Whereas this method is pretty foolproof. Unmount the partition, take the card out, boot it in the pi, and the password will be whatever you created above. You can then change that with passwd if you want. To remove the temporary user you created for this purpose on the other system (n.b., you could always skip that and just use the hash from an account you know the password for): > userdel tmpuser | {
"source": [
"https://raspberrypi.stackexchange.com/questions/24770",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/17669/"
]
} |
26,836 | I've used my raspberry pi for about 2 years now and in the beginning I removed the X server as I thought I'd never use it. (I followed the tips here to remove How to uninstall X Server and Desktop Manager when running as headless server? ). Now I want to be able to run X server and have graphics. I've been entertaining the idea of wiping the SD card and just doing a new installation with X already working but I've configured the Raspbian I have now quite extensively and I don't want to do it again. My preferred method would be to just install X and get it working again into the Raspbian I already have there. Is it possible? How would I go about doing that? | Linux uses a heterogeneous GUI stack, meaning it's arranged in layers but there's different layers you can arrange. The bottom of the stack is relatively homogeneous, meaning it's almost always the same. This is the Xorg server joan has indicated. However, while X all by itself does provide you with a graphical desktop, it doesn't look like much -- plain black screen with a cursor. This makes just launching applications difficult, since there are no menus or taskbars either. You can configure a terminal to launch at start up and go from there, but realistically, additional software is needed. This is where the next two layers, the window manager (WM) and desktop environment (DE) come in. The latter requires the former but not vice versa. There are stand-alone WM's that have most of the features associated with a graphical desktop, but linux distros usually use a more minimal WM with a heftier DE on top. The default DE on Raspbian was (keep reading) lxde . If you want that back, I imagine apt install lxde should do it. There may be more pieces needed in the end -- you can see a list of possibilities with apt-cache search lxde . The other common linux DE's are also available, but most of them consume more resources which is why lxde was chosen as the default on the pi. Note that this does not include a graphical login, which is the task of a display manager (DM). The default on raspbian is lightdm , which you can install with apt-get install lightdm . To sum up the two parts you'd need to get the original GUI system back would be: apt install lxde lxde-core lxterminal lxappearance apt install lightdm These should drag in X and other dependencies if they are not there already. If you wish to start X from the command line using startx or xinit , you'll need: apt install xinit The new default DE is the Pi Foundation's tweaked branch of LXDE, PIXEL. Apparently you can install that with: apt install raspberrypi-ui-mods This may or may not include a display manager for GUI logins. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/26836",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/26085/"
]
} |
27,073 | I am using I²C to control a Bright Pi module. I followed instructions from ' Configuring GPIO - Adafruit ' and ' Configuring I²C - Adafruit ' to set up the I²C. I have done this a few months ago and everything went fine. This is how I connected the Bright Pi on my Raspberry Pi (Model B): Since today I noticed the I²C doesn't work anymore as it used to.
Using the commands like ' sudo i2cdetect -y 1 ' and ' sudo i2cset -y 1 0x70 0x00 0xff ' will give the error: Could not open file '/dev/i2c-1' or '/dev/i2c/1': No such file or directory Using the command ' sudo i2cdetect ' will give the error No i2c-bus specified! which means the i2c-dev is running. The file '/etc/modules' looks like this: #/etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
snd-bcm2835
i2c-dev
i2c-bcm2708 The file '/etc/modprobe.d/raspi-blacklist.conf' looks like this: blacklist spi and i2c by default (many users don't need them)
#blacklist spi-bcm2708
#blacklist i2c-bcm2708
blacklist snd-soc-pcm512x
blacklist snd-soc-wm8804 I've tried reinstalling all required modules, but that didn't help either. Also apt-get update and apt-get upgrade didn't help. The command ' lsmod | grep i2c ' shows this: i2c_bcm2708 6004 0
i2c_dev 6709 0 It is strange, because it used to work before. I might think it is "broken" since I did a firmware update two days ago, because my Raspberry Pi was showing weird kernel errors. How can I fix the problem with the I²C? | The latest firmware implements device tree support. That will have broken things like I²C, SPI, and 1-wire bus. For fuller details see I²C, SPI, I2S, LIRC, PPS, stopped working? Read this. . Summary Add one or more of the following to your /boot/config.txt and reboot.
I2C
No longer add: dtparam=i2c1=on (or dtparam=i2c0=on on old models)
Instead add: dtparam=i2c_arm=on (as this is correctly mapped to 0 or 1 for each model)
A very few users might need: dtparam=i2c_vc=on (for the other i2c interface - see note below)
SPI
Add dtparam=spi=on
I2S
Add dtparam=i2s=on
lirc-rpi
Add dtoverlay=lirc-rpi
Add module parameters to the end of the dtoverlay line,
e.g. dtoverlay=lirc-rpi,gpio_in_pin=16,gpio_in_pull=high
w1-gpio
If you require the external pullup
dtoverlay=w1-gpio-pullup,gpiopin=x,pullup=y
otherwise
dtoverlay=w1-gpio-pullup,gpiopin=x
(where x and y are gpios).
Audio card
Add one of the following
dtoverlay=hifiberry-dac
dtoverlay=hifiberry-dacplus
dtoverlay=hifiberry-digi
dtoverlay=iqaudio-dac
dtoverlay=iqaudio-dacplus
heartbeat LED
dtparam=act_led_trigger=heartbeat Note: It is recommended that you only use i2c_vc (and i2c_vc_baudrate) if you really need to - for example, if you are programming a HAT EEPROM. Enabling i2c_vc can stop the Pi Camera being detected. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/27073",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/26360/"
]
} |
27,082 | How can I stream video stream to Linux or OS X using raspivid and either VLC, GStreamer or Netcat? | Netcat (nc) seems to be the one with the smallest delay. In my experience, VLC has the biggest delay. On the other hand, there is a VLC client for Android, which is convenient. <IP-OF-THE-CLIENT> is the IP of the computer that should receive the video stream. <IP-OF-THE-RPI> is the IP of the Raspberry Pi. Using Netcat: On the client (Run the command on the client first, and then on the server (RPi)). Linux nc -l 2222 | mplayer -fps 200 -demuxer h264es - OS X nc -l 2222 | mplayer -fps 200 -demuxer h264es - On the RPi /opt/vc/bin/raspivid -t 0 -w 300 -h 300 -hf -fps 20 -o - | nc <IP-OF-THE-CLIENT> 2222 Using GStreamer: On the client Linux gst-launch-1.0 -v tcpclientsrc host=<IP-OF-THE-RPI> port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false OS X gst-launch-1.0 -v tcpclientsrc host=<IP-OF-THE-RPI> port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! osxvideosink sync=false On the RPi /opt/vc/bin/raspivid -t 0 -hf -fps 20 -w 300 -h 300 -o - | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=<IP-OF-THE-RPI> port=5000 Using VLC On the client The client might even be on a mobile phone (I tried on Android). Simply open from the network in the VLC client: http://<IP-OF-THE-RPI>:8090 On the RPi /opt/vc/bin/raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25|cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264 | {
"source": [
"https://raspberrypi.stackexchange.com/questions/27082",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/11810/"
]
} |
27,086 | I'm making a project where the Raspberry Pi will be mounted inside a closed box, with buttons and LEDs on the front panel. Is it possible to have panel-mounted LEDs that replicate the status of the FDX and LNK LEDs on the Pi itself, so they blink etc? I'm willing to give up 2 GPIO ports if needed. Perhaps some sort of daemon that runs in the background analysing the network traffic and controlling them? | Netcat (nc) seems to be the one with the smallest delay. In my experience, VLC has the biggest delay. On the other hand, there is a VLC client for Android, which is convenient. <IP-OF-THE-CLIENT> is the IP of the computer that should receive the video stream. <IP-OF-THE-RPI> is the IP of the Raspberry Pi. Using Netcat: On the client (Run the command on the client first, and then on the server (RPi)). Linux nc -l 2222 | mplayer -fps 200 -demuxer h264es - OS X nc -l 2222 | mplayer -fps 200 -demuxer h264es - On the RPi /opt/vc/bin/raspivid -t 0 -w 300 -h 300 -hf -fps 20 -o - | nc <IP-OF-THE-CLIENT> 2222 Using GStreamer: On the client Linux gst-launch-1.0 -v tcpclientsrc host=<IP-OF-THE-RPI> port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false OS X gst-launch-1.0 -v tcpclientsrc host=<IP-OF-THE-RPI> port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! osxvideosink sync=false On the RPi /opt/vc/bin/raspivid -t 0 -hf -fps 20 -w 300 -h 300 -o - | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=<IP-OF-THE-RPI> port=5000 Using VLC On the client The client might even be on a mobile phone (I tried on Android). Simply open from the network in the VLC client: http://<IP-OF-THE-RPI>:8090 On the RPi /opt/vc/bin/raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25|cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264 | {
"source": [
"https://raspberrypi.stackexchange.com/questions/27086",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/6212/"
]
} |
27,479 | I can't connect to mirrordirector.raspbian.org in Raspbian, but I don't know why. I've already re-installed Raspbian, but it looks like this is not the problem.
How can I resolve this? After I connected to my Raspberry Pi over SSH from another computer and then run sudo apt-get update and work like a charm. But, if someone can explain why it wasn't working when I was executing the command from the Pi itself, it would be great! | This Answer is obsolete. The operation of mirrordirector has changed. Using terminal or your favorite text editor you can define a specific mirror to use in /etc/apt/sources.list Just comment out the line deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware So it looks like this #deb http://mirrordirector.raspbian.org/raspbian wheezy main firmware And replace with a mirror close to you from list below The list of mirrors can be found here I (being in the US) use the lease Web mirror Update Problem seems dns related (except for slow ping when you used actual ip of Google. Update your /etc/network/interfaces eth0 line to include (or update existing) to be (as last line of section) dns-nameservers 8.8.8.8 8.8.4.4 Those are Google name servers. Just to see if get better performance. If you would like less prying eyes than Google, there are other free providers out there. As far as slow ping when pinged ip address of Google, I would reboot router and/or modem. Update 2 If adding to /etc/network/interfaces didn't work add the following as last line of /etc/resolv.conf nameserver 8.8.8.8 8.8.4.4 And then restart or just restart networking Edit 3 Also if you could update answer with output of ifconfig You do this via terminal. It will show us the local address of the Pi. Also, please update answer with local ip of computer that is working, or the local address of the router. For example mine is 192.168.1.1 | {
"source": [
"https://raspberrypi.stackexchange.com/questions/27479",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/26824/"
]
} |
27,708 | I've been searching around for more information on the /boot/config.txt configuration directive max_usb_current , trying to find out exactly what happens when that is set to 1 , but it's hard to find any official documentation. I know the following: Setting max_usb_current=1 sets the available current over USB to 1.2A (default is 600mA) This can help if you have a decent power supply (2A, at least) and need to power something like a small external HDD or something that needs 300+ mA. This feature is only available on the B+ and Pi model 2 (at the time of this writing) But some of the people mentioning the setting warn against setting this value unless you absolutely need to... my question is, why is that? Is something else disabled or changed about the Pi that would increase a risk of damaging the Pi or anything powered over USB, or is it more a general warning to scare off people who don't know what they're doing and might not have a decent power supply to the Pi? | It seems that the only concern is that your power supply, if it's not a decent, reliable supply capable of 2A+ of clean output power, might not be able to power the Pi sufficiently, resulting in crashes or frequent rainbows. See, specifically: All that max_usb_current=1 does is to set GPIO38 high, which in turn turns on a FET, which connects a second 39K resistor in parallel to an existing one, on pin 5 of U13, the AP2553W6 USB power manager, lifting the current limit from 0.6A to double that (1.2A), see no possible scenario there why the PI resets because of that, except in case the gate of the FET Q4 is somehow shorted to GND. Which could be caused by a production fault. Inspect Q4, as look if there is solder shorting pins together. Also R6 (resistor mounted between gate of Q4 and GND) should be 100K not 0 Ohm. U13, Q4 and R6 should be near the USB ports. That was from the thread B+ and max_usb_current , which I found after posting the same question here to Any negative impact with setting max_usb_current=1 ? . | {
"source": [
"https://raspberrypi.stackexchange.com/questions/27708",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/6506/"
]
} |
27,858 | How can I perform an upgrade from Raspbian Wheezy to Jessie? | How brave do you feel? It's safest to make a fresh install on a new SD card. The braver way I'd use is: Backup any files which are important to you. With your new or existing install. sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade to make sure wheezy is fully up to date. Edit /etc/apt/sources.list and change wheezy to jessie.
There may also be files in /etc/apt/sources.list.d/ that also need updating, to replace wheezy with jessie. Then update and upgrade again sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade | {
"source": [
"https://raspberrypi.stackexchange.com/questions/27858",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/27190/"
]
} |
27,876 | I've hooked up the raspberry pi to a display. I have ssh'd in from another machine and I was wondering how, if possible, to open a browser window via epiphany http://example.com from my ssh session and have it appear on the screen. | Presuming you are logged in as the same user that's running the X display, this is fairly easy. First you need to know the display identifier; if there is only one running instance, it is probably :0 . To check, use who . You'll see output including stuff like this: goldilocks pts/5 2015-02-16 07:18 (:1)
goldilocks pts/6 2015-02-16 07:18 (:1)
goldilocks pts/7 2015-02-16 07:36 (:1) The display identifier is in parenthesis at the end, in this case :1 . You need to set that in the environment of your ssh session. For most shells including bash (the default on raspbian): export DISPLAY=:0 Or :1 , as the case may be. To now start epiphany there: epiphany http://example.com & The & backgrounds this, otherwise it will block and you won't get the prompt back in ssh . | {
"source": [
"https://raspberrypi.stackexchange.com/questions/27876",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/5670/"
]
} |
28,907 | I have found myself repeatedly setting up all my pi's with raspbian in pretty much the same manner using raspi-config. Is there a way to extract all the settings that I've made using raspi-config into an executable script that I could download with wget to each new pi I set up? A similar solution with the same effect would also be appreciated. I guess I could try one of the rpi docker implementations but I'm not that eager to find out how bleeding edge that stuff is. | At least nowadays, raspi-config seems to support noninteractive mode: cat /boot/cmdline.txt # show original cmdline.txt
raspi-config nonint do_serial 1 # disable serial console
cat /boot/cmdline.txt # confirm changes
raspi-config nonint do_serial 0 # enable serial console
raspi-config nonint do_serial 2 # disable serial console, but enable serial hardware (/dev/serial0)
cat /boot/cmdline.txt # confirm changes with this, you can write setup scripts that can do anything you could do via the interactive command, and it will do exactly the same things. You will need to find the relevant commands and their usage from the script's source, though. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/28907",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/14075/"
]
} |
29,283 | When I use fswebcam to capture a JPEG image from my webcam (an HP 2100) that is USB attached, it is always black? | When we use fswebcam to grab an image, it appears that the camera is initialized, grabs an image and then disconnected. Some webcams have function to automatically balance their brightness. For example, in a dark room they sense that the brightness needs increased while in a bright area, the brightness may need to be decreased. The camera does this by examining its own frames and analyzing them. When a grab of an image occurs immediately after the camera is initialized, it hasn't seen enough data to know how bright the environment is and it appears that it assumes that the environment is SUPER bright and turns down its exposure control to minimum (resulting in a black image). As more frames are examined, the camera quickly adjusts its exposure settings. To use fswebcam , we can supply it the option of -S <num> which is the number of frames that the camera should "see" and "skip" before it captures the image you want. I find that if I supply a skip of 20 the camera has had enough frames to self adjust its exposure and since we are processing 30 frames a second, that is still less than a second delay for grabbing 1 frame. For video streaming, we shouldn't have the problem as the camera will be initialized and stay initialized. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/29283",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/28648/"
]
} |
30,093 | How do I start epiphany browser in fullscreen mode from terminal (not F11)? Documentation says to use arguments -f or --fullscreen but neither of them work. | You can start it in kiosk mode using -a , you may have to create your ~/.config for your profile. epiphany-browser -a --profile ~/.config http://localhost/index.html | {
"source": [
"https://raspberrypi.stackexchange.com/questions/30093",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/29439/"
]
} |
30,246 | I have downloaded Kali v1.1.0 for my Raspberry Pi 2 from here. But the file I must transfer to the SD Card is a .img.xz , not the desired .img one. I have tried to unpack with: $ tar -jxvf kali-1.1.0-rpi2.img.xz
bzip2: (stdin) is not a bzip2 file. tar: Child returned status 2tar: Error is not recoverable: exiting no Installing the xz-utils package: # apt-get install xz-utils ... seems not to solve anything (it was already installed). Same for: $ tar -jxvf kali-1.1.0-rpi2.img.xz What is the correct way to extract/convert the .img.xz file to .img ? | Just use the unxz program: unxz kali-1.1.0-rpi2.img.xz Note: the original file will be removed . Only the .img file will remain.
If you want to keep the original archive, use unxz --keep kali-1.1.0-rpi2.img.xz . | {
"source": [
"https://raspberrypi.stackexchange.com/questions/30246",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/29589/"
]
} |
32,483 | If you buy a computer you expect it to come with a power button. So why does the Raspberry Pi not have one? Is it because it would take up too much room or be awkward to fit on the PCB? Personally the lack of a power button is something which has always slightly irritated me, because to fully shut down the Pi you have to pull the power cable out. And I'm sure I am not the only one who has plugged in the Pi and it has started up without you wanting it to. I feel like a power button would save the hassle of having to pull the power cable out or switching off the power at the mains. | Modern power buttons use the Advanced Configuration and Power Interface (ACPI) to request the OS to turn its motherboard off. That's why, for a couple decades now, if you really want the motherboard off and the OS refuses, you had to mash its power button for several seconds. A simple power switch, like a light switch, could de-power the CPU just when it's doing something important, or when virtual files are changed, and the OS needs to write them to the SD card. So if the Raspberry went with a cheap on-off switch, more people would use it wrong and get in trouble. And adding the full ACPI harness to the motherboard would naturally make it more expensive. I always issue sudo shutdown from inside a Pi, and give it a moment to collect its thoughts, before yanking its power. (And you should never power off by yanking the tiny, fragile MicroUSB plug from the Pi. I try to always power off using a power strip's switch, or by unplugging the distal end of the USB power wire.) Finally, there's the slight matter that many RPIs are simply never turned off. (-; | {
"source": [
"https://raspberrypi.stackexchange.com/questions/32483",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/24296/"
]
} |
32,484 | I have been unable to SSH into my Pi 2 using PuTTY on my Windows 7 machine. Every time i try to login, it gives me an error "Connection refused". Can somebody please help? I use Raspbian. | Modern power buttons use the Advanced Configuration and Power Interface (ACPI) to request the OS to turn its motherboard off. That's why, for a couple decades now, if you really want the motherboard off and the OS refuses, you had to mash its power button for several seconds. A simple power switch, like a light switch, could de-power the CPU just when it's doing something important, or when virtual files are changed, and the OS needs to write them to the SD card. So if the Raspberry went with a cheap on-off switch, more people would use it wrong and get in trouble. And adding the full ACPI harness to the motherboard would naturally make it more expensive. I always issue sudo shutdown from inside a Pi, and give it a moment to collect its thoughts, before yanking its power. (And you should never power off by yanking the tiny, fragile MicroUSB plug from the Pi. I try to always power off using a power strip's switch, or by unplugging the distal end of the USB power wire.) Finally, there's the slight matter that many RPIs are simply never turned off. (-; | {
"source": [
"https://raspberrypi.stackexchange.com/questions/32484",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/31813/"
]
} |
32,639 | I have an easy circuit wired up, with an LED connected to pin 18 on the BOARD reference. I run a simple program to put pin 18 to HIGH, which turns the LED on, and then a couple of seconds later, I set pin 18 to LOW, and finally I end my program with GPIO.cleanup(). At this point the LED is off, which means that pin 18 is off (LOW). Now I reboot or restart my Raspberry Pi, and when it boots back up, the LED on pin 18 turns on again, even though the pin was off before I rebooted the Raspberry Pi. Why may this be happening? How can I configure a specific pin, like pin 18 to be off when the Raspberry Pi boots up? And I don't want any GPIO pins to be on HIGH when the Raspberry Pi boots up. I am concerned about this problem, because let's say that pin 18 is connected to a DC motor on a robot, and when the Raspberry Pi boots up, the motor will turn on, and this is not something that I want because that will interferes with the whole structure of the robot, and some motors might start and others won't, depending on the pins they are connected to. I want to manually turn on all the motors in a synchronized manner. One other thing is that not all the pins have this problem. Some stay off when the Raspberry Pi boots, but others don't. | At powerup the GPIOs are pulled either high or low through the internal resistors. Whether the pull is high or low for a particular GPIO is detailed on page 102 of BCM2835 ARM Peripherals . As the Linux kernel is started and if device tree is enabled (likely) then it will reconfigure the GPIOs according to the device tree settings. Modules loaded from /etc/modules could also update the GPIO state. Any other software you have running at start up could potentially reconfigure the GPIOs subsequent to the device tree settings and module loads. It is safest to find a hardware solution if you have hardware which could be incorrectly triggered at system startup. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/32639",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/31990/"
]
} |
34,035 | I'm quite new to Raspberry Pi. I recently started hacking my new RPI with raspbian and working on a video streaming project. I finished my prototype and things are ready for production. RPI is awesome no doubt about, but can I use it for production - like mass production? | You can embed the Raspberry Pi in any end-product you want. For mass production, the Compute Module may be a better choice. The Compute Module is a Raspberry Pi in a more flexible form factor, intended for industrial application. You cannot use the words Raspberry Pi to promote your product without permission. Raspberry Pi is trademarked. You will have to ensure you follow the terms of the software licences for any software you embed in your product. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/34035",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/33344/"
]
} |
34,715 | Is raspbian for the Raspberry Pi 2 B 32 bit or a 64 bit OS? Just wondering because I am unable to find this information online. | It is a 32 bit OS, as all current Raspberry Pi hardware (except the new Raspberry Pi 3) uses 32 bit ARM CPUs. The statement that the distinction between 32 bit and 64 bit is really only pertinent to x86 OS's is pure nonsense - as goldilocks points out there are both 32 and 64 bit ARM CPUs, and thus both 32 and 64 bit ARM OSes. Just like there are both 32 and 64 bit OSes for PowerPC, Sparc, MIPS and a number of less common ISAs. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/34715",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/32923/"
]
} |
37,920 | I have followed (any one of hundreds) tutorial, and it does not work. How do I set up networking/WiFi/static IP address on the Raspberry Pi? After the Foundation introduced the dhcpcd networking system to Raspbian in May 2015 there were hundreds of questions (partly because the Foundation didn't produce any documentation). After answering dozens of questions I decided to produce a canonical answer. This proved to be more difficult than anticipated - especially as the implementation keeps changing - hopefully I have continued to keep it up-to-date. (Originally I referred to this as a Dorothy Dixer , but this is apparently an Australian idiom.) | This tutorial describes how to setup networking using the default network manager dhcpcd included in Raspbian since 2015-05-05 and Raspberry Pi OS . It applies to the Foundation releases of Raspberry Pi OS -Bullseye , Raspberry Pi OS -Buster , Raspbian Buster , Raspbian Stretch , Raspbian Jessie and the last Raspbian Wheezy . Bullseye & Buster settings are identical to Stretch. How to setup Raspbian Networking If you are using an Ethernet connection with a router there should be no configuration required and it should work out of the box. The Pi3B+ and Pi4 have Gigabit Ethernet interfaces and will only work on a Gigabit Ethernet (1000BASE-T) router if a 8 wire CAT 5E cable is used. Earlier Pi models which only supported 100BASE-T work over 6 wire cable. NOTE The Pi3/Pi Zero W inbuilt WiFi does not support 5GHz networks, and may not connect to Ch 12,13 on 2.4GHz networks until wireless regulatory domain is set. WiFi on 5GHz enabled devices is disabled until wireless regulatory domain is set (Pi4B, Pi3B+, Pi3A+) The domain can be set through Raspberry Pi Configuration (rc_gui), raspi-config or by setting country= to an appropriate ISO 3166 alpha2 country code in /etc/wpa_supplicant/wpa_supplicant.conf . If you use the latest Raspberry Pi Imager there are advanced options, invoked by the magic key sequence: Ctrl-Shift-X .
These enable you to set many initial options; hostname, username, password, ssh, WiFi Country Code etc during imaging.
This should enable you to setup a headless system, without the need to edit any files. If you are using WiFi and the GUI set up by following Using the Desktop If you are using WiFi from the Command Line set up by following Using the Command Line This is the only way to set up a network which does not broadcast SSID . This can also be used to setup a 'Headless' system e.g. using a serial console cable, but it MUCH easier if you can borrow a monitor and keyboard for setup. See below for another possible method using an Ethernet cable to a PC. For most users READ NO FURTHER The following are Advanced options Headless Raspbian WiFi Setup Raspbian , since May 2016, checks the contents of the boot directory for a file called wpa_supplicant.conf , and will copy the file into /etc/wpa_supplicant , replacing any existing wpa_supplicant.conf file that may be there. The file in the boot directory is then removed. This can be used to enable headless setup, using the wpa_supplicant.conf settings detailed below or Setting up a Raspberry Pi headless (You will probably want to enable ssh as well.) NOTE the links to raspberrypi.org suggest using ifconfig - this is deprecated use ip a; ip r instead. NOTE If you use the latest Raspberry Pi Imager the advanced options Ctrl-Shift-X make the above unnecessary. What is my IP Address? If you just want to know the IP Address your Pi is using enter hostname -I on the command line. SSH As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. Enter sudo raspi-config in the terminal, first select advanced options , then navigate to ssh , press Enter and select Enable or disable ssh server. For headless setup, SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card. Networking Files If you are running a recent Raspbian /etc/network/interfaces should be as below. If you have changed it PUT IT BACK. (Or on Stretch just delete it - it effectively does NOTHING.) # interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d The file /etc/wpa_supplicant/wpa_supplicant.conf will be created/modified by the recommended setup methods, but can be setup by hand. Recent Raspbian have an option in raspi-config to enter SSID and Password. It should contain something like the following:- ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=AU
network={
ssid="ESSID"
psk="Your_wifi_password"
} If you need to connect to a private network (i.e. no broadcast SSID ) include the line scan_ssid=1 inside network={⋯} . NOTE If you want to connect to different networks (e.g. at work or home) you can include multiple network={⋯} entries. If you have access to multiple networks and want to connect to a specific network, include the line priority=100 inside the network={⋯} entry. You can select a different priority for each network, the highest priority accessible network will be selected; the default is 0. There are many other options which can be used see man wpa_supplicant.conf . Notes on obsolete Operating Systems Jessie does not include the 10-wpa_supplicant hook to manage WiFi interfaces, so links to wpa_supplicant are needed. These settings are incompatible with Predictable Network Interface Names. The /etc/network/interfaces used by Jessie should be:- # interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf NOTE calling dhcp in /etc/network/interfaces will disable dhcpcd . Predictable Network Interface Names Stretch introduced 1 predictable network interface names which have been used in other distributions for some time. Network interfaces will have names formed from a prefix en — Ethernet or wl — wlan followed by x indicating MAC and the MAC e.g. enxb827eb123456 or wlx00c140123456 .
The onboard WiFi of the Pi4, Pi3 and PIZeroW which is connected over sdio will however use the name wlan0 This can be beneficial to those using multiple network interfaces, however for most Pi users, with a single Ethernet and WiFi interface will make little difference. The previous names eth0 and wlan0 can be restored if you pass net.ifnames=0 on the kernel command line in /boot/cmdline.txt . There is an option in raspi-config to enable predictable network interface names. 1. For some incomprehensible reason the Foundation decided to "Disable predictable network interface names for Ethernet devices" only 3 weeks after introducing the long-awaited feature. There is an option under Advanced Options of raspi-config to toggle this setting. Setup a Static IP Address If you want your Pi to be assigned a predictable IP Address you can either reserve one in your router OR request the DHCP server to assign one. E.g. the following will request an address on wlan0 . interface wlan0
request 10.1.2.99 request [address] Request the address in the DHCP DISCOVER message. There is no guarantee this is the address the DHCP server will actually give. If no address is given then the first address currently assigned to the interface is used. If you request an IP Address within the range managed by the DHCP server which is available this should be honoured, otherwise the DHCP server will allocate an address as normal. If you want an IP Address outside the range managed by the DHCP server e.g. if you have a range of addresses reserved use the inform directive. inform address[/cidr[/broadcast_address]] This does not get a lease, just notifies the DHCP server of the address in use. You should also include the optional CIDR network number in case the address is not already configured on the interface. If you REALLY need a static IP Address see separate answer Static IP Address Advanced dhcpcd Configuration Raspbian, by default, uses dhcpcd to manage network interfaces. This is automatic, and most users need do no more than specify the SSID and password for wireless networks. It is possible to configure how dhcpcd works by entering options in /etc/dhcpcd.conf ; see man dhcpcd.conf .There is a good article on dhcpcd at https://wiki.archlinux.org/index.php/dhcpcd The following describe some of the more common configurations:- Fallback profile It is possible to configure a static profile within dhcpcd and fall back to it when DHCP lease fails. This is useful particularly for headless machines, where the static profile can be used as "recovery" profile to ensure that it is always possible to connect to the machine. The static profile is setup as any other Static IP Address # define static profile
profile static_eth0
static ip_address=⋯
static routers=⋯
static domain_name_servers=⋯
# fallback to static profile on eth0
interface eth0
fallback static_eth0 Prevent dhcpcd from configuring an interface This is often done to enable the Pi to act as an Access Point (which needs to be configured using other files), while allowing normal DHCP configuration on other interfaces. Add denyinterfaces wlan0 to the end of the file (but above any other added interface lines). Prevent dhcpcd from configuring a gateway on an interface If you want an interface to not install any default routes (often used in conjunction with a static IP address) specify nogateway Host Specific Configuration dhcpcd can configure interfaces dependent on the host network. This uses the Address Resolution Protocol (ARP) to probe hosts based on MAC or IP address before attempting DHCP resolution. interface bge0
arping 192.168.0.1
# My specific 192.168.0.1 network
profile dd:ee:aa:dd:bb:ee
static ip_address=192.168.0.10/24
# A generic 192.168.0.1 network
profile 192.168.0.1
static ip_address=192.168.0.98/24 You can speed up DHCP by disabling ARP probing if you are not using these features and have a simple network. noarp Use different wpa_supplicant files It is possible to configure dhcpcd to use different wpa_supplicant.conf files for a specific wireless interface. Create a file named wpa_supplicant-"$interface".conf in /etc/wpa_supplicant/ e.g. wpa_supplicant-wlan0.conf will only be used by wlan0 /etc/wpa_supplicant/wpa_supplicant.conf will be used for any other wireless interfaces. Connecting a Computer to the Pi Recent versions of Raspbian (which use dhcpcd ) allow ssh to work over a link-local address and avahi (which is a zeroconf implementation) enables programs to discover hosts running on a local network. This means you can plug the Pi into a Computer (with an Ethernet cable) or a local network router and connect without knowing the IP address. You can easily connect from Linux and OS X with ssh [email protected] (Prior to 2020-04-04 version of Bullseye the default username was 'pi', hostname raspberrypi . This is now set on initial boot.) This should work with popular GUI ssh programs.
This is sometimes problematic with some versions of Windows and networks which use .local in a non-standard way. (See https://en.wikipedia.org/wiki/.local ) NOTE .local resolution does not always work e.g. in rsync . The following should resolve IP (and can be included in bash scripts) RemotePi=$(getent hosts hostname.local | awk '{ print $1 }') If your system does not have getent to query the hosts e.g. macOS you can use the following:- RemotePi=$(arp -n hostname.local | awk '{x = $2; gsub(/[()]/, "", x); print x }') If you have multiple Pi you need to make sure each Pi has a unique hostname. You can use a crossover cable, but you don't need one (most modern interfaces automatically detect). One drawback of direct connection is that the Pi will have no Internet access and the date will not be set. You can copy the date from the host by running ssh [email protected] sudo date -s$(date -Ins) before connection. Scope: This tutorial is about setting up a normal Raspbian/Raspberry Pi OS installation to access the internet using the included software. It also covers connections to other computers on the same network. It is primarily aimed at helping new users struggling to get their Pi (especially WiFi) working . It does NOT cover:- Other Network Managers. Running advanced networking on the Pi (e.g. DHCP servers, Tunnelling, VPN, Access Point). Use of ipv6 (although if you have an ipv6 network this should work). Alternate networking setups. (There are many different ways of setting up networking.) | {
"source": [
"https://raspberrypi.stackexchange.com/questions/37920",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/8697/"
]
} |
38,321 | I have to set up a three monitor display for a museum, that will run 24/7 , and I think about a simple Pi wall. But I'd like to know if a Raspberry Pi is a good long term solution. The system will run all day long, and I hope it can last at least 5 years without troubles. It will run on UPS, with everything needed for autoreboot, and good SD cards. I know that a computer with no moving parts is already a good idea for that purpose, but I can't find info about long term reliability of the Raspberry Pi (except about pure hardware failures on the Pi itself). Is the Raspberry Pi suitable for such long term exploitation? Does anyone have info about years-long uptime with Raspberry Pi? | I assume you're talking about using the Pi for digital signage purposes.
For the last years we have deployed hundreds of Pi's doing exactly that. Many of our Pi's are not as lucky as yours: they're not on UPS and/or are on 'dirty' power lines. Lost phases, powercuts and power surge peaks are common. Roughly calculated we have about 1% failure - totally over all the years over all the Pis. This includes human originated damage. Many people complain or warn about potential SD card failure. I mustn't pretend that this is not true. But I personally haven't had any issues with that. Granted, we don't write that often but we also don't avoid writing. If you not log every time the seconds change, I doubt that it's going to be an issue. Definitely not for digital signage. Our setup generally is: Pi, $0.1 heatsink, $3 power adaptor, $1 HDMI cable, $0.01 plastic business card box casing with holes punched into them. For SD we use a variety of sizes and brands. Actually mostly non-brands; 4GB class 4 cards often collected from the bottom of drawers or pen holders. Or new $2 retail Sandisk class 4 cards. The stuff nobody wants. If I could buy them by the kilo I would. So yes, IMHO the Pi will do absolutely fine in your museum! | {
"source": [
"https://raspberrypi.stackexchange.com/questions/38321",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/13948/"
]
} |
38,622 | Since the Pi Zero doesn't come with an Ethernet port, I'm wondering what is the cheapest way to get reasonably fast network connectivity to the device? UPDATE By "network connectivity" I mean connecting to a LAN/WLAN, so the devices can talk to each other, talk to other devices, and go to the Internet. E.g., after setup I should be able to wget stackexchange.com . I don't actually care whether it's WiFi or Ethernet, but I'm guessing that Ethernet should be faster and more reliable (just a guess). Someone just asked whether this could be done with HDMI , so I know other people are looking for a solution to the same (or a similar) problem. | Two options: a) Buy Micro USB RJ45 adapter for $2.74 including shipping b) USB RJ45 adapter for $1.50 and a Micro USB OTG adapter for $0.23 (total price $1.73) Some of the articles may be cheaper if you buy them using the mobile app. EDIT: The Micro USB OTG adapter in option "b" is no longer available at the linked location. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/38622",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/40115/"
]
} |
38,931 | Currently, to get things up to date on my Raspberry Pi, I have to type in sudo apt-get update and sudo apt-get upgrade . Is there a way to set it up to automatically do this? I am running Raspbian Jessie. | Instead of a manual cron, you can install unattended-upgrades , which is useful to ensure the latest kernels are installed. It's mostly designed for security. apt-get install unattended-upgrades There are some bits that can be adjusted/configured, but the default is fine. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/38931",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/37160/"
]
} |
38,955 | Using the python script below I can make my motor run: import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
Motor1A = 16
Motor1B = 18
Motor1E = 22
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor1E,GPIO.OUT)
print "Turning motor on"
GPIO.output(Motor1A,GPIO.HIGH)
GPIO.output(Motor1B,GPIO.LOW)
GPIO.output(Motor1E,GPIO.HIGH)
sleep(2)
print "Stopping motor"
GPIO.output(Motor1E,GPIO.LOW)
GPIO.cleanup() I would like to start and stop the engine from my nodejs server. I have already tried to run python scripts from nodejs, but this gave permission problems and it is not ideal to use multiple languages for just a few commands. For these reasons I want to use https://www.npmjs.com/package/rpi-gpio This is my first attempt to convert the code to nodejs. I get the error "Error: Pin has not been exported for write" var gpio = require('rpi-gpio');
var Motor1A = 16;
var Motor1B = 18;
var Motor1E = 22;
gpio.setup(Motor1A, gpio.DIR_OUT);
gpio.setup(Motor1B, gpio.DIR_OUT);
gpio.setup(Motor1E, gpio.DIR_OUT);
gpio.write(Motor1A, gpio.HIGH, function(err) {
if (err) throw err;
console.log('Written to pin Motor1A');
});
gpio.write(Motor1B, gpio.LOW, function(err) {
if (err) throw err;
console.log('Written to pin Motor1B');
});
gpio.write(Motor1E, gpio.HIGH, function(err) {
if (err) throw err;
console.log('Written to pin Motor1E');
});
setTimeout(stopMotor_1, 2000);
function stopMotor_1() {
gpio.write(Motor1E, gpio.LOW, function(err) {
if (err) throw err;
console.log('Stopped');
});
} second attempt: gpio.setup(Motor1A, gpio.DIR_OUT, writeMotor1A);
gpio.setup(Motor1B, gpio.DIR_OUT, writeMotor1B);
gpio.setup(Motor1E, gpio.DIR_OUT, writeMotor1E);
function writeMotor1A(){
gpio.write(Motor1A, gpio.HIGH, function(err) {
if (err) throw err;
console.log('Written to pin Motor1A');
});
}
function writeMotor1B(){
gpio.write(Motor1B, gpio.LOW, function(err) {
if (err) throw err;
console.log('Written to pin Motor1B');
});
}
function writeMotor1E(){
gpio.write(Motor1E, gpio.HIGH, function(err) {
if (err) throw err;
console.log('Written to pin Motor1C');
});
} results in the same error 'Error: Pin has not been exported for write' Interestingly, when I do 'gpio-admin export 16' I get the following error: gpio-admin: could not flush data to /sys/class/gpio/export: Device or resource busy The same command for pin 18 and 22 does not return any messages. Can anyone help me convert the above script to a nodejs / rpi-gpio script? I have no experience doing this in nodejs and I can't find any good examples. | Instead of a manual cron, you can install unattended-upgrades , which is useful to ensure the latest kernels are installed. It's mostly designed for security. apt-get install unattended-upgrades There are some bits that can be adjusted/configured, but the default is fine. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/38955",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/11164/"
]
} |
39,066 | Yesterday I bought another Raspberry Pi, and installed Rasplex on it. While using Rasplex, I got this colored square on the top-right corner, indicating that the power supplied to my Raspberry Pi is not sufficient, although I was using an Anker power supply, 36 Watts , which is supposed to be more than enough. With some experimentation, I found out that out of a few Micro-USB cables, some had this problem, and some didn't. Then I found some forums confirming that USB cables can be a cause for the problem. Right now I'm using an original Nokia cable, and it works fine. My questions: How does a cable technically matter here? Is it that its resistance is too high that a strong voltage drop happens across it? If that's the case, why can't manufacturers just fix this issue? How hard can it be? How can I know whether a USB cable is good before testing it with my Raspberry Pi? Is there a specific way to test it? What about other USB cables, like Mini-USB? Can I measure some resistance or capacitance there to figure it out? | Everything for sale is built to a price. Tha manufacturer wants to make a profit. There is no need for many USB cables to carry more than a fraction of an amp so they would be built with thin wire. Thin wire is cheaper and lighter than slightly thicker wire. All other things being equal thinner wire has a higher resistance and can carry less current and will drop more volts. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/39066",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/33999/"
]
} |
39,785 | I have this configuration in /etc/network/interfaces : auto lo
iface lo inet loopback
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan0
#iface wlan0 inet dhcp
iface wlan0 inet static
address 192.168.0.110
netmask 255.255.255.0
network 192.168.0.1
gateway 192.168.0.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
iface eth0 inet static
address 192.168.0.115
netmask 255.255.255.0
network 192.168.0.1
gateway 192.168.0.1 The wireless static IP worked, but the eth0 didn't. So I tried to do the config in /etc/dhcpcd.conf : interface eth0
static ip_address=192.168.0.115/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 And it worked. I am confused and here are several questions: When to use which file? Why the wifi worked with /etc/network/interfaces but the eth0 didn't? Does dhcpcd has somehow priority over /etc/network/interface ? How to check which service has priority or someting? And which
service uses /etc/network/interface ? | There are good points in all the answers to this question, but I think that there is some scope for addressing your specific questions directly. When to use which file? I'm going to make the assumption that you are suffering from a general degree of confusion that is occurring at the moment (in the wider Raspberry Pi community) with the introduction of Debian ' Jessie ' in place of Debian 'Wheezy'. This change has made a large number of tutorials at worst obsolete and at best confusing. The answer to the question is that when using Wheezy it was normal to make changes to the /etc/network/interfaces file for the purposes of setting up network interfaces (go figure). When using Jessie, it will be necessary to make changes to '/etc/dhcpcd.conf'. However, if making changes to a wireless connection ( wlan0 ) you will also need to make changes to /etc/wpa_supplicant/wpa_supplicant.conf which is where you add the network ssid and password. Why the wifi worked with /etc/network/interfaces but the eth0 didn't? I'm not sure how the wifi connection could have worked since there is some information missing from your files (ssid at the least). As janos pointed out, the priority of the etho connection details coming after the wlan0 details probably made them operative (since they would have been seen last by the process reading the file). Does dhcpcd has somehow priority over /etc/network/interface? No, they're different and are designed to suit different purposes under Jessie. For the purposes of using Jessie in a fairly simple way you can pretty much ignore the interfaces file and work with dhcpcd.conf and wpa_supplicant.conf . How to check which service has priority or someting? And which service uses /etc/network/interface? Again I'm going to make the assumption that the question is more of a ' Which file do I use and if I have to use one which takes priority? ' question. The answer is that with the change from Wheezy to Jessie (and in a broader sense with the adoption of systemd ) the configuration of `dhcpcd.conf' and 'wpa_supplicant.conf' will be the norm and the 'interfaces' file will be left to it's own devices. What does this mean for you? Well (again) making an assumption that you're trying to set up a hard wired (eth0) and wireless (wlan0) connections with static IP addresses, you would want your interfaces file to be the default as it was initially installed; # Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf You would want your dhcpcd.conf file to include the connection details at the end of the file for both interfaces and the additional entries would probably look a bit like this; # Custom static IP address for eth0.
interface eth0
static ip_address=192.168.0.115/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
# Custom static IP address for wlan0.
interface wlan0
static ip_address=192.168.0.115/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 Lastly you would want to edit your wpa_supplicant.conf file so that it includes the ssid for the wifi network and the password. It should probably look a bit like this; ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="homenetwork"
psk="h0mepassw0rd"
} I hope that covers it off. There is the very real possibility that my assumptions are incorrect, but since I recently went through a similar learning curve I'm hoping the data is useful. I've actually written this up and you can get the information in the free ebook Just enough Raspberry Pi from Leanpub. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/39785",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/38523/"
]
} |
39,821 | I can't seem to tell if the Raspberry Pi Zero's female micro USB port is and/or requires USB OTG. I see a lot of people talking about USB OTG on the Zero, but the specs I've seen don't mention USB OTG, just USB. Therefore, do you need a USB OTG cable, or can a simple physical adapter be used in conjunction with the Pi Zero? Edit The wiki page is the best way to read up on USB OTG and what makes it different from USB. | There are good points in all the answers to this question, but I think that there is some scope for addressing your specific questions directly. When to use which file? I'm going to make the assumption that you are suffering from a general degree of confusion that is occurring at the moment (in the wider Raspberry Pi community) with the introduction of Debian ' Jessie ' in place of Debian 'Wheezy'. This change has made a large number of tutorials at worst obsolete and at best confusing. The answer to the question is that when using Wheezy it was normal to make changes to the /etc/network/interfaces file for the purposes of setting up network interfaces (go figure). When using Jessie, it will be necessary to make changes to '/etc/dhcpcd.conf'. However, if making changes to a wireless connection ( wlan0 ) you will also need to make changes to /etc/wpa_supplicant/wpa_supplicant.conf which is where you add the network ssid and password. Why the wifi worked with /etc/network/interfaces but the eth0 didn't? I'm not sure how the wifi connection could have worked since there is some information missing from your files (ssid at the least). As janos pointed out, the priority of the etho connection details coming after the wlan0 details probably made them operative (since they would have been seen last by the process reading the file). Does dhcpcd has somehow priority over /etc/network/interface? No, they're different and are designed to suit different purposes under Jessie. For the purposes of using Jessie in a fairly simple way you can pretty much ignore the interfaces file and work with dhcpcd.conf and wpa_supplicant.conf . How to check which service has priority or someting? And which service uses /etc/network/interface? Again I'm going to make the assumption that the question is more of a ' Which file do I use and if I have to use one which takes priority? ' question. The answer is that with the change from Wheezy to Jessie (and in a broader sense with the adoption of systemd ) the configuration of `dhcpcd.conf' and 'wpa_supplicant.conf' will be the norm and the 'interfaces' file will be left to it's own devices. What does this mean for you? Well (again) making an assumption that you're trying to set up a hard wired (eth0) and wireless (wlan0) connections with static IP addresses, you would want your interfaces file to be the default as it was initially installed; # Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf You would want your dhcpcd.conf file to include the connection details at the end of the file for both interfaces and the additional entries would probably look a bit like this; # Custom static IP address for eth0.
interface eth0
static ip_address=192.168.0.115/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
# Custom static IP address for wlan0.
interface wlan0
static ip_address=192.168.0.115/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 Lastly you would want to edit your wpa_supplicant.conf file so that it includes the ssid for the wifi network and the password. It should probably look a bit like this; ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="homenetwork"
psk="h0mepassw0rd"
} I hope that covers it off. There is the very real possibility that my assumptions are incorrect, but since I recently went through a similar learning curve I'm hoping the data is useful. I've actually written this up and you can get the information in the free ebook Just enough Raspberry Pi from Leanpub. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/39821",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/32392/"
]
} |
39,845 | I have read quite a bit about how to compile a kernel module on (and for) the Raspberry Pi, but I'm still not quite able to figure out why it's not working. I have been able to build the module, but it reports Invalid module format when I try to insmod the result. Here is the process I followed. First, as root under /root I executed the following shell script: getKernel.sh #! /usr/bin/bash
FIRMWARE_HASH=$(zgrep "* firmware as of" /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz | head -1 | awk '{ print $5 }')
KERNEL_HASH=$(wget https://raw.githubusercontent.com/raspberrypi/firmware/$FIRMWARE_HASH/extra/git_hash -O -)
git clone https://github.com/raspberrypi/linux
cd linux
git checkout $KERNEL_HASH
wget https://raw.githubusercontent.com/raspberrypi/firmware/$FIRMWARE_HASH/extra/Module.symvers
zcat /proc/config.gz >.config
make oldconfig
make modules_prepare
ln -s /root/linux /lib/modules/$(uname -r)/build The first few lines are from http://lostindetails.com/blog/post/Compiling-a-kernel-module-for-the-raspberry-pi-2 The rest I wrote to automate more of the process. Once all of that runs successfully, I have the source that should exactly match the running kernel, the configuration to match and a symlink. There were some redirects from the github web location (apparently it's now https://raw.githubusercontent.com/ ) but no actual errors. Then I become the default pi user and in a directory named /home/pi/projects/lkm I have this source code for a very simple toy module: hello.c #include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Do-nothing test driver");
MODULE_VERSION("0.1");
static int __init hello_init(void){
printk(KERN_INFO "Hello, world.\n");
return 0;
}
static void __exit hello_exit(void){
printk(KERN_INFO "Goodbye, world.\n");
}
module_init(hello_init);
module_exit(hello_exit); Finally, I build the module with this Makefile Makefile MODSRC=/home/pi/projects/lkm
obj-m+=hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=${MODSRC} modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=${MODSRC} clean Finally, I attempt to load the module: sudo insmod hello.ko The result, however, is disappointing: insmod: ERROR: could not insert module hello.ko: Invalid module format Possibly relevant details I'm using the currently latest jessie version of Raspbian on a Raspberry Pi2. $ uname --kernel-release --kernel-version
4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.9.2 (Raspbian 4.9.2-10) Unfortunately, I'm not sure how to further troubleshoot this or fix it. Any clues? | First of all, make sure you use the proper kernel headers. I assume that your kernel headers and source code are more updated than the kernel you're running. Try to do an apt-get update && apt-get upgrade then reinstall the module. If the problem persists, triple check that your kernel headers match your current kernel, recompile again then try to install. Note: I'm using Jessie. UPDATE: Run these as root. # The usual update routine
apt-get update -y
apt-get upgrade -y
# Update the kernel!
rpi-update You may need to reboot. After that, proceed with the commands below, still using the root account. # Get rpi-source
sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source
# Make it executable
sudo chmod +x /usr/bin/rpi-source
# Tell the update mechanism that this is the latest version of the script
/usr/bin/rpi-source -q --tag-update
# Get the kernel files thingies.
rpi-source If rpi-source throws a GCC error (something about a version mismatch), it's okay as long as your current GCC version is higher . Run rpi-source --skip-gcc instead of rpi-source Then, proceed with your Hello World example. Create the folder and cd into it. Then, create the files. mkdir hello
cd hello Files: hello.c #include <linux/module.h>
#include <linux/kernel.h>
int hello_init(void)
{
pr_alert("Hello World :)\n");
return 0;
}
void hello_exit(void)
{
pr_alert("Goodbye World!\n");
}
module_init(hello_init);
module_exit(hello_exit); Makefile (case-sensitive?) obj-m := hello.o Now that you have your files, you can go ahead and run the usual Hello World build commands: make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
insmod hello.ko You should now check dmesg . The last line should print Hello World :) highlighted in red. If you do, congratulations. You just made and installed a kernel module. Now remove it using rmmod hello . dmesg should now print Goodbye World! highlighted in red. Sources: 1 2 3 | {
"source": [
"https://raspberrypi.stackexchange.com/questions/39845",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/38114/"
]
} |
39,932 | What are the differences between Raspbian Jessie and Raspbian Jessie Lite ? What's better for a Owncloud server: Raspbian Jessie or Raspbian Jessie Lite ? | If I understand this and that right, the lite distribution is just a Minimal image based on Debian Jessie without the X-server and its components installed. Meaning it uses less space on the SD-card and can run from a smaller SD card. Installing the minimal image will also reduce traffic during updates (as pointed out by Jacob). Any desired package can still be installed by apt-get . Technically, Jessie Lite should suffice to run an ownCloud server. The MagPi, Issue 56, put it this way: Lite is a minimal version of the Raspbian image for the
Raspberry Pi. This means it has less software installed
on it, and fewer modules will load with the kernel,
which results in the operating system using a lot less of
the Raspberry Pi’s resources. It will use less electricity
this way and perform a little faster for very specific
tasks, such as file servers or other uses where it never
needs to use a monitor. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/39932",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/-1/"
]
} |
40,105 | I've made a python script using the RPi.GPIO library. I need to run it without root but I get this error when running it with "python ./script.py": No access to /dev/mem. Try running as root! I've read in many places that you no longer need root with the latest version of the library but I still get the error after updating. The version I have is RPi.GPIO 0.6.0a3 Here is the code: import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
print "LED on"
GPIO.output(18,GPIO.HIGH)
time.sleep(1)
print "LED off"
GPIO.output(18,GPIO.LOW) And the full error: pi@raspberrypi ~/Desktop/python $ python ./sensors.py
Traceback (most recent call last):
File "./sensors.py", line 5, in <module>
GPIO.setup(18,GPIO.OUT)
RuntimeError: No access to /dev/mem. Try running as root! When I run it as root it works. | You probably need to be running Raspbian to use RPi.GPIO as a non-root user, possibly it needs to be jessie as well. Does /dev/gpiomem exist? If so RPi.GPIO should use this device to access the GPIO. If /dev/gpiomem does not exist try: sudo rpi-update to make sure you are using a recent kernel, and sudo apt-get update
sudo apt-get upgrade to make sure you are using a recent RPi.GPIO. You will also need to make sure you are a member of the gpio group: sudo adduser pi gpio EDITED TO ADD The Raspbian system appears to be in a state of flux. I'm not sure if it's a Raspbian or (more likely) a raspberrypi.org problem. Check that /dev/gpiomem has the correct permissions. $ ls -l /dev/gpiomem
crw-rw---- 1 root gpio 244, 0 Dec 28 22:51 /dev/gpiomem If it doesn't then set the correct permissions as follows sudo chown root.gpio /dev/gpiomem
sudo chmod g+rw /dev/gpiomem | {
"source": [
"https://raspberrypi.stackexchange.com/questions/40105",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/29015/"
]
} |
40,631 | I'd like to put my Raspberry Pi into a kiosk mode with Chromium directed to my website but I can't seem to figure out how to get it to work. I've been following a few different guides, and the code they have given me has all been slightly different so I'm not sure what exactly to follow. So far I've tried a few different variations of changing the code in /etc/xdg/lxsession/LXDE-pi/autostart with this: #@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank
@chromium --noerrdialogs --kiosk http://localhost --incognito I also put the same code in /etc/xdg/lxsession/LXDE/autostart It still boots to just the desktop and I'm at a loss of what to do, as there doesn't seem to be very many tutorials discussing this and none that are recent. | I have a Raspberry Pi 2 running Raspbian Jessie with Chromium 45 installed. I found that you need to copy the existing autostart file to your local: mkdir -p /home/pi/.config/lxsession/LXDE-pi/
cp /etc/xdg/lxsession/LXDE-pi/autostart /home/pi/.config/lxsession/LXDE-pi/autostart So edit this local version: nano /home/pi/.config/lxsession/LXDE-pi/autostart
#@xscreensaver -no-splash # comment this line out to disable screensaver
@xset s off
@xset -dpms
@xset s noblank
@chromium-browser --incognito --kiosk http://localhost/ # load chromium after boot and point to the localhost webserver in full screen mode Save sudo reboot | {
"source": [
"https://raspberrypi.stackexchange.com/questions/40631",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/39355/"
]
} |
40,680 | If you have a raspberry on some location and it must run a python script "forever" (a year, maybe two, without me being on location), how often should I reboot it? I know people are keeping them alive for a year+, but I wrote a simple script that can reboot it at given time + raspberry will automatically run the python script on boot. | I've got a couple of Pis running my Ham Radio repeater and irrigation system - realistically, I'm rebooting them maybe once every 6 months for security updates or some other "maintenance" reason; but I've not seen issues where a reboot was REQUIRED to "keep things running" | {
"source": [
"https://raspberrypi.stackexchange.com/questions/40680",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/38254/"
]
} |
40,689 | I've installed Raspbian Jessie with dd to my Pi1-B. Everything works fine and I can connect to it via ssh . I do not need any graphical system and want to keep the machine as simple as possible. Therefor I've downloaded and installed Raspbian Jessie Lite. But I cannot get a connection. Error message: Permission denied, please try again. The server is running because it says: debug1: match: OpenSSH_6.7p1 Raspbian-5 pat OpenSSH* compat 0x04000000 Is there any difference between the two images that keeps me from accessing the machine with user pi and password raspberry ? | From https://www.raspberrypi.org/documentation/remote-access/ssh/ As of the November 2016 release, Raspbian has the SSH server disabled
by default. You will have to enable it manually. This is done using
raspi-config: Enter sudo raspi-config in the terminal, first select Interfacing options , then navigate to ssh , press Enter and select Enable or disable ssh server . For headless setup, SSH can be enabled by placing a file named 'ssh',
without any extension, onto the boot partition of the SD card. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/40689",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/39409/"
]
} |
40,831 | I'm using Raspbian Jessie (2015-11-21) to run Jasper (master branch) on the Raspberry Pi 2 Model B.
The installation instructions in the documentation seem to be for Wheezy and not Jessie. Running Jasper on Wheezy works fine. But, on Jessie, I had problems configuring the sound. Either my mic worked but not the speaker or vice versa. What needs to be done is, the default sound card must be set to USB because that is where my USB mic is connected and Jasper requires this. There are a lot of answers that talk about configuring ALSA via ~/.asoundrc , /etc/asound.conf and even /usr/share/alsa/alsa.conf but none of them worked for me. When I open my mixer via alsamixer and hit F6 , I always see bcm2835 as the default card. That's the Pi2's default card but I want to make my USB the default card. How do I do this? | According to the ALSA Wiki , under the title that reads " How to choose a particular order for multiple installed cards ", it states the following: Which card is card number 0, 1 and so is by default determined by module load order. This is particularly useful to choose which card becomes the default one. In theory therefore it is possible to choose which of several installed cards becomes card 0, the default one, by ensuring its driver module is loaded first. (Note: this assumes that each sound card requires a different driver. If you have two soundcards of the same type, please skip to the next section.) There are two ways to achieve this, the "old" index= option of the card driver module, and the alternative (and new) slots= option of the snd module. It documents two methods of doing this: The older "index=" method The newer "slots=" method The former is what the Jasper installation instructions recommend. It's also what a majority of the solutions out there talk about. However, this is the older method and may not work on more current Raspbian Jessie images. A combination of both methods is what worked for me. First of all, check to see what order your cards have been loaded in: $ cat /proc/asound/modules
0 snd_bcm2835
1 snd_usb_audio Counting cards begins from 0 so the default bcm2835 is loaded first and my USB card which has my mic is loaded second. To reorder my cards, I first create a file named /etc/modprobe.d/alsa-base.conf . It can be named anything you want as long as it ends with .conf . I then added the following: # This sets the index value of the cards but doesn't reorder.
options snd_usb_audio index=0
options snd_bcm2835 index=1
# Does the reordering.
options snd slots=snd_usb_audio,snd_bcm2835 The comments should explain what each line does.
Once you do that, it seems you have to reboot your machine for it to work. Once you reboot, you should be able to record some audio with the default card which should now be your mic: $ arecord temp.wav and then play it, specifying the card as 1 and device as 0 which is where your speaker output should be: aplay -D plughw:1,0 temp.wav I initially only added the line with slots in it. This worked in making my USB card the default card but it was indexed wrong. For example, once I did that, this is what my /proc/asound/modules looked like: $ cat /proc/asound/modules
1 snd_usb_audio
2 snd_bcm2835 Ideally, it should look like this: 0 snd_usb_audio
1 snd_bcm2835 And that is why I also use the index method to achieve this. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/40831",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/36112/"
]
} |
40,839 | I am getting an error on bluetooth service status. I need guidance to resolve this error. pi@raspberrypi:~ $ sudo service bluetooth status
* bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
Active: active (running) since Sat 2016-01-09 19:12:47 UTC; 1min 12s ago
Docs: man:bluetoothd(8)
Main PID: 370 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
`-370 /usr/lib/bluetooth/bluetoothd
Jan 09 19:12:46 raspberrypi bluetoothd[370]: Bluetooth daemon 5.23
Jan 09 19:12:47 raspberrypi bluetoothd[370]: Starting SDP server
Jan 09 19:12:47 raspberrypi systemd[1]: Started Bluetooth service.
Jan 09 19:12:47 raspberrypi bluetoothd[370]: Bluetooth management interface 1.9 initialized
Jan 09 19:12:47 raspberrypi bluetoothd[370]: Sap driver initialization failed.
Jan 09 19:12:47 raspberrypi bluetoothd[370]: sap-server: Operation not permitted (1)
pi@raspberrypi:~ $ | SAP stands for SIM Access Profile , so you have to disable it: Open /etc/systemd/system/bluetooth.target.wants/bluetooth.service Change: ExecStart=/usr/lib/bluetooth/bluetoothd To ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap Reload the systemd: $ sudo systemctl daemon-reload Restart the bluetooth: $ sudo service bluetooth restart Get the bluetooth status: $ sudo service bluetooth status
bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)
Active: active (running) since Sat 2016-04-30 10:38:46 UTC; 6s ago
Docs: man:bluetoothd(8)
Main PID: 12775 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─12775 /usr/lib/bluetooth/bluetoothd --noplugin=sap | {
"source": [
"https://raspberrypi.stackexchange.com/questions/40839",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/39598/"
]
} |
40,854 | When booting, the sequence stops at the following: Kernel panic-not syncing: VFS: unable to mount root fs on unknown-block(179,6) What can I do to get my Raspberry Pi 2 to boot again using the existing Raspbian installation , as it contains many files and configurations that would be too painful to recreate? NOTE: This , this and this are related but are different. | Please note there is a clear distinction between errors, based on the numbers at the end and I won't go into much details as they can be easily discovered online if required. These fixes assume that you have all the needed connections working (power, SD card, HDMI, wired keyboard, mouse) and are using Raspbian along with NOOBS. The details for error ending with 2 is at the end of the answer. If your error message ends with 6 , like this: Kernel panic-not syncing: VFS: unable to mount root fs on unknown-block(179, 6 ) you will need to do a filesystem check & repair: Start the Raspberry holding the Shift key. Once NOOBS loads, press Alt-F2 to access the recovery command line. Login with username root and password raspberry . Type fsck.ext4 -y /dev/mmcblk0p6 . This will scan and attempt to repair the corrupted file system (replace ext4 with your partition type if needed). Note that the auto mode of fsck (i.e. only typing fsck instead of fsck.ext4 ) is not supported. Type shutdown -h now to shutdown the Raspberry cleanly. Unplug the power cable and plug it back in. The Raspberry should now start fine. If your error message ends with 2 , like this: Kernel panic-not syncing: VFS: unable to mount root fs on unknown-block(179, 2 ) it is likely that the problem is caused by an update bug. The fix involves switching that 2 into a 6 : Start the Raspberry holding the Shift key. Click the Edit config (e) button or press e . Click the cmdline.txt tab or press the right arrow on the keyboard. Replace: root=/dev/mmcblk0p 2 with root=/dev/mmcblk0p 6 Click OK and then press escape on the keyboard to proceed with the boot sequence. Your Pi should now boot fine. If the same error shows but with 6 proceed with the above steps. In some cases, the Pi might ignore the change made in the NOOBS GUI and you would still see the exact same error, with 2 at the end when booting. In this case, tktbjp's answer might help: Actually it is simple to use the recovery mode. I entered recovery
mode and pressed alt-F2 to loging as root. Changing cmdline.txt from
the GUI does not work. After logging in as root with password raspberry, check if there is
any /boot directory. Most probably it will not be present. If not then
create it using mkdir /boot Then use vi editor to create cmdline.txt. #cd /boot #vi cmdline.txt in vi editor change the root to mmcblk0p6. My cmdline.txt contents
looks like dwc_otg.lpm_enable=0 console=ttyAM0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait save the file. then it is important to do sync. #sync Then boot the board. Cross check using GUI if cmdline is really
changed. My PI B+ is working now | {
"source": [
"https://raspberrypi.stackexchange.com/questions/40854",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/3866/"
]
} |
40,974 | I've been using my PC to access the files on RPi, using Samba Server on RPi. But, Is there any way I could open Samba Connections on Pi? Like browsing Windows PC Samba Files on RPi? | First install some packages: apt-get install samba-common smbclient samba-common-bin smbclient cifs-utils Then, create a local directory and mount the remote share: mkdir /mnt/abc
mount -t cifs //server/share /mnt/abc where server is your windows computer name (dns or netbios) and share is your windows shared directory. Depending on the access you give to your windows share are the credentials required: if you give your share 'Everyone' read (and write) access nothing else is required, otherwise you must add credentials at mount time: mount -t cifs //server/share /mnt/abc -o user=user,pass=password,dom=domain replace with your own credentials. When finished just dismount the share: umount /mnt/abc | {
"source": [
"https://raspberrypi.stackexchange.com/questions/40974",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/27757/"
]
} |
41,020 | I'm doing a headless setup, where we use the Pis in field work (tracking movement of seals via camera in the Cape Cod area), and so we can only monitor it headless, without a separate display (to save on power). In order to have the Pis get time, I need them to connect to my colleague's iPhones (which are operating as hotspots), and use ntpd to get time from the internet. However, I haven't yet figured out what the command is to query the WiFi network name, to confirm that it is connected to the right network - is there one? | iwgetid will give you the SSID | {
"source": [
"https://raspberrypi.stackexchange.com/questions/41020",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/38461/"
]
} |
41,767 | I'm using an 8GB SD card and installed Raspbian which is 3.9GB large.
I suppose that about 4GB should be available, but it isn't.
When I type 'df -ah' on my Raspberry pi, it shows Only 65MB is available.... And this is diskutil list on my Mac OS X And I did not install nothing but open-ssh..and vim.. | It appears that you have not yet expanded your file system. Run sudo raspi-config . Select Expand Filesystem (the first option at the time of this writing), and follow the instructions. After rebooting the system you should have significantly more space available. | {
"source": [
"https://raspberrypi.stackexchange.com/questions/41767",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/40426/"
]
} |
42,145 | Is there a possibility to store a hardware ID for each Raspberry Pi based device? Let's say I have 10 custom devices based on Raspberry Pi platform that are used for distributed tasks. At some point, for some reason, I want to erase everything from one of them. How can I re-identify the board after that? Does Pi have a chip that stores a unique ID like a serial number for every board? If not, can I add a (read-only) memory (that can store a simple value even when not powered) to be able to communicate with it through GPIO at any time? What are the alternatives? | Yes each board has a serial number. Methods to retrieve this are described here: How do I get the serial number? | {
"source": [
"https://raspberrypi.stackexchange.com/questions/42145",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/34081/"
]
} |
42,151 | I have 8 330 ohm resistors wired up to 8 gpio pins (8 anodes), then I have the 4 cathodes wired to 4 other gpio pins. I tested all my connections with a multimeter and everything looks good. Then when I run my python script, only some of the segments light up. import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
segments = {19, #a
20, #b
21, #c
22, #d
18, #e
24, #f
27, #g
26} #dp
for segment in segments:
GPIO.setup(segment, GPIO.OUT)
GPIO.output(segment, 1) # send a signal to each segment
digits = [17, 16, 13, 12]
for digit in digits:
GPIO.setup(digit, GPIO.OUT)
GPIO.output(digit, 0) # set the common cathode for each digit
try:
while True:
pass
except KeyboardInterrupt:
GPIO.cleanup() | Yes each board has a serial number. Methods to retrieve this are described here: How do I get the serial number? | {
"source": [
"https://raspberrypi.stackexchange.com/questions/42151",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/37208/"
]
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.