Headless Raspbian server diagnostics (on RaspberryPi) - ssh

I own a RaspberryPi that I can connect only through ssh. A few days ago it was unsafely powered off. Now when I turn it on I cannot access it. It looks like it turns on but can't get an ip or so.
It is ptovided by fixed IP from router, and when I try to ping this IP, it tells me that the destination host is unreachable.
Is there a way to find out what has happened or the only way is to complete reinstall the OS?

One possibility is that the systems rootfs has been corrupted, this happened to me once with unsafe powerdown on a raspi.
If you have another sd-card, the easiest would be to install a fresh image on it and check if it boots correctly. If not, make an image of your current sd-card, format and reinstall.
Hopefully you've got backups, as there's no guarantee to recover your files if the data has been corrupted.

Related

Connecting the Raspberry Pi 3 with a 3G dongle (Qualcomm Modem)

I recently bought a 3G dongle for a project I'm working on. I want my Raspberry Pi to be able to receive SMS messages and respond to them. I got a HSDPA 3g dongle with a 7.2mbps connection. I've set up the dongle on Windows with an A1 (not sure if you guys know this provider) sim and it works fine. I can connect to the internet just fine and also receive text messages (SMS)
However when I try connecting it to my Raspberry Pi (with Raspbian OS) then it doesn't work. It's always show as a "Mass Storage Device".
I tried my luck with usb_modeswitch and wvdial and with Sakis3g as well, but I can't get it to work. My problem with usb_modeswitch and wvdial was that even after I tried everything explained on these 2 blog posts (https://www.thefanclub.co.za/how-to/how-setup-usb-3g-modem-raspberry-pi-using-usbmodeswitch-and-wvdial ; https://nicovddussen.wordpress.com/2014/11/12/setting-up-your-raspberry-pi-to-work-with-a-3g-dongle/) it still didn't switch to the modem mode. It always stays at the "Mass Storage Mode". I saw an alternative and tried using Sakis3G, but with no luck as well. Seems like their website (sakis3g.org / sakis3g.com) is offline and you can't download certain .tar.gz folders/files anymore. I tried my luck with this blog post. (https://shkspr.mobi/blog/2012/07/3g-internet-on-raspberry-pi-success/)
And you guessed it, I couldn't get it to work either. It doesn't let me download the .gz folder/file because the website appears to be down.
It's a very big problem for my project and I would appreciate any help. It's really important. If anyone knows what I can do to fix this, please offer help. I'd really appreciate it.
Greetings.
Trying using tips supplied in this article
Unplug your modem
Open a terminal prompt
Install the usb-modeswitch package by typing in:
sudo apt-get install usb-modeswitch
EDIT... ADD REBOOT STEP
Reboot Pi
Plug the modem in,
Give it a couple of seconds and then try commands to confirm it worked
lsusb
ifconfig -a
You should see a new interface (Note the name of it - might be something like wwan0 )
To get this to acquire an IP address, edit the file /etc/network/interfaces and add the lines:
allow-hotplug wwan0
iface wwan0 inet dhcp
EDIT - REBOOT AGAIN
........
EDIT - UPDATE
Also note that the full version of sakis3G has this usb-modeswitch embedded in it.
You can still download code and look at instructions at old site that's been archived at:
http://web.archive.org/web/20130511202305/http://www.sakis3g.org/#download

Can't resolve archive.raspberrypi.org. can't install anything

I have raspberry pi 3. And I can't even update it because when I do the update screen is held at archive.raspberrypi.org. I tried to open it in browser, the site is down. What should I do?
And yeah it is perfectly online.
temporarily disabling ipv6 solved my issue (temporarily)
apt -o Acquire::ForceIPv4=true update
From my point, the site is online. Are you sure your Raspberry is connected to the internet?
Also http://www.downforeveryoneorjustme.com/archive.raspberrypi.org says it is online.
Edit:
Check your /etc/hosts file for entries which change the location of the Domain in question.
Check the storage of your sd card. If you have a lot of information on it, it might slow down or stop working. If you have a lot of information, you have 2 options:
Remove unwanted information
Install a fresh OS image on it

VirtualBox RawDisk error : VERR ACCESS DENIED

I'd like to boot VirtualBox to the external hard drive I have that runs Windows 8 To Go, as the computer running virtual box is one that I can't boot to the drive during certain hours, but I'd still like to be able to interact with the OS on that drive.
I found a guide for creating a raw VM DK disk file for my external drive, and ran the commands for it in an administrator command prompt, which was listed as a requirement in the article I was reading.
At first, I'd boot to the drive with my VirtualBox machine, and it would ask me to enter the BitLocker encryption password.
I'd enter it, and before the spinning circles of the Windows loading logo would make a complete rotation, VBox would give me an error popup saying "Error: VERR_ACCESS DENIED".
I researched the issue a bit online and found that some users had resolved this issue by turning on 'Use host I/O cache' on the VirtualBox Storage controller.
I tried this, and the machine did indeed make it farther and stopped displaying an error message, only now it stays on the windows loading screen indefinitely, or may even restart itself.
I checked the log file and am seeing several non-displayed error messages of 'VERR_ACCESS DENIED".
Running virtual box itself as an administrator has had no effect.
Has anyone else tried this successfully? Does anyone have any tips?
I'd appreciate productive suggestions instead of criticism against 'why' I'm doing something.
Thank you!

vlock on raspbian wheezy doesn't work properly

I've set up raspbian "wheezy" (more information here, and image file here) on my recently arrived raspberry-pi (model B, but with 256MB RAM). Since I plan to use it via SSH from other locations, I was looking for a way to lock the console on the actual machine.
Raspbian is the first unix based OS I am working with, so I'm not really familiar with it, but I think I am looking for something like "vlock".
I installed vlock like this:
apt-get install vlock
When I now log into my pi via SSH from my Windows PC vlock works just fine, but when I try using it on the machine itself it shows a strange behaviour.
If I enter a wrong password, I get the usual message:
vlock: Authentication failure
but immediately after that the commandline shows up as if I entered the right one. So basically everyone can just roll his or her head over my keyboard to unlock my pi.
Does anyone know if this is a known bug (or even intended)? Or are there any equivalents to vlock that I could try?
Thanks in advance.
PS: This is my first question on stackoverflow so I hope I provided enough information. If I didn't, feel free to comment/ask.

ssh hangs with high latency connection (connecting internationally)

This is been making my programming really frustrating lately.
I´m in Argentina right now connecting to a U.S. server via SSH. Understandably, the pings are a bit higher here (around 200ms on average) so when I SSH into the server there is a slightly noticeable lag between each keystroke. This is fine and easy enough to work with.
What isn´t easy to work with is that about every 5 minutes or so, SSH will completely hang and take about 3-5 minutes to return back a prompt. I know the server is not bogged down because I can easily open several new connections while I´m waiting for one to return (in fact this is the only way I´ve been able to work). And when SSH finally comes back I can see it has actually been working away in the background (large file downloads was a good way to test this) but it just hasn´t been updating my screen.
Does anyone have an idea what might be causing this?
Few other facts: the server is Ubuntu and I'm connecting with Mac OS X. I have keepalive turned on in the SSH settings. It is most likely to hang when I hold down a key (for example a left or right arrow to scroll) which sends a lot of keys quickly. In fact I can reliably reproduce the hang by logging in and holding down any key like "a" - it never makes it past a full line of "a"'s before hanging. This just started when I connected internationally for the first time so I´m assuming it has something to do with that (latency?) but can´t say for sure.
Odd. I can't help you with your problem but I have a tip to make it less annoying: Use screen(1). This will keep your shell on the other end alive and you can continue whatever you were doing after reconnecting.
If you only need to run a command on the other side, I suggest to pass the command as an option to ssh (it will connect, run the command, display the result and disconnect).
I think it was some problem with the ISP down here in argentina. When I switched to another wireless network with another ISP it started working. They are probably playing some port throttling games or who knows what.
Try adjusting your TCP window size.
I'm used to ssh over high latency links - 600ms. It is slow but I rarely had any problems. To start with - open another terminal window, ping your server and watch the connection. Tell us what you see.
Try sshing in with a few verbose flags (ssh -vv[vv] somehost) and seeing if there's anything indicative printed around the time it hangs.
Well, I am now connected to a different wireless network and the problem seems to have disappeared. I can't say for sure what exactly was causing it (and I don't have login access to the wireless router) but this seems to suggest it was something on the router, and not the server or client computer.
Both the old router and the new router were Linksys WRT54G's so I'm not sure what the problem was. Hope it helps someone!
I was having a similar problem with 'cat' and even 'ls -l' causing ssh to hang (on Ubuntu). Adjusting MTU size to 1400 fixed it for me.