Raspberry Pi hangs on shutdown/startup with USB Server

I will go through the steps somewhat to show you what I have done to install vhusbdpi (USB Server) on Raspberry Pi. I am using NOOBS 1.3.8

After following the instructions in The FAQ, the Pi asks to install the AVAHI-DAEMON. I tried but then it said to perform a "sudo apt-get update" so the Pi could properly install the daemon. After the update and the daemon was properly installed, I checked to see if the Pi would reboot successfully with any driver failures or warnings. Upon shutdown, the Pi hung after "Shutting down ALSA...done" Wouldn't go anywhere after that so I power cycled the Pi.

Besides getting the dreaded "Volume was not properly unmounted", upon startup, the Pi, once again, hung after "Starting OpenBSD Secure Shell server: sshd." Again going nowhere. On the hang in startup, I could, at least, use to get the Pi to restart. On the shutdown hang I could not do anything to get the Pi to restart, other than to power cycle it.

Am I doing something wrong. NOOBS 1.3.8 installed successfully without any warnings or failures and had no problem till I put vhusbdpi in the init.d. I did get a script warning which said "No LSB tags or overrides". Only saw that after entering the "sudo update-rc.d vhusbdpi defaults" entry.

Ken

#2

I think you probably should make sure virtualhere server is running correctly manually by just running it on the command line without any startup scripts.

Once you have confirmed that its working then, you could then try to enable it to start on boot.

The virtualhere server doesnt do anything special with the pi, it just opens a few files so its unlikely to block shutdown...

Anyway try just running virtualhere from the command line first and see if its ok

#3

Well it's clear as mud there is an issue in the VH script given the warnings of the missing LSB tags and overrides and that startup and shutdown hang when they get to the script. At least this is my assumption and we all know what assuming means. ;-) Fairly sure though that VH will run manually but I will check it out. However the whole package of a remote Pi with VH won't do me much good if I can't automate startup and shutdown. Thanks Michael.

#4

OK. Works when run manually. I was fooled by just the blinking underline cursor. There is no response from the Pi screen that the server is running. It just is and sort of looks like the Pi is hung but it is not. The only problem is, what is the key sequence or command to stop the server from running and return to the command line so I can shutdown cleanly? The only thing I found that works is the ubiquitous sequence but that immediately shuts the Pi down and reboots. I just want to get back to the command line.

#5

Yeah it runs as a standard linux server. That means you send it a SIGINT signal to quit it. To send a SIGINT you just press CTRL-C at the hanging terminal.

You should really be running it as a daemon with the -b parameter in your init script. This will then run it as a standard linux daemon in the background. e.g sudo /home/vhusbdpin -b

If you want to stop a daemon, you cant send it a ctrl-c because its running in the background, so you send it a SIGTERM via the kill command.

e.g.
ps -ef | grep vhusbd That will tell you the process id
kill pid

#6

Yeah thanks! Running it as a daemon is much easier and cleaner. Before when I ran it manually and I was logged into the Pi remotely via SSH and I exited the session, it would also close or stop the USB Server. So I had to leave the SSH session open while I used the server. Now I can at least log out of the Pi on SSH and keep the server running.
My next question is, what needs to be modified in your "OEM FAQ" to run it as a daemon in init.d? Clearly this seems to be the way to go.

#8

I followed your "OEM FAQ" instructions to the letter or at least think I did. Which is why I initially posted here for support. The init.d/rc.d would hang when it got to your script like it wasn't running it as a daemon.

You need to put a startup script into init.d and set the correct runlevel for booting. To do this, please follow the steps below for the raspberry pi:

ssh to your raspberry pi
wget http://www.virtualhere.com/sites/default/files/usbserver/vhusbdpin
sudo chmod +x ./vhusbdpin
sudo mv vhusbdpin /usr/sbin
wget http://www.virtualhere.com/sites/default/files/usbserver/scripts/vhusbd…
sudo chmod +x ./vhusbdpin
sudo mv vhusbdpin /etc/init.d
sudo update-rc.d vhusbdpin defaults
sudo reboot

I will try this again instead of starting it manually as a daemon which works fine. Get back to you.

Ken