×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Guide: StellarMate OS on Raspberry Pi4 step by step with tips and tricks

  • Posts: 44
  • Thank you received: 31
OPTIONAL: Getting the external SSD harddrive up and running

1. Insert the harddrive stick into the plugable USB 3.0 harddrive connector
2. Connect the USB3 cable to the powered USB hub
3. Run this command and find the SSD harddrive in the list
sudo fdisk -l
4. My disk is located at /dev/sda. I found it in the list using the size and the model name.
5. Use this command to edit the disk’s partition table (Remember to adjust the path if your SSD drive is located somewhere else):
sudo fdisk /dev/sda
6. Enter the following options when prompted: n, p, 1, <enter>, <enter>, w
7. Use this command to format the partition:
sudo mkfs -t ext4 /dev/sda1
8. Use this command to create a directory to use as the filesystem mount:
sudo mkdir /ssd
9. Use this command to mount the partition:
sudo mount /dev/sda1 /ssd


OPTIONAL: Configure the Pi4 to mount the SSD on boot (Warning: If this is done wrong you loose all data on the sd card)

1. Use this command to get the Partition UUID:
sudo blkid /dev/sda1
2. Use this command to edit the fstab file:
sudo nano /etc/fstab
3. Add your SSD drive to the file. For me the added line looks like this (Remember to change 1st and 2nd parameter to match your ssd details):
PARTUUID=19efd0bd-01 /ssd ext4 defaults,nofail 0 0
4. reload the fstab file without rebooting with this command:
sudo mount -a
5. Observe that the SSD is mounted with this command:
df -h


OPTIONAL: Make the Pi4 run almost everything from the SSD Harddrive

The theoretical maximum for the SD card reader on Pi4 is 50MBps and with USB3.0 the theoretical maximum is 640MBps.
Often it is "only" possible to achieve around 200MBps with a SSD drive on Pi4, but that is still much better than the SD card.
Everything will load 4-5 times faster with an SSD and platesolve will also be lightning fast when done with Astrometry.net setting set to Offline via Kstars on the Pi4 or when done with Astrometry.net setting set to Remote via KStars on another device.
When the Astrometry.net setting is set to Online it will still be very slow, so don't use that.

1. Ensure that the SSD drive is mounted (it is if you followed the previous steps)
2. Copy files from your root folder to the SSD with this command:
sudo rsync -avx / /ssd
3. Open the /boot/cmdline.txt file for editing
sudo nano /boot/cmdline.txt
4. Paste the following text at the end of the first (and likely only) line of cmdline.txt (Remember to change the PARTUUID to the one matching your SSD partition. See information above on how to get it)
root=PARTUUID=19efd0bd-01 rootfstype=ext4 rootwait
5. Hit CTRL + X to exit and Y (when prompted to save) then Enter to confirm your change.
6. Now the Pi4 will see /dev/sda1 (provided that that is your external drive partition) as your primary storage drive. From here on both the microSD card and the external SSD must be connected in order to boot.
7. Reboot the Pi4. It won't boot unless the external drive is connected as long as this text is in the cmdline.txt file.
You must remove the line from the file if you want to boot without the SSD connected.
8. Use this command to verify that /dev/root now matches the size of your SSD instead of the size of your microSD card
df -h
The following user(s) said Thank You: Thomas Seckler, Rishi Garrod, Bernd Limburg, Mr. Mister
Last edit: 3 years 10 months ago by Stefan R..
3 years 10 months ago #54293

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 31
That is all for now. This is how my StellarMate OS is currently configured on Raspberry Pi4.
Everything seems to work just fine.

Here are a few useful commands:

See the curent temperature:
vcgencmd measure_temp

See connected USB devices:
lsusb

See mounted filesystems:
df -h


And a WiFi test I did

WiFi Signal Strength Test (Only tested 2.4 GHz):

I used these commands to get the WiFi Link Quality
iwconfig wlan0 | grep -i --color quality
iwconfig wlan1 | grep -i --color quality


First Location:
This is the worst possible location outside the house on the other side of 2 solid brick walls and around 25 meters away from the nearest accesspoint inside the house.

Built-in Raspberry Pi4 WiFi:
Link Quality=50/70 Signal level=-60 dBm

External Ralink RT5370 USB WiFi (with stock antenna):
Link Quality=55/70 Signal level=-55 dBm

External Ralink RT5370 USB WiFi (With replaced antenna):
Link Quality=57/70 Signal level=-53 dBm


Second location:
This my usual observation spot outside the house on the other side of a single solid brick wall and around 10 meters away from the nearest accesspoint inside the house.

Built-in Raspberry Pi4 WiFi:
Link Quality=55/70 Signal level=-55 dBm

External Ralink RT5370 USB WiFi (with stock antenna):
Link Quality=69/70 Signal level=-41 dBm

External Ralink RT5370 USB WiFi (With replaced antenna):
Link Quality=70/70 Signal level=-39 dBm


Conclusion:
See an explanation of the dBm values in the table on this link:
eyesaas.com/wi-fi-signal-strength/

There is an obvious improvement of using the External Ralink RT5370 USB WiFi over the Built-in Raspberry Pi4 WiFi.
The improvement is biggest in a location that don't have too bad WiFi coverage.

There is only a small improvement in signal strength of using the replacement 5dBi antenna over the stock 2 dBi antenna.
So I could keep using the small antenna and I would not reccomend buying a replacement antenna.
However, now that I have it, I will continue using it.
The following user(s) said Thank You: Joaquin
3 years 10 months ago #54294

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 31
Thanks for reading this far down.
I hope that my posts are useful to someone in the future.
Let me know if you had any use of it.

And also let me know if you have any suggestions for ways to do the same things a lot easier.
And feel free to post your own OPTIONAL steps in this thread that I and others can use to improve our Raspberry Pi4 setup even further.
The following user(s) said Thank You: Jasem Mutlaq, Rishi Garrod, Greg Stark, Joaquin, Gustav Olav Lundby, mahesh
3 years 10 months ago #54295

Please Log in or Create an account to join the conversation.

Great job! Will sticky this! I'd like to point out that if you use the StellarMate App (at least one time), it would sync your time and location to that of the phone/tablet GPS. So no need to set that manually. Similarly, you can join WiFi network from the App itself.
3 years 10 months ago #54308

Please Log in or Create an account to join the conversation.

  • Posts: 45
  • Thank you received: 1
First, I want to thank you for this great write up. Very easy to follow along without knowing what I'm doing (for parts of it). Question at step 2 of making almost everything off the SSD:

sudo rsync -avx / /ssd

After a long list of copied files, I get the following error:
rsync: write failed on "/ssd/lib/modules/4.19.115+/kernel/drivers/iio/pressure/bmp280-i2c.ko": Read-only file system (30)
rsync error: error in file IO (code 11) at receiver .c(374) [receiver=3.1.3]

Is his expected? Did I do something wrong? How should I fix?

EDIT: I must have done *something* wrong... I continued with the instructions and the thing will no longer boot... with or without the SSD.
Last edit: 3 years 10 months ago by vince.
3 years 10 months ago #54783

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 31

The command only copies everything from your root folder / to the /ssd folder.
If you mounted your SSD on the /ssd path then that should work.

However, I did not get the error message that you mention here so maybe it can also be different from SSD to SSD
3 years 10 months ago #54785

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 3
Hello

Raspberry Pi 4 now supports both data and power over USB port. I was wondering if we could simply connect a powered USB hub to USB C port and then connect devices through that. On R-Pi 4 forums it seems this is enabled in the firmware. How to do that with stellarmet? Any ideas?
3 years 9 months ago #54853

Please Log in or Create an account to join the conversation.

  • Posts: 45
  • Thank you received: 1

Thought I'd close the loop with this. I've resolved my issue. Again, I want to thank you for the guide it was very helpful for me.
For reference, it turns out the issue was insufficient power. I hadn't receive my powered USB hub yet so the SSD was plugged directly into the pi (powered by a cheapo wall wart). I got the exact same problem the second try. dmesg command revealed insufficient voltage. Tried again with the new hub and it copied all the files over.

When it was time to bootup, it still did not work because I use a Sabrent SATA USB adapter. After some reading, I used the quirks fix and now everything works great. I have a new adapter ordered.
Thanks again.
Vince
The following user(s) said Thank You: Stefan R.
3 years 9 months ago #54930

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 1
Thanks for a really good guide!
Wavemon is a nice tool to test WiFi Signal Strength:

$ sudo apt-get update
$ sudo apt-get install wavemon
$ wavemon
3 years 9 months ago #55283

Please Log in or Create an account to join the conversation.

  • Posts: 145
  • Thank you received: 15
Great guide, very helpful for Astroberry as well! Used it to install a SSD mounted at boot time, works perfectly. Lots of space now and fast, especially important for FireCapture when it writes the video files. On the SD card, this was nearly impossible.

I have two questions: How can I back up the SD/SSD combo to an external image file? It‘s a bit different from the situation with just a SD card. And how would I restore this backup, just in case?

Thanks and CS, Bernd
3 years 9 months ago #55510

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 3
Thanks for an excellent guide !

One comment regarding external USB 3.0 Realtek WiFi. When I was configuring mine I had problems with building the source code. After some digging on this forum I managed to get it to work by running this set of commands:

sudo apt -y install raspberrypi-kernel-headers
sudo ln -s /usr/src/linux-headers-$(uname -r)/arch/arm/ /usr/src/linux-headers-$(uname -r)/arch/armv7l # this was the missing link that made it possible to build Realtek driver on StellarMate
sudo apt -y install git
sudo apt -y install gcc
cd /usr/src
sudo git clone https://github.com/EntropicEffect/rtl8822bu
cd rtl8822bu
sudo nano Makefile -l
# Update lines 100 and 101 to this and save the file:
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RPI = y
sudo make
sudo make install

I hope this will help others who experience the same problem

PS My WiFi dongle is connected through USB 3.0 passive hub
The following user(s) said Thank You: Joaquin
Last edit: 3 years 2 weeks ago by Perunwit.
3 years 6 months ago #59381

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 30
Could you give more details on the model of your wifi device ? I am searching for one with compatibility with stellarmate/raspbian
3 years 6 months ago #59389

Please Log in or Create an account to join the conversation.

Time to create page: 1.615 seconds