Raspberry Pi Catch-All

Heretk wrote:

Still a total Linux noob here.

I added an external WD 4TB SSD and Google-fu'ed my way into using a Samba share to set it up. Everything worked great, I could access the drive from all of my PCs, even my phone. Up until I had to reboot the Pi 4 and now the drive is not accessible. Is there a proper way to mount a drive in Raspian where it will auto-mount after a reboot?

There's two components to sharing a drive; you have to mount it (what you're asking about), which makes it available to the Pi itself. Then you have to share it, which makes the shared directory visible on the network.

The first thing to do is to verify that you can see the files in the correct place from the Pi. Log into that and look in the filesystem, and make sure the files are showing up where you expect them to be. If they're gone, then it's a mount problem, and we can try to fix that.

If you see the files on the Pi, but you don't see the share on the network, then Samba probably isn't starting or running correctly. That would be a separate troubleshooting process.

This might take a few back-and-forths, because there are numerous ways to mount filesystems on Linux, and we'll have to figure out what approach you took. Samba tends to be more straightforward, so that'll probably just take a tweak or two if that's actually the problem.

After the initial setup I could see the WD drive on the Pi and via my LAN from other PCs. After the Pi reboot I cannot see the drive on the network. It is visible on the Pi but when I try and open it it asks me to log in as root. I created a separate admin user when I first set up the Pi but it only gives me an option to log in as user root.

I have never used the root account and the passwords I had documented are not working. Defaults also not working. About ready to scorch the earth and rebuild everything from the bottom up.

but when I try and open it it asks me to log in as root

Okay, that sounds like a permissions problem. What filesystem are you using on the WD drive? (there are many options, but the most frequent is ext4. If it's FAT or NTFS, that could be a problem... will go into that if they are.) Fixing that will require root access, and there are several ways to try to get it... hopefully you haven't locked yourself out.

The Raspbian default is to have no password on root. Try opening a command line and typing "su -". Just hit enter if it asks for a password. If the prompt changes to #, you're golden. (although we should set a root password.)

You should also be able to get root by opening a command prompt and typing "sudo su -", and typing in your user password, not the root password. Sudo lets you run something as root using your normal password. This is a special permission that's granted via the /etc/sudoers file. (in other words, it's separate system grafted onto the side of Unix, like so many things are.)

I believe the default pi account should be in /etc/sudoers, so "sudo su -" should give you a root prompt. If you're using a different account or you messed with that file in some way, it might refuse to work.

A third way to try to get root is to use control-alt-F1 to get a text mode prompt, where you can try to log in as root there. (username root, no password.) Getting back to the desktop from text mode usually works with alt-F7. Most distros will start login prompts on multiple virtual terminals, and will tie the graphic system to one of them. In text mode, alt-F1 through alt-F10 switches between them...you can search and find the desktop if it's not on F7. In graphic mode, you have to use both control AND alt with the function keys to switch. Control-alt-FX in graphic mode, just alt-FX in text. (I think control-alt might also work in text mode, but I don't remember for sure.)

If you can't get a root prompt, then it might be easiest to nuke and repave, but if any of these approaches work, you should be fine. As long as you can get root, most problems can be fixed, including this permissions thing.

I honestly do not remember what file format I used.

I need to pull the RP4 anyway as the case fan has a bad bearing and is making a heck of a lot of noise. Will pull the old SD card and rebuild on a new card just in case. The Pi has been great to play with and I have learned a lot. But it's clear I have more learning to do, otherwise I would not have painted myself into this corner

Thanks all for the help and insight!

Okay, but keep in mind that you probably don't need to do that from a software perspective. My post was long because I was giving you three different ways to get a root prompt.... chances are quite good that you can stop after the second paragraph.

The fan going bad is no shock, I lost my first one too. Lots of these cases use really crappy fans. I replaced it with a GeeekPi case that uses a nice 40x10mm, so it's a standard size and easy to replace if it fails. It's been great for about a year now.

Malor wrote:

Okay, but keep in mind that you probably don't need to do that from a software perspective. My post was long because I was giving you three different ways to get a root prompt.... chances are quite good that you can stop after the second paragraph.

The fan going bad is no shock, I lost my first one too. Lots of these cases use really crappy fans. I replaced it with a GeeekPi case that uses a nice 40x10mm, so it's a standard size and easy to replace if it fails. It's been great for about a year now.

Checking in to mark this one as mostly resolved. Changed the case fan first to build a sense of accomplishment before re-examining the NAS drive issue. I found the original FAQ online to re-trace my steps. I then remounted the external HD from command line. Also turns out that I skipped the very last step of said guide, which illustrated how to update /fstab to make the drive automount after reboot. Tested and it works.

My original quandry was that I was trying to sort this out through Raspian GUI. Whenever I tried to mount the drive I got the prompt to login as root, and none of my passwords were accepted. When I first set up this Pi I did create a separate superuser account which works in the command line but said superuser credentials do not work in the GUI. In the GUI I only have the option to login as user root.

Thanks all for your help on this.

When I first set up this Pi I did create a separate superuser account which works in the command line but said superuser credentials do not work in the GUI. In the GUI I only have the option to login as user root.

I haven't gone through a basic Pi install in a long time, but it sounds like you're saying it prompted you to make a third account? A default Raspbian comes with root and pi for users. Did you make another? And only root, AFAIK, can have full root privs, so I'm unclear on how a "superuser" account would work. I think that's a Windows-ism that doesn't directly translate to Unix.

From your description, I'm almost entirely mystified as to how things are actually configured.

The Pi GUI is probably asking you for root's password. That's not always set; it's common to lock out root and then to require sudo. If you manually set a root password (sudo to a root CLI, type 'passwd root', and set it to whatever you want), the GUI then should, when provided with that password, correctly elevate itself and mount a drive for you.

But it sounds like you fixed fstab, which means you may not need to do that for a great long while. We would have gotten there eventually... that was the reason I was asking if you could see the files on the Pi. If you couldn't, we would have rebuilt a new fstab line to set it to automount.

Very specific case that most likely won't happen to anyone else, but I figured I should post it just in case:

I reinstalled RetroPie on my Pi 4 recently, along with Kodi. For some reason, Kodi would crash on exit, and I could not get sound to work.

Turns out the solution is to use the mini HDMI that is closest to the power supply instead of the other one. That solved both problems at the same time.

Huh, isn't that interesting? Sounds like the video driver still isn't quite all there, yet.

Putting a foot in the door here so I don't lose this thread. My kids have started asking me if I can "set up a Minecraft World where we all can play together," and I found a used Pi 3b with case and all in our neighbourhood for $50 CDN, so I'm going to give it a shot. They're mostly into making buildings at the moment, so I'm not expecting an expansive, explored world; I figure that for $50 I can give it a shot.

But I have no experience working with a Pi and I don't know linux/unix, so many of the resources here will be helpful, plus a supportive community couldn't hurt.

Feegle wrote:

Putting a foot in the door here so I don't lose this thread. My kids have started asking me if I can "set up a Minecraft World where we all can play together," and I found a used Pi 3b with case and all in our neighbourhood for $50 CDN, so I'm going to give it a shot. They're mostly into making buildings at the moment, so I'm not expecting an expansive, explored world; I figure that for $50 I can give it a shot.

But I have no experience working with a Pi and I don't know linux/unix, so many of the resources here will be helpful, plus a supportive community couldn't hurt. :D

This might be a bigger Minecraft question than a Pi one.
Is it only people in the house (same network)? What are you playing with? PC, Xbox, Switch, PS?

Feegle wrote:

Putting a foot in the door here so I don't lose this thread. My kids have started asking me if I can "set up a Minecraft World where we all can play together," and I found a used Pi 3b with case and all in our neighbourhood for $50 CDN, so I'm going to give it a shot. They're mostly into making buildings at the moment, so I'm not expecting an expansive, explored world; I figure that for $50 I can give it a shot.

But I have no experience working with a Pi and I don't know linux/unix, so many of the resources here will be helpful, plus a supportive community couldn't hurt. :D

I've set this up on a Pi 3b+ and then again on a Pi 4 and it was great fun with the kids. This was set up on a local network and using the PC client.

Essentially, this involves first getting Raspbian installed and running on the Pi:

https://projects.raspberrypi.org/en/...

Then when you have a functional OS running on your Pi, check out these guides for how to install Minecraft on the Pi:

Here's where I started:

https://raspberrytips.com/minecraft-...
https://pimylifeup.com/raspberry-pi-...

There's plenty of information there to get you going although those guides are a little old so the version of Minecraft that's on there is pretty old too. The Spigot project that manages the build of the minecraft server is pretty up to date.

Happy to help you get going!

lunchbox12682 wrote:
Feegle wrote:

Putting a foot in the door here so I don't lose this thread. My kids have started asking me if I can "set up a Minecraft World where we all can play together," and I found a used Pi 3b with case and all in our neighbourhood for $50 CDN, so I'm going to give it a shot. They're mostly into making buildings at the moment, so I'm not expecting an expansive, explored world; I figure that for $50 I can give it a shot.

But I have no experience working with a Pi and I don't know linux/unix, so many of the resources here will be helpful, plus a supportive community couldn't hurt. :D

This might be a bigger Minecraft question than a Pi one.
Is it only people in the house (same network)? What are you playing with? PC, Xbox, Switch, PS?

Thanks. There were a few posts upthread about people getting MC up and running, so I know there are a couple of people here who have done it. But at the moment I'm mostly about setting up the Pi so that it's functional and on my local network.

It'll be local players only (at least for the forseeable future) playing the Java version off PC.

ZombieCoyote wrote:

There's plenty of information there to get you going although those guides are a little old so the version of Minecraft that's on there is pretty old too. The Spigot project that manages the build of the minecraft server is pretty up to date.

Happy to help you get going!

Amazing; thanks. I'm going to spend some time this weekend getting the Pi up and running, and then I'll start to look through some of the MC guides you linked. This is really for an Xmas present, so I've got some time.

No problem! Just let me know if you have any questions about those Minecraft-on-RaspberryPi sites and I can share details about my setup and configuration.

Also, once I got the software configured and running, I 3D printed this model to use as an enclosure for the PI:

https://www.thingiverse.com/thing:24...

I printed it in silver PLA and filled in the little windows with transparent PLA. I wired in some red LEDs to the PI and ran a little python script that would flash the LED in random patterns. When it was running, the PICraftServer box looked like a shimmering redstone block.

Halfway through the process of getting this this up and running, and it’s telling me I have a memory problem. It says The .jar I’m trying to run needs at least 512M of memory, but only detects 235M. Any suggestions?

Where are you in the setup process? Sounds like you're trying to maybe run the compiled spigot jar file? Or are you trying to run the BuildTools.jar file?

What do you see when you run the command:

free -h

?

Also, I found this link. Don't know if it'll help at all, but..maybe?

https://www.spigotmc.org/threads/bui...

So, it took me a little bit but I found my old notes back when I was running Spigot 1.14.4 on a Raspberry Pi 3b+.

The command I used to build the Minecraft server:

java -Xmx512M -jar BuildTools.jar

And once built (the version was 1.14.4), the command to execute the server:

java -Xms512M -Xmx1008M -jar /home/pi/minecraft/spigot-1.14.4.jar nogui

Now, it's been a while since I've rebuilt the server. The latest version I ever ran was 1.15.2. It appears that the latest is now 1.18.1. However, according to the Spigot forums, that requires Java 17 to run.

https://www.spigotmc.org/threads/9-y...

So I found a build of Java 17 for Raspberry Pi here:

https://adoptium.net/releases.html?v...

(select "Linux" and "arm32")

I'm currently building the server with that latest version of java on my Raspberry PI 4. I'll report back with any issues that I run into.

Okay, it built and ran fine. I'll be happy to provide any more details. Just let me know.

Thanks! I got through the memory issue in a similar way as you, and have just run into the Java Version problem. I guess the guides I've been working with cap out at Java version 11.

These guides have it download and set up Java straight from the internet, though. Do I need to do something to clean the old version off?

I'm pretty close to 'noob' when it comes to Linux and command-line interfaces.

I presume that I'm going to be flashing the JDK to the SD card directly, and then unpacking it through the pi? Once it's installed, do I need to... "turn it on?" so to speak, or is it enough to have it and call it on the command to run BuildTools?

It's a whole lot easier than all of that. You don't have to erase, clean, or remove anything. All I had to do was to download the JDK archive to my PI, extract the archive, and then use the included java binary to build and run everything.

Because Java 17 seems to need to be manually downloaded and run, I'll give you the commands that I typed to get it to work. I've only spent a bit of time this evening looking at this, so if anyone knows a better way to "install" Java 17 for Raspbian than this, I'd love to hear about it!

1) I open a terminal so that I can get a command line.

2) I type the command:

(EDIT : I apologize but it appears that the GWJ site likes to shorten URLs... you'll have to right-click and copy the URL to get the entire thing...)

This command will download the Java 17 for Raspberry PI from the adoptium.net site that I linked to above. The above is just the direct path to the URL.

3) I manually extract the archive with the command:

tar -zxvf OpenJDK17U-jdk_arm_linux_hotspot_17.0.1_12.tar.gz

This will display a lot of files being unpacked but at the end, you'll have Java 17 in a self-contained directory called "jdk-17.0.1+12" in your home directory.

4) Now, I created a directory where I could build the Minecraft server called "spigot" and installed the BuildTools.jar file with the commands:

mkdir ~/spigot
cd ~/spigot
wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job...

5) Instead of using "java" on the command line, I use the full path to the new java binary "/home/pi/jdk-17.0.1+12/bin/java". So, if I were to execute the BuildTools.jar file, I would run the command:

~/jdk-17.0.1+12/bin/java -Xmx512M -jar BuildTools.jar --rev latest

I have a Raspberry Pi 4 so I didn't need the "-Xmx512M" flag, but I put it in the command line for you there in case that worked for you. If not, put whatever other flags you used there instead.

6) Once EVERYTHING is done building, I created a new directory where I was going to install minecraft and copied the server jar file into it with the commands:

mkdir ~/minecraft
cp ~/spigot/spigot-1.18.1.jar ~/minecraft

7) I then run the server with the command:

cd ~/minecraft
~/jdk-17.0.1+12/bin/java -Xms512M -Xmx1008M -jar spigot-1.18.1.jar nogui

8) The FIRST time you run this, it will "die" and complain about the EULA. What you will find in that directory is a file called "eula.txt" where you need to modify the very last line from "eula=false" and change that to "eula=true". I'm sure there's a text editor that you can use in the Raspberry Pi GUI that'll let you do that.

9) Re-run the server with the commands:

cd ~/minecraft
~/jdk-17.0.1+12/bin/java -Xms512M -Xmx1008M -jar spigot-1.18.1.jar nogui

(Note the "cd ~/minecraft" is redundant if you were already in that directory, but I'm just repeating it to be clear.)

DONE!

At this point, you should be able to fire up your Minecraft client on another PC that's connected to the same network. I think you may need to tell Minecraft what the IP address of your server is in the multiplayer menu. You can look up your server's IP address from the command line again on the PI if you run the command:

ifconfig eth0

if you're using a wired connection or else run the command:

ifconfig wlan0

if you're on a wireless connection.

You'll want the number that's to the right of the "inet" field. It might look like "192.168.1.45" or something like that, depending on how your network is set up. Once you have that, you can type that IP address into the Minecraft server browser and hopefully it'll find it and you're good to go!

Let me know if you have problems with any of the above steps and I'll try to help as best as I can!

Hey Coyote; I really appreciate all the direction. As a linux noob, even knowing the syntax has been a bit of a headache, but it's given me good context to learn something new. Your annotations are helpful, and I also make sure to look up all the commands and flags you're including so that I actually know what I'm telling the computer to do. Linux comfort++.

That said, I'm still hitting a few roadblocks, but I've taken it to PM so as not to completely overwhelm this thread with the "Feegle's kids want a Minecraft Server - help!" posts. Thanks to everyone else for their patience!

My bad!!! My step #5 had a missing field from it. I've corrected the above. Sorry about that! I tried to copy what I did from my history buffer but it looks like I ended up having to reconstruct a command and I gave you the wrong thing.

In editing the above, I just realized I had two step 5s. Also fixed!

For future reference, that's the most recent Long Term Support (LTS) release for the arm32 Architecture, from https://adoptium.net/releases.html . You should check for updates at least quarterly.

Since we're talking about Minecraft, it would be appropriate to make sure your game is fully patched against the recent (and extremely serious) Log4j exploits. Please see:

https://www.minecraft.net/en-us/arti...

I built a minecraft on a raspberry pi 4. It worked fine for a vanilla server, but ultimately I was just frustrated with it. I ended up buying a used optiplex small form factor for like $50. Works a thousand times better.

Also, do you even need a server? If you're just playing together you can run the game as single player and select Open to LAN, and have everyone join that. I find that works great and is a million times easier.

What are you guys currently using your PIs for?

I’m getting ready to test using mine as a VPN and pop-up blocker for my home network.

Mostly NextCloud, file and print server. I need to back it up and install Pi-Hole.

Home-spun webcams, webcam display monitors, and a Minecraft server.