Skip to main contentSkip to footer
  • 2 weeks ago
In this step-by-step guide, I walk you through setting up a Raspberry Pi headless?no monitor needed! Learn how to tackle SD card issues, disable the auto-mount service (uDiscs2) to avoid corruption, and configure SSH for secure remote access. I?ll also show you how to set a static IP using Network Manager, prep the Pi for a WiFi dongle, and install the "screen" utility to save your work. Whether you're a beginner or a seasoned Raspberry Pi enthusiast, this tutorial covers practical tips to get your Pi online and ready for projects. Hit subscribe, check out my website via the QR code, and join the community for more tech tutorials!

Introduction and SD Card Issue 00:00:00
Disabling Auto-Mount Service 00:00:41
Mounting SD Card Partitions 00:01:24
Configuring SSH on Boot Partition 00:02:15
Setting Static IP in cmdline.txt 00:02:48
Configuring Root Partition and SSH Keys 00:03:44
Setting File Permissions for SSH 00:06:04
Unmounting Partitions and Booting Pi 00:07:31
First SSH Login to Pi 00:09:14
Configuring Network Manager for Static IP 00:09:51
Setting Hostname and System Update 00:17:01
Installing Screen Utility 00:18:24
WiFi Dongle Installation Overview 00:19:11
Video Conclusion and Subscription Request 00:21:00

Thanks for watching!

Find us on other social media here:
- https://www.NeuralLantern.com/social

Please help support us!

- Subscribing + Sharing on Social Media
- Leaving a comment or suggestion
- Subscribing to our Blog
- Watching the main "pinned" video of this channel for offers and extras
Transcript
00:00Okay, I'm back.
00:04I have finished writing my SD card.
00:06I had a problem when the scene was paused.
00:10Basically those annoying pop-ups came back where I was like in the middle of writing
00:14to the card and the auto-mounting service suddenly decided that there was a file system
00:19there and it auto-mounted it and then it, you know, put it up onto the screen.
00:29And I think it corrupted the card so I ended up having to rewrite the card from scratch.
00:32So let me just show you real fast within this video how to disable that service.
00:42It's sudo system control, start with status and then type udisks2.service.
00:50For me, I already disabled this to get it working so, what happened, no, enabled, no, I already
00:56stopped it.
00:57Basically you just want to do stop to temporarily stop it.
01:00And then if we go back to status, it's still, it's still enabled.
01:03That just means that it'll come back on for the next boot.
01:05Okay.
01:06So if your SD card corrupted or anything like that, you probably want to start over after
01:10you disable udisks.
01:13And then if we use the parted partition editor again, we can see that SDB is still there.
01:18So that's still considered the name of our card.
01:20So now that, let's see, now that the auto-mounter is not doing anything for us, we need to mount
01:28the card ourselves.
01:28So I'm going to go into CD, actually just to double check media and then mic, and then
01:34notice how it's not mounted.
01:35So I'm going to go into CD.
01:37I'm going to go into the temporary directory.
01:38I'm going to go into that PI directory.
01:40I think I probably made that earlier on camera for you.
01:43And then I made two other directories, one called boot and root.
01:46So I'm just going to mount the, uh, oops, dev SDB partition one, which is usually the boot
01:54partition to the boot folder.
01:57Do my password and then do the same thing for partition two, which is usually the file
02:02system root folder.
02:05So first thing we need to do is go into the boot partition.
02:09So this is what the PI will see when it boots up.
02:13Um, yeah, okay.
02:17So what we need to do is, uh, make an empty file called SSH in the boot folder or the boot
02:22partition, because, um, we want to, we want to tell the PI that it's SSH server should be
02:29enabled by default.
02:30So I'm going to go sudo touch SSH.
02:34If I list it again, notice how there's just an SSH folder and that's it.
02:38There's nothing inside of it.
02:39The PI just knows the other thing we have to do is modify the startup command line here.
02:43I already did this actually, when I jumped away, I added another video.
02:48Basically you want to do, you want to edit the cmdline.txt file, and then you want to
02:53find the argument that says root weight.
02:56And right after that, you want to stick the IP address that you want your PI to start up
02:59as or start up with.
03:01So it's IP equals, and then the address.
03:04And then again, like we said before, in this video, you need to know what is the subnet
03:08of your existing network and, and you need to choose an IP address for your PI.
03:12Let's see if I actually matched what I was supposed to do, oh gosh, for the PI, um, yeah,
03:215.1.
03:22Okay.
03:23So I'll move that over to the first thing there.
03:25Yeah.
03:26So, uh, just 123 is what we wanted.
03:28So, uh, that's why that is there.
03:31So I didn't actually modify this, but you'll have to modify yours.
03:34I didn't because I have to, because I already did it.
03:37And then we'll go into the, uh, into the root, uh, partition.
03:41So we'll go into the root partition and notice how it's got like all the files and folders
03:46that you're used to seeing with Linux.
03:48Uh, so that means, you know, this is the temporary amount slash PI slash, sorry, slash temp slash
03:53PI slash root.
03:55Inside of it, there's a subfolder called home.
03:57And then there's the home directory for root, for the root account under the root folder.
04:01You could modify that instead.
04:02If you want to, I'm just going to go into the home account, sorry, the home folder, and
04:07then go into the PI accounts home folder.
04:10So notice how there's a bunch of like starter files, uh, because that's what your PI account
04:14is going to start off with.
04:16Again, notice how we're in like a deeper subdirectory.
04:19So from the PI's perspective, we're really only in slash home slash PI.
04:24Um, I already actually did this, uh, when I jumped away, I wanted to make an extra video
04:29for SSH, uh, or sorry for first boot stuff.
04:32So I made the SSH folder.
04:34What you need to do is make directory dot SSH so that you have a SSH folder in this, uh,
04:40in this PI folder.
04:42Then once you have that go inside of it and you want to make a file called
04:46authorized keys, so I did nano authorized keys like that.
04:52And then I edited it and I just put the public key, uh, of, of the machine that I'm currently
04:56on right now.
04:57This is just a virtual machine.
04:59Uh, so I guess it's fine if I share, but, um, what you want to do is generate your own
05:04SSH key.
05:05If you don't know how to do that, see my other videos, but, uh, you can print out your SSH
05:11key with pretty much cats squiggly line or tilde Swinton.
05:15And then like a slash and then dot SSH and then ID and then dot pub.
05:20So that was my public key.
05:21That's how I found it.
05:22And then, um, you know, if you don't have a key, you can go ahead and do this on your
05:26host SSH key gen.
05:28I forgot if I put this into the last segment, but you type that and you hit enter a bunch
05:32of times.
05:33And when you're done hitting enter enough, you'll have your public key there somewhere.
05:37You probably want to eventually learn how to put a password on your key, but, uh, it's
05:41fine for now.
05:43So we created the authorized keys file that basically tells the operating system, uh, that
05:48I would like that particular key to be able to authenticate as that user.
05:53And since the PI is a God user or like a root user, uh, it's pretty nice.
05:58The other thing we have to do is make sure that we set permissions correctly.
06:01If the permissions aren't correct on any of these files or folders, your SSH will not authenticate.
06:07Uh, so, so I'm going to make sure that this is a set to the right permissions for me.
06:12I usually do seven zero zero on the authorized keys file.
06:16I can't remember if six OO is fine.
06:18So I just put seven.
06:20That basically means that your current user, which will eventually be the PI user has full
06:24permission to look at that file, but nobody else does.
06:27So, uh, you can tell by the way, because on the left, there's just like a read, write
06:32execute, and then a bunch of empty dashes, meaning nobody else has permissions.
06:37So we've got to do the same thing for the SSH folder.
06:40Um, so I'm going to go, uh, you know, Chamod, if this doesn't work by itself, you might want
06:45to say pseudo Chamod, but I think it'll work because the username that it thinks is on that
06:50folder is actually the same as my current user, which is great.
06:53So I'm going to go Chamod, um, seven OO dot SSH.
06:58I know for sure you need the seven and not the six on there.
07:00Meaning, uh, the current user should be able to actually like read that directory.
07:06If it's six, they won't even be able to read the directory.
07:09So we do that just to make sure that the dot SSH file and the authorized keys file
07:14have correct permissions.
07:15And then I think we're ready to log into the pie for the first time.
07:19So I'm going to go up.
07:20By the way, if you were inside of root, for some reason, I do this sometimes sudo su root.
07:25And then I'm like, oh, let's go up and let's, whoops, let's go up.
07:30And then let's unmount, whoops, let's unmount this boot partition or the root partition.
07:36You may get an error message saying that the partition is busy
07:39because what you didn't realize was the account that you just came from
07:42is still considered in that directory.
07:45So you've got to make sure that there are no, uh, terminals or accounts or anything
07:49actually using that directory before you try to unmount it.
07:52So I'm going to go sudo, uh, oh, I got to go up one level.
07:56sudo unmount boot, umount, and then umount root.
08:02If there are no error messages, then that means the SD card is ready to be put into the actual pie.
08:07Before I do that, though, I'm going to start pinging the pie
08:11because it's fun to see the pings come online.
08:13I'm going to go 192.168.123 because that's what we chose for the pie already.
08:20In my other video that I just made, I typed like a 0.123 and I sat here forever on camera.
08:25I'm not going to edit it out.
08:28So I'm going to take the SD card out.
08:30And, uh, you can't really see my pie because it's plugged into an ethernet cable,
08:35but I'm plugging an ethernet cable into the pie.
08:38I'm putting the SD card into the pie.
08:41And then I'm going to plug power into the pie.
08:44Totally headless. Don't have to worry about very much at all.
08:46So it's got power now.
08:50It's like falling off the desk.
08:52And pretty soon now it should start responding to pings.
08:58As soon as it comes up, I'm going to log in and start, uh, finalizing the ethernet, uh, setup.
09:04There it goes.
09:06Might take like a few more seconds after this before the SSH server actually comes up,
09:10but I'm going to give it a try right now and see what happens.
09:14And remember to do pie at, because we did not make a different user.
09:18When you see this message right here, it just means that, uh, the remote is not recognized.
09:22That's a security feature. So I'm going to put yes.
09:24And now we're in the pie.
09:27So, uh, what I was supposed to do is a network manager connection show,
09:31at least this version of the pie, the latest version uses network manager.
09:34If you're watching this video from the distant future,
09:37you probably just need to, you know, use whatever tool they have instead of network manager.
09:42So I'm going to edit the ethernet connection.
09:47And I'm going to print the connection details just to double check here.
09:51It's, uh,
09:55I guess it's fine.
09:56So now I'm going to set up the IPv4 settings.
09:58So I'm going to go, uh, set ipv4.method to manual because I want a static IP,
10:05getting dynamic IPs that are also fixed is kind of like another video.
10:09I want to set the address to the one that we just put into the command line.
10:12So 1.123 and give it a 24 block, meaning it'll be considered in the same subnet with other
10:19addresses that only have the last number changed.
10:21Then we'll set the gateway to 1.1, which is the router address.
10:25Okay.
10:28I'm looking at notes right now.
10:291.1 and then we'll set the DNS.
10:32You don't actually necessarily need to set the DNS if you're, well, I don't know,
10:36maybe you probably should if we're doing static right now.
10:38Yeah.
10:39Uh, you should probably maybe try setting the DNS as your router.
10:42Cause usually your router, um, is also your DNS server at home.
10:46Uh, if that doesn't work, maybe try a different number that you can find online.
10:50This one is, I think, Google DNS.
10:52You just need at least one DNS server, preferably two or more, um, that works.
10:58So you can resolve numbers to names and your computer can go online by typing names.
11:02So for me, uh, these are my DNS servers.
11:05So I'm just going to type them in real fast.
11:08Whoops.
11:11And then, uh, you don't need to do this next setting, but I like to,
11:14I like to be able to use shorter server names.
11:18So for me, instead of typing, let me show you what this means in a second.
11:22So I'm going to say my search domain is home.
11:24Cause I have a fake domain at home called home.
11:27Most people do land.
11:29Um, you should probably double check this by saying,
11:32print ipv4, like print ipv4.
11:36Um, and then after we're done, we'll say save and then we'll quit.
11:39And then the reason I do this is if I, if I ping a server, uh, like,
11:44let's say I do router dot home for me, that's too much typing every single time.
11:49If I added that dot home search domain, then I could just ping router.
11:53And so that's, that's the only reason that I do that.
11:55It's just a little bit more convenient.
11:57So now, um, let's remove the setting that we put into the command line
12:01so that we have more freedom to modify the network in the future if we want to.
12:05So let's go to the boot partition.
12:09We're in the pie right now.
12:10So it's a little bit different.
12:11We'll go into the firmware sub folder.
12:14And then we'll modify that command line file that we had in before where we were forcing that IP.
12:19We'll just erase this so that it's no longer forced because the network manager, uh, configuration
12:25we just did should be okay.
12:27And then let's reboot, reboot the machine.
12:31Do another ping so that I can get online as soon as it comes back up.
12:35Should just take a couple seconds here.
12:36So how was your, how was your day?
12:41How are you?
12:42How are you?
12:44I think somebody let me know if I look weird in this camera because I have like a new camera
12:48with like a viewfinder or not a viewfinder, like an LCD display.
12:52I didn't used to have that before.
12:54I had the oldest, cheapest, crappiest camera you could possibly imagine.
12:57Now it's just kind of cheap.
12:58Um, but I can see my face in the, in the viewfinder, in, in the LCD, you know, screen.
13:06So I'm looking at my own face right now instead of the camera.
13:09So tell me if this seems strange or weird to you.
13:25Uh,
13:28I don't know where I cut the last video, but basically we had just set a static IP address
13:40on the pie and then rebooted it and it didn't come back online.
13:44So I had to stop the video and just try to figure out what I did wrong.
13:47And basically I forgot to tell the connection to start on boot.
13:50So, uh, what I did to fix it is I went into the SD card again.
13:55So I did another mount.
13:56I didn't mount the boot partition.
13:58I only needed to mount the root partition.
14:00And the path that you go into is pretty much this.
14:02If you're using network manager, you go into your temporary mount.
14:06So that's this first part right here, temp, pie, root.
14:09And then the file system from the pies perspective, this is the path
14:13where you can find your system connections.
14:15So, et cetera, network manager, system connections.
14:19Inside of it, you'll see a file for every connection that you set up
14:22on the fail that you just did or that I just did.
14:25Maybe this will prevent you from failing.
14:29Maybe I'll show you how to set that inside of the pie too, just to be sure.
14:33So basically we're just going to edit that connection file.
14:36Uh, there's a bunch more stuff down below, but I just kind of spaced that down.
14:40So you won't see it.
14:41What you're really interested here in this connection file is auto connect.
14:46It should have been set to true.
14:47And now if we do that, um, we should be able to unmount the card and boot the pie back up.
14:53And then it should go online.
14:55This is actually kind of like maybe a good reminder to always
14:58include redundancies as a good computer nerd, right?
15:01Computer scientists, computer nerds, we always like have redundancies in everything.
15:05What I should have done is chose a different IP address for the network manager connection.
15:11That way, if I screwed it up, the pie would still boot under the first address.
15:14And only after seeing that it booted with the new address, I could have removed the first address.
15:19But you know, I'm a little impatient and careless sometimes.
15:23So I'm going to unmount this root partition.
15:27And we'll go back to looking at the pings, right?
15:29That's the correct ping.
15:31I'm going to remove the SD card from the reader.
15:34I'm going to put it back into the pie.
15:38And then I'm going to plug in the power.
15:40Okay, now hopefully it won't take long before the pie comes back online.
15:49If it never does, you and me are going to be sitting here.
15:59Oh, please, come on, what have I done wrong?
16:02Okay, it works this time.
16:03So it was definitely the auto connect.
16:07So now I'm going to go SSH into the pie.
16:10We already saw that security warning, I think,
16:12either in this video or the other video.
16:14But what have I done?
16:18I forgot to put the one there again.
16:21Okay, so we're in the pie.
16:24First boot, first connection without even using a computer monitor.
16:27Pretty sweet.
16:28So now I'm going to go sudo network manager command line show.
16:32And then I'm going to edit the ethernet connection.
16:37Just to show you what we should have set before we saved.
16:41It would have been connection.autoconnect.
16:43So I should have said connect set connection.autoconnect
16:49connect to yes.
16:51That didn't change anything, but that's what I should have done.
16:54I mean, it would have changed something before.
16:55So now we're inside the pie.
16:58And we're ready to start setting up more stuff.
17:01So the first thing I'm going to do is,
17:03well, I'd like to change the host name on this pie.
17:06So I'm going to do sudo nano etc host name.
17:10There's a command called host name I think you can use,
17:12but I just like to set it in the file.
17:14So basically, we want to set the host name of the pie.
17:16That's not terribly useful for now.
17:19But I just like it because it shows up on the command line.
17:21So I'm going to go pi repeater dot living room dot home.
17:27Don't judge me for my silly domain names.
17:29So now the next time we reboot the pie, we'll have a good domain name.
17:34Then I'm going to do an update.
17:36So I'm going to do actually, you know what, what you should do at home,
17:39I'm going to omit this just to save time.
17:41You should say sudo apt update for sure.
17:44Everybody should do that because the local list of packages that are available
17:50needs to be updated.
17:51Otherwise, you might have a hard time installing later.
17:54It sometimes gets out of sync and it doesn't work.
17:55So we'll all do update.
17:58At home, you should do upgrade right away.
18:00I'm not going to do upgrade right now because it'll take a long time.
18:03And then after you do upgrade, you should do auto remove
18:06with a dash yes there or just type yes manually.
18:09Again, I'm not going to do that until the camera's off.
18:12And then you should reboot the computer.
18:14Or reboot the pie.
18:16Then let's install a program called screen, which gives us a virtual screen.
18:22Let me show you just real fast what this is for.
18:25So sudo apt install screen.
18:28It's just basically a virtual screen that you can work on.
18:31So if you accidentally lose your connection or something goes wrong,
18:34you can log back in and get right back to your work.
18:37So I type screen here and I'll just type like a bunch of random characters.
18:41And then I will detach from the screen and exit the pie.
18:46So imagine you lost your internet connection or your network connection.
18:49I can go back into the pie now and I can list screens with screen dash list.
18:55And then I can reattach to it with a dash R.
18:58Notice how my work is still there.
19:00This doesn't survive if the whole machine reboots, but this has saved me a few times from losing work
19:05when I was connected to a remote terminal.
19:08Okay, so now what do we have to do?
19:11The next most important thing that we have to do is install our Wi-Fi dongle.
19:17We have to actually install drivers.
19:19If you're looking at this video way in the future, I don't know, maybe the pie will handle this.
19:22But right now, as of, you know, the making of this video,
19:26this dongle doesn't work unless you install the drivers from source.
19:29So let me just prove to you real fast.
19:33How can I show the internet adapters without?
19:37Well, maybe you'll just have to trust me.
19:40At home, do this command IP, whoops, do this command IP ADDR and hit enter.
19:46And you should see two network adapters.
19:49You should see Ethernet 0 and also wireless LAN 0.
19:53Wireless LAN 0 should be already working.
19:55It's not connected yet, but it's working because, well, that's the one that's built into the pie.
20:02You want also another one.
20:05You want wireless LAN 1, like we talked about before.
20:08For that, we have to plug in the dongle and install the firmware.
20:11So, I think what I'm going to do now is stop this video and jump into another one
20:17where I just kind of talk about how to install this dongle.
20:21So, by the time you watch this video, that other video should be posted.
20:24I'm basically just going to expect that you pause this video and you go over there
20:28and you watch the video to install this dongle.
20:32If you don't have the same dongle as me, that's okay.
20:34The instructions will probably help you get a pretty good idea for how to do it yourself.
20:38And then again, if enough people comment about the same...
20:43I don't know if I said this before.
20:44If enough people comment asking me to make a video for the same dongle,
20:48I might buy the dongle and then just try to install it for everybody.
20:52We'll see what happens.
20:53So, I'm going to cut the video now.
20:55Go to the other video that shows you how to install the dongle and then we'll continue.
21:01Hey, everybody.
21:02Thanks for watching this video again from the bottom of my heart.
21:05I really appreciate it.
21:06I do hope you did learn something and have some fun.
21:09If you could do me a please, a small little favor.
21:11Could you please subscribe and follow this channel or these videos
21:16or whatever it is you do on the current social media website that you're looking at right now.
21:20It would really mean the world to me and it'll help make more videos
21:24and grow this community.
21:25So, we'll be able to do more videos, longer videos, better videos,
21:28or just I'll be able to keep making videos in general.
21:31So, please do me a kindness and subscribe.
21:35You know, sometimes I'm sleeping in the middle of the night and I just wake up
21:38because I know somebody subscribed or followed.
21:40It just wakes me up and I get filled with joy.
21:42That's exactly what happens every single time.
21:45So, you could do it as a nice favor to me or you could you could troll me
21:48if you want to just wake me up in the middle of the night.
21:49Just subscribe and then I'll just wake up.
21:52I promise that's what will happen.
21:54Also, if you look at the middle of the screen right now,
21:57you should see a QR code which you can scan in order to go to the website,
22:01which I think is also named somewhere at the bottom of this video.
22:04And it'll take you to my main website where you can just kind of like see
22:07all the videos I published and the services and tutorials and things that I offer
22:11and all that good stuff.
22:13And if you have a suggestion for clarifications or errata
22:20or just future videos that you want to see, please leave a comment.
22:23Or if you just want to say, hey, what's up?
22:25What's going on?
22:26You know, just send me a comment, whatever.
22:28I also wake up for those in the middle of the night.
22:29I get, I wake up in a cold sweat and I'm like, it would really,
22:34it would really mean the world to me.
22:35I would really appreciate it.
22:36So again, thank you so much for watching this video.
22:40And enjoy the cool music as, as I fade into the darkness,
22:46which is coming for us all.
22:58greata video.
22:59Take care.
22:59If you....
23:14Yeah,
23:15thank you so much for watching.
23:18Take care.

Recommended