TheWaterbug
Posts: 73
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 5:28 am

I just fired up my Pi3 for the first time in awhile, and things are generally working as they were, except that it couldn't resolve any external hosts.

I looked at /etc/resolv.conf, and it has an old DNS server (192.168.0.8) that no longer exists, from when the Pi was booted up in my office, with an old server running DNS.

My DHCP server here at home is supposed to pushing a different DNS server to it (192.168.0.12), but it doesn't take.

I can't edit /etc/resolv.conf because the fs is RO, and I can't remount /

I tried mounting the micro SD card on my Mac so I could edit things, but the can't find /etc/resolv.conf, or anything else for that matter. I think the fs is in an .img file or something.

How do I get a new DNS server setting into this old Pi?

Thanks!

User avatar
DougieLawson
Posts: 33382
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 8:51 am

Get a new SDCard, use the card cloning tool to build it from your broken SDCard.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

TheWaterbug
Posts: 73
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 8:02 pm

Ah, I should clarify that this installation started with the PI Camera installation from script, and that script includes a bunch of operations to write-protect certain things.

I thought I'd unprotected the correct things, but perhaps not.

I did need to modify config.txt, and the following did work successfully:

Code: Select all

sudo mount -o rw,remount,rw /
sudo nano /boot/config.txt
But it doesn't work for /.

Do I necessarily have a corrupt card? Or is this something that can be fixed? I spent a loooooong time getting ffmpeg compiled on this card, so I'd like to avoid re-doing that if possible.

Thanks!

User avatar
DougieLawson
Posts: 33382
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 8:07 pm

It's impossible for us to tell.

If any part of the filesystem can be mounted as read/write can you write a file there, shutdown, reboot and see if the file and it's contents are intact.

Or if you're willing to trash the SDcard try formatting it in a camera, phone or tablet.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

TheWaterbug
Posts: 73
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 8:28 pm

I can make /boot rw:

Code: Select all

[email protected]:/boot $ sudo nano deleteme.txt

Error writing /root/.nano_history: Read-only file system
[email protected]:/boot $ ls
bcm2708-rpi-0-w.dtb     bcm2708-rpi-cm.dtb   bcm2710-rpi-cm3.dtb  config.txt     fixup_cd.dat  fixup_x.dat  kernel.img        overlays      start.elf
bcm2708-rpi-b.dtb       bcm2709-rpi-2-b.dtb  bootcode.bin         COPYING.linux  fixup.dat     issue.txt    LICENCE.broadcom  start_cd.elf  start_x.elf
bcm2708-rpi-b-plus.dtb  bcm2710-rpi-3-b.dtb  cmdline.txt          deleteme.txt   fixup_db.dat  kernel7.img  LICENSE.oracle    start_db.elf
[email protected]:/boot $ sudo reboot

Broadcast message from [email protected] on pts/0 (Thu 1970-01-01 06:21:27 PST):

The system is going down for reboot NOW!

[email protected]:/boot $ Connection to 192.168.1.31 closed by remote host.
Connection to 192.168.1.31 closed.
My-MBP-2012:~ steven$ ssh [email protected]
[email protected]'s password: 

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Apr 21 16:35:31 2017 from 192.168.0.237
[email protected]:~ $ cd /boot
[email protected]:/boot $ ls
bcm2708-rpi-0-w.dtb     bcm2708-rpi-cm.dtb   bcm2710-rpi-cm3.dtb  config.txt     fixup_cd.dat  fixup_x.dat  kernel.img        overlays      start.elf
bcm2708-rpi-b.dtb       bcm2709-rpi-2-b.dtb  bootcode.bin         COPYING.linux  fixup.dat     issue.txt    LICENCE.broadcom  start_cd.elf  start_x.elf
bcm2708-rpi-b-plus.dtb  bcm2710-rpi-3-b.dtb  cmdline.txt          deleteme.txt   fixup_db.dat  kernel7.img  LICENSE.oracle    start_db.elf
[email protected]:/boot $ 
but not /

Code: Select all

[email protected]:/etc $ sudo mount -o remount,rw /
mount: / not mounted or bad option

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

User avatar
DougieLawson
Posts: 33382
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 8:30 pm

So that means you've trashed /etc/fstab.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

TheWaterbug
Posts: 73
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 8:45 pm

Code: Select all

[email protected]:/ $ cat etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
That's what it looks like right now.

What puzzles me is that I was able to apt-get ffmpeg and compile it, and I don't think I made any fs changes after that.

User avatar
DougieLawson
Posts: 33382
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 9:16 pm

Get a new SDCard, download a copy of Raspbian, install a version of Etcher.

Use Etcher to write Raspbian to your new SDCard. Stick that in your RPi and boot the system. Get the broken SDCard in a USB reader, mount the USB reader in your RPi. Open a command window and run the following:

sudo -i
for i in a1 a2
do
umount /dev/sd$i
fsck -f -y /dev/sd$i
done
exit


Shutdown, swap cards back and see what happens.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

TheWaterbug
Posts: 73
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Mon Jan 22, 2018 10:26 pm

^^
Thanks! I do have another SD card, so I will give this a try.

TheWaterbug
Posts: 73
Joined: Fri Feb 05, 2016 12:35 am
Location: Los Angeles, CA, USA, Earth

Re: Pi3 stuck with wrong DNS server and RO filesystem?

Tue Jan 23, 2018 5:46 am

DougieLawson wrote:
Mon Jan 22, 2018 9:16 pm
Get the broken SDCard in a USB reader, mount the USB reader in your RPi. Open a command window and run the following:

sudo -i
for i in a1 a2
do
umount /dev/sd$i
fsck -f -y /dev/sd$i
done
exit


Shutdown, swap cards back and see what happens.
Working! Thank you very much!

So my ffmpeg script will now run and pull video from my Reolink RLC-423S and push it out to my YouTube streaming channel. Behold the BeeCam!

Image

That was footage from earlier, when I ran ffmpeg from an aging iMac.

If my little Pi-based ffmpeg relay station is up and running, you'll get a prompt that "IAmTheWaterbug Is Now Live!" and you'll get video with a current Los Angeles timestamp (minus about 40 seconds), with video of my bees (during a Los Angeles daytime)

Now I just need to figure out how to get my script to run at startup, so that it will survive a bounce. I'll start a separate thread for that.

Return to “General discussion”

Who is online

Users browsing this forum: GAP and 32 guests