Sat, 11 Sep 2021
There are a few more things you may want to do once youâve got the Pi installed.
To turn off the Pi, you want to do a clean shutdown. You could just unplug it, but that risks corrupting the SD card. Open the SSH client (Termius), add a New Host (usbgadget.local), and log in as pi
with the password silverseams
. Type ./cleanstop
(tip: you can type ./c
and then tab will finish typing it for you). and press enter.
Itâll give you a quick warning and boot you out of the session. After a second or so, the little green light will stop blinking and you can unplug the Pi safely. Plugging it back in will turn it on, and it will restart everything and be ready to serve files again.
You can use ./cleanstop
whenever Pi instructions tell you to sudo shutdown now
or something similar â cleanstop ends with a shutdown
, but also shuts the USB emulation down in a smoother order first. You should probably be fine with the default command, but cleanstop plays it safe. sudo shutdown -r
is a restart, so if you use cleanstop instead youâll need to power your Pi off and back on to get it to do the restart part.
This is super-easy: just open Termius, log in as pi
, and type passwd
. Itâll prompt you for your old password and a new password (twice). Record the new one in your password manager (1Password, Lastpass, etc.)
Level up: Maybe you have an ssh key youâd like to use?
nano .ssh/authorized_keys
and put your public key in. Ctrl-X, Y, enter. Next time you log in, itâll ask for your ssh passphrase instead of your password.
If you want your Pi to be named something other than usbgadget
(for instance, if you have more than one on the same network), there are three places youâll need to change it. You can edit it by mounting the SD card on your PC like you did to give it your wifi password, in which case these files are all in the rootfs partition, or you can log in with Termius and edit it with the Pi running, using sudo nano
.
Each of these will have usbgadget
in one place. Make sure youâre picking a valid hostname. If youâre editing it on the Pi, do a ./cleanstop
to shut it down, then restart it so the new name takes effect. (It may express some confusion about its identity while shutting down, but it should recover.)
If you have the space on your PC, you can take an image of your Pi. Then if something happens to corrupt it, you can just restore the image.
Restoring the image will completely overwrite everything on the card, so it will fix anything that happens to break in the meantime (though it will also wipe out any embroidery files you had on the virtual usb stick â never put your only copy on a usb of any kind!)
TBA!
Maybe you donât want your Samba share to be visible to your whole network. Lock it down!
Sometimes despite the watchdogâs best efforts, two things try to write to the usb stick at the same time and things get confused. If you backed up your Pi you can just restore the image to fix it. It takes awhile, but itâs simple.
If you havenât backed it up, or youâre a little more impatient/adventurous, you can just rebuild the virtual USB stick. Open up Termius, log in, and type:
./newusb
It will take awhile⌠donât panic, and donât interrupt it. When it finishes, it will kick you out of the SSH client, restart itself, and it should be all ready to go again. If this happens frequently, you should probably stop writing to the directory on your PC while the embroidery machine is using it!
Despite its absurdly small size, the Pi is an entire little server, and playing USB stick is really not making it work too hard. Youâve got plenty of room to do other things with it.
Join my Patreon for monthly rewards!
Was my site helpful? Buy me a Ko-Fi!