Notifications
Clear all

Can't get the webcam to work with Octoprint.  

Strona 4 / 4
  RSS
Walter Layher
(@walter-layher)
Prominent Member
RE: Can't get the webcam to work with Octoprint.

Output of the pi with 8.8.8.8 as DNS:

root@octopi:/home/pi# nslookup google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   google.com
Address: 142.250.186.142
Name:   google.com
Address: 2a00:1450:4001:82a::200e

root@octopi:/home/pi# ping google.com
PING google.com(fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e)) 56 data bytes
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=1 ttl=117 time=20.4 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=2 ttl=117 time=34.9 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=3 ttl=117 time=33.5 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=4 ttl=117 time=19.6 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=5 ttl=117 time=24.1 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=6 ttl=117 time=16.9 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=7 ttl=117 time=49.8 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=8 ttl=117 time=55.7 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=9 ttl=117 time=21.5 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=10 ttl=117 time=21.4 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=11 ttl=117 time=21.2 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=12 ttl=117 time=48.3 ms
64 bytes from fra24s07-in-x0e.1e100.net (2a00:1450:4001:82a::200e): icmp_seq=13 ttl=117 time=23.0 ms
^C
--- google.com ping statistics ---
13 packets transmitted, 13 received, 0% packet loss, time 12020ms
rtt min/avg/max/mdev = 16.869/30.034/55.727/12.724 ms
root@octopi:/home/pi# ping plugins.octoprint.org
PING plugins.octoprint.org(2a01:4f8:1c0c:6958::1 (2a01:4f8:1c0c:6958::1)) 56 data bytes
64 bytes from 2a01:4f8:1c0c:6958::1 (2a01:4f8:1c0c:6958::1): icmp_seq=1 ttl=52 time=67.5 ms
64 bytes from 2a01:4f8:1c0c:6958::1 (2a01:4f8:1c0c:6958::1): icmp_seq=2 ttl=52 time=22.1 ms
64 bytes from 2a01:4f8:1c0c:6958::1 (2a01:4f8:1c0c:6958::1): icmp_seq=3 ttl=52 time=29.7 ms
64 bytes from 2a01:4f8:1c0c:6958::1 (2a01:4f8:1c0c:6958::1): icmp_seq=4 ttl=52 time=33.8 ms
64 bytes from 2a01:4f8:1c0c:6958::1 (2a01:4f8:1c0c:6958::1): icmp_seq=5 ttl=52 time=40.1 ms
64 bytes from 2a01:4f8:1c0c:6958::1 (2a01:4f8:1c0c:6958::1): icmp_seq=6 ttl=52 time=26.4 ms
^C
--- plugins.octoprint.org ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5010ms
rtt min/avg/max/mdev = 22.145/36.610/67.534/14.935 ms
Opublikowany : 06/10/2023 8:01 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Can't get the webcam to work with Octoprint.

Try to change the DNS server like I described.

Opublikowany : 06/10/2023 8:06 pm
BillR94
(@billr94)
Eminent Member
Topic starter answered:
RE: Can't get the webcam to work with Octoprint.

 

Posted by: @walter-layher

Cause what? That it works? 🙂
Don't think so. The imager works okay, I think. I am just not sure it works with every pi distribution. But they recommend it on OctoPrint, so it should not do something bad. The network setup of the pi happened via DHCP, not via any values that I entered. I just entered SSID, password and changed the country. I did no other changes to the pristine image and it worked. The error must be something in your LAN or wifi setup that does not assign a valid DNS server.
But you can try to change the DNS to 8.8.8.8 like I suggested earlier. I will try that now on mine that uses the default DNS for my home network and report back what happenes with 8.8.8.8 as DNS server on the pi.

I tried *.8.8.8.8, 1.1.1.1, 9.9.9.9, 2.2.2.2. with octopi web interface. They ALL connect. Only hostname does not connect. I can ping the DNS but can't ping a web address. I looked at my router and I see nothing in there that indicates blocking internet access. I tried logging into the pi via putty and getting an "update". That failed too. It seems my issue is that the pi is not connecting to the internet but I have no idea why. I have googled this issue and found several posts on it but none of the suggestions I have tried fix the issue. Everything else seems to be working fine. I would sure like to get some of the plugins to make life easier. Wonder if there is a way to manually install them from the repository.

 

Opublikowany : 06/10/2023 8:10 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Can't get the webcam to work with Octoprint.

The value in the web interface is not permanent, that is only for the accessibility test. The value for the system DNS (used for updates and the rest) is not affected by this. Just try to change the file /etc/resolv.conf. The pi won't explode! 🙂 But perhaps it will change something for the better. No reboot necessary, the change is in effect immediately and you can change it back anytime.

Opublikowany : 06/10/2023 8:18 pm
BillR94
(@billr94)
Eminent Member
Topic starter answered:
RE: Can't get the webcam to work with Octoprint.

if the time is not correct, would that be because it can't connect to the time clock website? Which again points back to no internet?

Opublikowany : 06/10/2023 8:19 pm
BillR94
(@billr94)
Eminent Member
Topic starter answered:
RE: Can't get the webcam to work with Octoprint.

 

Posted by: @walter-layher

The value in the web interface is not permanent, that is only for the accessibility test. The value for the system DNS (used for updates and the rest) is not affected by this. Just try to change the file /etc/resolv.conf. The pi won't explode! 🙂 But perhaps it will change something for the better. No reboot necessary, the change is in effect immediately and you can change it back anytime.

ok..I did sudo nano /etc/resolv.conf and got the attached screen. Is this correct??

Opublikowany : 06/10/2023 8:23 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Can't get the webcam to work with Octoprint.

Here is the content of the file on my pi:

root@octopi:/home/pi# cat /etc/resolv.conf
# Generated by resolvconf
domain fritz.box
nameserver 8.8.8.8
#nameserver 192.168.95.26

The lines with # are commented and have no effect. I commented out the last line that has the DNS server that was assigned by my DHCP. I added the line "nameserver 8.8.8.8" and saved the file. That was all that I did. Please try the same and then report back what happens.

Opublikowany : 06/10/2023 8:24 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Can't get the webcam to work with Octoprint.

What is this IP address there? Is this your DNS server? If this is the IP of your Pi you have found the source of the problem. Replace it with "nameserver 8.8.8.8" and you will most certainly see a difference.

Opublikowany : 06/10/2023 8:26 pm
BillR94
(@billr94)
Eminent Member
Topic starter answered:
RE: Can't get the webcam to work with Octoprint.

OMG!!! THAT WORKED!!!!

Thank you sooooooooooooooooooooooo much!

Opublikowany : 06/10/2023 8:29 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Can't get the webcam to work with Octoprint.

I saw earlier that my pi had the local time for London. I changed it to the correct timezone with raspi-config and the time was correct. But that did not make a difference as it worked correctly before.

Opublikowany : 06/10/2023 8:29 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Can't get the webcam to work with Octoprint.

Phew! 🙂 Congratulations! 🙂

Opublikowany : 06/10/2023 8:30 pm
BillR94
(@billr94)
Eminent Member
Topic starter answered:
RE: Can't get the webcam to work with Octoprint.

I would have never found that without your help. Thank you! Thank you!

Opublikowany : 06/10/2023 8:30 pm
Walter Layher polubić
Walter Layher
(@walter-layher)
Prominent Member
RE:

Little addendum to make this change permanent. The file /etc/resolv.conf is recreated at boot so you need to circumvent that if you want to use a certain DNS server. Normally you should not have to do that when you use DHCP and your DHCP server is setup correctly. But the raspberry imager seems to bake the DNS server IP into the cake somewhere during setup of the image. So if you enter an invalid IP for the DNS server you are kinda screwed. You could search the config files for the IP address to find out where that entry is, but this might be a bit complicated. But there are simpler ways to override the setting.
To override that setting you need to create a file with your preferred DNS servers setting. Follow these two steps.

sudo nano /etc/resolv.conf.head

Add the following to this file:

## google
nameserver 8.8.8.8

## Quad9
nameserver 9.9.9.9

## OpenDns Servers
nameserver 208.67.222.222
nameserver 208.67.220.220

These are examples, you can add what you want. You don't need all of them but you should add at least one that always works. Then close the file and reboot. If you look at the file /etc/resolv.conf after the next boot the nameservers you added are all there at the beginning of the file, so they are used first to resolve IP addresses.
There also is the possibility to make the change in DNS servers permanent by adding a line to the config for the DHCP client. Add this line into file /etc/dhcp/dhclient.conf at the end:

option domain-name-servers 8.8.8.8, 9.9.9.9, 208.67.222.222, 208.67.220.220

Also these IP addresses are just (working) examples, you add the servers you want. You only need to use one of these solutions, not both.

Again, after a reboot of the pi the names should be in /etc/resolv.conf and name resolution should work as intended.

Opublikowany : 07/10/2023 7:35 am
BillR94
(@billr94)
Eminent Member
Topic starter answered:
RE:

Thank you Walter. Actually, I had previously setup a static ip address in dhcpcd.conf to look like the following:

interface wlan0
static ip-address=192.168.0.119/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

When I changed the /etc/resolv.conf file as you suggested earlier, it worked. But after I would reboot the pi, it stopped working again, After some thought I remembered I had set a static DNS server, So, I went back in and added the 8.8.8.8 etc and now even after a reboot, it works as it should.

interface wlan0
static ip-address=192.168.0.119/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8, 1.1.1.1, 9.9.9.9, 192.168.0.1

Again, thank you so much for all your help. I could not have done this without all the suggestions. 

This post was modified 1 year temu by BillR94
Opublikowany : 07/10/2023 1:20 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Can't get the webcam to work with Octoprint.

Great, you figured it out yourself! Glad I could be of help. Everybody has their own preferences concerning DHCP or static IP. Main thing is that it works and you know what to do if it does not. 🙂

Opublikowany : 07/10/2023 1:24 pm
Strona 4 / 4
Share: