AIY Voice Kit V1的Google Assistant开机自启失败求助
Hey there! Let's break down what's going wrong here and get your Google Assistant working on boot, step by step.
First, Let's Decode That Error
The google.auth.exceptions.TransportError with the message Temporary failure in name resolution is telling you one key thing: when your assist.service launched on boot, your Raspberry Pi couldn't translate the domain oauth2.googleapis.com into an IP address (that's what DNS does). This almost always happens because the service started before your Pi's network (including DNS) was fully ready—even though you added network-online.target, the Pi's network setup can sometimes lag behind systemd's startup timing.
Step 1: Update Your systemd Service File
Let's tweak your service file to ensure it waits properly for the network (and DNS) to be fully operational. Open the file with this command:
sudo nano /etc/systemd/system/assist.service
Replace the existing content with this updated version:
[Unit] Description=Assist @ reboot Wants=network-online.target nss-lookup.target After=network-online.target nss-lookup.target Wants=systemd-timesyncd.service After=systemd-timesyncd.service [Service] Environment=DISPLAY=:0 Type=simple Restart=always User=pi # Wait for Google's auth server to be reachable before starting ExecStartPre=/bin/sh -c 'until ping -c 1 oauth2.googleapis.com; do sleep 1; done' ExecStart=/usr/bin/python3 -u /home/pi/AIY-projects-python/src/examples/voice/main.py --language en-US [Install] WantedBy=multi-user.target
Here's what changed:
- Added
nss-lookup.targetto dependencies: this systemd target waits specifically for DNS resolution to work, which fills a gap thatnetwork-online.targetmight miss. - Added
ExecStartPre: this command pings Google's authentication server repeatedly until it succeeds, ensuring the network is fully ready before launching the Assistant.
Step 2: Reload and Test the Service
Save the file (press Ctrl+O, hit Enter, then Ctrl+X to exit nano), then run these commands to apply the changes:
# Reload systemd to recognize the updated service file sudo systemctl daemon-reload # Restart the service immediately to test fixes sudo systemctl restart assist.service # Check if the service is running without errors sudo systemctl status assist.service
If the status shows "active (running)" and no DNS-related errors, reboot your Pi to confirm it works on startup:
sudo reboot
Extra Checks If It Still Fails
- Verify basic network connectivity: After rebooting, run
ping oauth2.googleapis.comin a terminal. If this fails, your Pi has a general network issue (not just a service timing problem)—check your Wi-Fi/Ethernet connection or router settings. - Check DNS settings: Run
cat /etc/resolv.confto see your DNS servers. You should see at least one valid entry (likenameserver 8.8.8.8for Google's public DNS). If not, update your Wi-Fi settings to add a reliable DNS server. - Confirm file paths: Make sure
main.pyexists at the path you specified—runls /home/pi/AIY-projects-python/src/examples/voice/to double-check the file is there.
内容的提问来源于stack exchange,提问作者Dogeun Oh

