It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
avatar
dtgreene: The situation involves me likely not being near the computer (perhaps I'm at one of thoes in-person events we used to have), but still need to be able to access it remotely (say, by ssh). In this case, LEDs at home would not be visible.
Oh boy. Well, that changes things. Forget everything I said earlier. :D

Do you already have access to your home network from outside? If not, that is the most difficult part.

If you have an Android phone, I would recommend JuiceSSH (free for standard, a few euros for pro -- it doesn't cost much and is really useful so I recommend paying the few euros). Once you get ssh connection, you can do everything you want. Just install WOL on the RPi and the RPi connection is all you need to get things going.

But to get to your home network from outside, that's the tricky part...

Your ISP probably uses dynamic IPs so every time this changes, you are going to have trouble. Unless...
I would recommend you either use a static IP or reserve an IP on the DHCP server for the RPi. Then set up an account at dnsdynamic.org or noip.com and you will get an address like dtgreene.dnsdynamic.org. On the RPi, you can install ddclient. It's in the repos so just sudo apt install ddclient. Add the dnsdynamic/noip infos into the ddclient.conf, set ddclient to start automatically. The problem is still that you are in a different network so you need to set up also port forwarding -- only forward port 22.

Once you have done all of this, you should be able to log on to your RPi using pi@dtgreene.dnsdynamic.org/noip.com:22. And to make everything easier, just make all your typical commands you want to run into small scripts on the RPi so once you ssh in you don't need to start typing long commands on your phone screen.

Can't remember all the configurations for the ddclient off the top of my head, but I am sure with these tips you got enough keywords to search.
Post edited January 14, 2021 by frogthroat
avatar
frogthroat: If you have an Android phone, I would recommend JuiceSSH (free for standard, a few euros for pro -- it doesn't cost much and is really useful so I recommend paying the few euros). Once you get ssh connection, you can do everything you want. Just install WOL on the RPi and the RPi connection is all you need to get things going.
I'd rather stay with open source, and ConnectBot works just fine for my purposes.

Also, what I'd ideally want is for the connection to be automatically forwarded to the desktop computer that would presumably be more powerful than the laptop I'd be using (though note that this is not the reality at the moment), or that has that one file I need to do work.
avatar
Carradice: What do you use the Raspberry for? Emulators? As a Chromecast equivalent? I have been wondering about these devices. I guess it would be even possible to play remotely with Steam link or Geforce?
avatar
Mori_Yuki: Ever wanted a remote controlled espresso machine? Build a PIP-boy? Hardware Firewall, Arcade Machine, Surveillance System, Bot Control, Server, Bitcoin Miner, Projector ... or ... or ... or! There is virtually only two limits to what you can do with it: Your fantasy and its hardware power. Look around for PI DIY projects, amazing what folks out there come up with! ;-)
Thanks for the suggestions :)


avatar
Carradice: What do you use the Raspberry for? Emulators? As a Chromecast equivalent? I have been wondering about these devices. I guess it would be even possible to play remotely with Steam link or Geforce?
avatar
dtgreene: I actually use it for Zoom and Jitsi.

(Note that I'll probably be using it less once in-person events resume, but that may still take a while.)
Thank you. It is interesting to see real life common uses for these devices. Also, Jitsi is news for me.
Post edited January 14, 2021 by Carradice
avatar
Timboli: Yes, but the more you have it disconnected, the sooner the CMOS (BIOS) battery will die.
avatar
BlueMooner: Could you elaborate?
Many people have no idea that such a battery even exists, especially for a mains powered desktop PC.

https://en.wikipedia.org/wiki/Nonvolatile_BIOS_memory#CMOS_battery
avatar
BlueMooner: Could you elaborate?
avatar
Timboli: Many people have no idea that such a battery even exists, especially for a mains powered desktop PC.

https://en.wikipedia.org/wiki/Nonvolatile_BIOS_memory#CMOS_battery
Worth noting, the Raspberry Pi (all versions) does *not* have such a battery.
avatar
dtgreene: Worth noting, the Raspberry Pi (all versions) does *not* have such a battery.
Other classes of low powered PC-like devices (such as some compute sticks and dev boards) also do not have a battery or a quartz oscillator, and instead rely on the OS to bootstrap the system time via NTP.
Post edited January 14, 2021 by WinterSnowfall
avatar
WinterSnowfall: Other classes of low powered PC-like devices (such as some compute sticks and dev boards) also do not have a battery or a quartz oscillator, and instead rely on the OS to bootstrap the system time via NTP.
The ZX80, the precursor to the Speccy...used not quartz, but an even cheaper ceramic oscillator.
avatar
BlueMooner: Could you elaborate?
avatar
Timboli: Many people have no idea that such a battery even exists, especially for a mains powered desktop PC.

https://en.wikipedia.org/wiki/Nonvolatile_BIOS_memory#CMOS_battery
Remember when dad's computer started forgetting the time. He asked me about it after a while and I told him it'll soon forget BIOS settings too, if it hasn't already, since it means the battery's going. So, with nothing done, a bit later he called me over to ask why wasn't it booting... And then he took it to someone to fix, and I have no idea what that guy did but definitely not replace the battery with a new one, since it only worked for a little while, then did it again. So I got 2 batteries when the kitchen scale needed a new one as well and replaced it, and that obviously fixed it.
Only time I had to actually deal with that so far. And that's a computer from 2009 that was unused for a year or so, then went back in use, and this happened a couple of years ago I think. On the other hand, mine from 2008 was fine in 2016 when I got it back in use for a month, after sitting in the corner of the room for a year and a half.
avatar
Cavalary: Remember when dad's computer started forgetting the time. He asked me about it after a while and I told him it'll soon forget BIOS settings too, if it hasn't already, since it means the battery's going ........
I've replaced the CMOS button battery about twice on old PCs that had been disconnected from power for long periods of time. I seem to recall hearing the battery should under normal circumstance last for about 10 years.

Every now and then my old Win XP laptop refuses to boot for what seems to be the CMOS battery state, but because it is virtually always connected to mains power, as I still use it for certain tasks, it is good again for a long while, so not replaced the battery yet.
avatar
dtgreene: Worth noting, the Raspberry Pi (all versions) does *not* have such a battery.
I wonder what method they use then ... perhaps some non easily replaceable option (i.e chip), which might mean the Raspberry Pi has a limited life.
Post edited January 15, 2021 by Timboli
avatar
dtgreene: Worth noting, the Raspberry Pi (all versions) does *not* have such a battery.
avatar
Timboli: I wonder what method they use then ... perhaps some non easily replaceable option (i.e chip), which might mean the Raspberry Pi has a limited life.
More or less, everything is stored on the SD card. The bootloader is stored in EEPROM, which on the Pi 4 can be updated, but it does not need any power to preserve its contents. The settings, however, are on the FAT partition of the SD card (or are provided by the alternate boot method, since some models support other methods, like network, USB host, and USB device booting).

As for the time, the Pi just gets it from the network. (This does mean that a airgapped Raspberry Pi will not know the time unless someone adds a real time clock to it, and I believe some people have done just that.)
avatar
dtgreene: More or less, everything is stored on the SD card.
Knowing what the life cycle of an SD card can be, that seems more unreliable and volatile than a CMOS battery, but size is of course a factor with RPi.
avatar
dtgreene: Also, what I'd ideally want is for the connection to be automatically forwarded to the desktop computer that would presumably be more powerful than the laptop I'd be using (though note that this is not the reality at the moment),
You mean the GUI? Then you want to connect directly to the desktop. You can ssh to your RPi and then ssh from there to your desktop, no problem. But if you VNC to RPi and then VNC from there to desktop, you going to have slooooooooow screen refresh. I mean, you can try, but I don't think that is a good idea.

avatar
dtgreene: or that has that one file I need to do work.
# scp -P 22 pi@dtgreene.noip.com:/some/file.txt ./
avatar
dtgreene: More or less, everything is stored on the SD card.
avatar
Timboli: Knowing what the life cycle of an SD card can be, that seems more unreliable and volatile than a CMOS battery, but size is of course a factor with RPi.
For the sort of things that would be stored in CMOS, with the exception of the RTC state (which doesn't exist on the pi), the SD card should work fine because it doesn't get written frequently.

Some people have moved the OS to a USB drive in order to avoid the problems with SD cards; there's a reason people have been wanting USB host boot (which is available on the 3B+ and 4 by default, and on the 3B if you change an efuse bit).

There's also network booting, which removes the need for a storage medium on the Pi at all, and for some models (most notably the Zero/Zero W) USB device boot which can be useful for kernel and lower level userspace development.
avatar
dtgreene: Also, what I'd ideally want is for the connection to be automatically forwarded to the desktop computer that would presumably be more powerful than the laptop I'd be using (though note that this is not the reality at the moment),
avatar
frogthroat: You mean the GUI? Then you want to connect directly to the desktop. You can ssh to your RPi and then ssh from there to your desktop, no problem. But if you VNC to RPi and then VNC from there to desktop, you going to have slooooooooow screen refresh. I mean, you can try, but I don't think that is a good idea.
But said desktop is currently asleep, I need to access it, and going back home to wake it up is not a realistic option.

avatar
dtgreene: or that has that one file I need to do work.
avatar
frogthroat: # scp -P 22 pi@dtgreene.noip.com:/some/file.txt ./
The file is not on the pi; it's on the sleeping desktop.
Post edited January 15, 2021 by dtgreene
avatar
dtgreene: But said desktop is currently asleep, I need to access it, and going back home to wake it up is not a realistic option.
# sudo apt install etherwake
# touch wakedesktop.sh
# sudo chmod +x wakedesktop.sh
# vim wakedesktop.sh (or use whatever editor you like. Nano, Pico, Emacs, whatever)

Then write this:
#!/bin/bash
sudo etherwake -i eth0 11:22:33:44:55:66

Where 11:22:33:44:55:66 is your desktop computer's mac address.

If your desktop is a Windows computer, press the windows key, type cmd and open it, then type ipconfig. It's similar to ifconfig in Linux. The mac address is called Physical Address.

Now from your phone you can wake it up:
# ssh pi@asdfasdf:22
# ./wakedesktop.sh

If you don't want to stay logged in, but just want to wake the computer up, you could make script on your phone that runs:
ssh pi@asdfasdf:22 './wakedesktop.sh && exit'
This requires that you give a user sudo rights without password.
I would create a new user for this, but you can use pi as well.
Open sudoers file:
# visudo
Add this:
pi ALL=(ALL) NOPASSWD: /usr/sbin/etherwake
Hint: if you are not used to vim, press i to insert text. After you have written everything you want, press ESC and then type :wq

After this the user pi can use sudo etherwake without being prompted for the password.

But you have to make sure your desktop computer supports WOL and that it is enabled. And if the desktop is a Windows computer, make sure you have ssh up and running there.

avatar
dtgreene: The file is not on the pi; it's on the sleeping desktop.
Hm. If you know what IP your phone will get, you could try:
# ssh pi@asdfasf:22
# scp user@desktop:/some/file.txt root@phone_IP

Probably needs to specify to use port 22 to get back to your phone.

Otherwise you can do it in two steps.
# ssh pi@asdfasdf:22
# scp user@desktop:/some/file.txt ./
# exit
# scp -P 22 pi@asdfasdf:/some/file.txt ./
avatar
frogthroat: # sudo apt install etherwake
Why "etherwake" rather than "wakeonlan"?

Will wake-on-lan wake up a computer that's just sleeping (as opposed to one that is fully powered down)?

(Also, usually "#" is used to indicate that a command should be run as root, and you don't normally use "sudo" if you're root already.)