this post was submitted on 15 Jun 2023
6 points (87.5% liked)

Selfhosted

40220 readers
1155 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hey guys, I would like to install Debian on my raspberry pi 4 model B 2gb, but I dont have a micro HDMI. I would like to install it headless. I watched a video where the guy created some files in the boot partition on the SD card to enable SSH, and I was wondering if I can do something similar with a Debian SD so I dont need to go out and buy a cable.

I couldn't find too many tutorials for Debian on the pi, and none to install it headless.

Thanks in advance!

Edit 1: I ended up going with raspbian lite because of some other issues that came up.

top 14 comments
sorted by: hot top controversial new old
[–] [email protected] 4 points 1 year ago (1 children)

In case of Raspbian, you can create a wpa_supplicant.conf in the boot partition with:

network={
    ssid="testing"
    psk="testingPassword"
} 

and a empty ssh file.

For the user config, since bullseye you need to make an account on first boot, that can be done with a userconf file, but it's a bit more involved. You can see how to do it at the end of This blog post

[–] [email protected] 2 points 1 year ago (2 children)

Im planning on putting debian on it, so I think its slightly different because e.g. theres no raspberry pi user

[–] [email protected] 2 points 1 year ago

Why not use Raspberry Pi OS? It's based off of Debian.

[–] [email protected] 2 points 1 year ago (1 children)

If you're planning on using plain Debian and the challenges that come with it, you probably should start with one of the pre-built images from the Debian foundation. You can mount the root partition with either a running linux box or WSL2. Then you can chroot into it to setup the wpa_supplicant.conf in the /etc/ folder and ensble sshd.

[–] [email protected] 2 points 1 year ago

Thats something like what I'll be trying. I am on a linux laptop so I can do all that.

[–] [email protected] 3 points 1 year ago (1 children)

You could try this but instead of editing the required configs to enable ssh on your pi just stick it back in your pc and do it there. Haven't tested this myself but this is what I would try.

[–] [email protected] 1 points 1 year ago

Do you mean to boot my PC from the SD card and do it all on there?

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

There should be a couple tutorials about how to establish a ssh connection to your pi. From there you can have root access and be able to do anything you want.

Edit: I reread your post.

Raspbian and debian are sufficiently similar, I would think the boot process and file structure is the same (I have only worked with Raspbian)

In Raspbian, I think ssh is disabled by default due to some security concerns with the default user "pi" password "raspberry". So changing the default value in the config text file and then connecting to ssh by finding the ip4v of the pi on your local network then connecting over the command line with "pi" then "raspberry" then changing the password before it is exposed to the internet is how you would do it.

Source: I had a pi 3b+ but it developed a short during the pi shortage and I haven't gotten around to fixing it.

[–] [email protected] 2 points 1 year ago

Im sure theres a way to do it on debian and it might even be the same as on raspbian, but I just dont know what user I would use or exactly how to set everything up. An option is to boot into the SD card from my laptop and set everything up there before plugging it into the Pi.

[–] [email protected] 1 points 1 year ago (1 children)

I don't know about Pis, but before you host a mail server make sure that you know what you're doing. Your ISP probably blocks important ports, and hosting a Mailserver is a mess with DNS, dmarc and much more.

Source: I host my own Mailserver, would not recommend as a default option.

[–] [email protected] 1 points 1 year ago

I'll definitely be running my regular email in parallel with my own server for a time. I for sure wont be deleting that straight away. At the very least its an experiment, and if it doesn't work out after 6 months to a year I can simply go back to my gmail, or look for different options.

[–] [email protected] 0 points 1 year ago (1 children)

I'm not sure that it can be done. Looking at https://linuxhint.com/install_debian_raspberry_pi_4/ it suggests the images on the debian site, come with a root user with no password, and SSH set to keybased auth. There isn't even any WiFi until you login and enable it.

[–] [email protected] 1 points 1 year ago (1 children)

Ill probably boot into the SD card from my laptop and set everything up like that before even putting it on the RPi

[–] [email protected] 1 points 1 year ago

Yeah. I think the empty ssh file and wpa_supplicant stuff that Raspbian accepts in the root of the disk, is down to the nature of people setting up headless Raspberry Pi's frequently. Setting it up properly on a PC and then booting the Pi from it - is definitely the way to go.

load more comments
view more: next ›