wfsaxton
Posts: 2
Joined: Thu Feb 14, 2019 2:21 pm

Automated provisioning of Raspbian Questions

Thu Mar 21, 2019 4:59 pm

I'm trying to find out a way I can quickly and repeatedly provision Raspbian with CLI or ansible, particularly when it comes to enabling VNC server and SSH access.

I'm struggling, because it appears all "CLI" answers to these kinds of questions are to use 'sudo raspi-config' which is NOT a real CLI solution.

Any idea how I can do this with a REAL CLI command? Or perhaps I can create/edit a config file somewhere?

epoch1970
Posts: 3066
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Automated provisioning of Raspbian Questions

Thu Mar 21, 2019 5:06 pm

raspi-config is a script, you could read what it does if you're interested...
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
B.Goode
Posts: 7870
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Automated provisioning of Raspbian Questions

Thu Mar 21, 2019 5:06 pm

The shell (command-line) utility raspi-config is simply a shell script stored at /usr/bin/raspi-config

So it is 'easy' to inspect it to determine what underlying actions it takes on your behalf.

Andyroo
Posts: 3353
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Automated provisioning of Raspbian Questions

Thu Mar 21, 2019 5:08 pm

SSH can be 'turned on' pre-boot https://www.raspberrypi.org/documentati ... ccess/ssh/ Note this only activates password security for the user Pi - any further and you need to script it AFTER the machine is up!

VNC install details are https://www.raspberrypi.org/documentati ... /README.md

I just though VNC worked (not headless) out of the box if you did not need to get to the Pi over the internet (VNC Cloud) BUT I could well be wrong here as its been a few months since I needed VNC from scratch and normally link to my account out of habit.

There are numerous posts here asking for more scripting abilities for images - one day maybe...
Need Pi spray - these things are breeding in my house...

User avatar
B.Goode
Posts: 7870
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Automated provisioning of Raspbian Questions

Thu Mar 21, 2019 5:44 pm

Also, to add that raspi-config has a largely undocumented non-interactive mode, perhaps to provide an API for the full-gui desktop version of the configuration tool.

Clearly it isn't official documentation, but this 3rd party web page gives an idea of what is possible: http://www.knight-of-pi.org/raspi-confi ... -commands/

Andyroo
Posts: 3353
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Automated provisioning of Raspbian Questions

Thu Mar 21, 2019 8:57 pm

B.Goode wrote:
Thu Mar 21, 2019 5:44 pm
Also, to add that raspi-config has a largely undocumented non-interactive mode, perhaps to provide an API for the full-gui desktop version of the configuration tool.

Clearly it isn't official documentation, but this 3rd party web page gives an idea of what is possible: http://www.knight-of-pi.org/raspi-confi ... -commands/
Only concern I have with this is when the config tool changes this may not work or the wrong option ends up being taken :cry: I think I would rather work out what the code does from it’s source as I can document my needs and handle any changes.
Need Pi spray - these things are breeding in my house...

User avatar
B.Goode
Posts: 7870
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Automated provisioning of Raspbian Questions

Thu Mar 21, 2019 9:13 pm

Andyroo wrote:
Thu Mar 21, 2019 8:57 pm
B.Goode wrote:
Thu Mar 21, 2019 5:44 pm
Also, to add that raspi-config has a largely undocumented non-interactive mode, perhaps to provide an API for the full-gui desktop version of the configuration tool.

Clearly it isn't official documentation, but this 3rd party web page gives an idea of what is possible: http://www.knight-of-pi.org/raspi-confi ... -commands/
Only concern I have with this is when the config tool changes this may not work or the wrong option ends up being taken :cry: I think I would rather work out what the code does from it’s source as I can document my needs and handle any changes.

Well, that's why my provision of factual information was heavily qualified with Health Warnings like largely undocumented and Clearly it isn't official documentation

But while you are working out what the raspi-config code does from its source you could also look at how the nonint command line argument is processed... it is all there in plain sight for all to see.

mina
Posts: 16
Joined: Sun Sep 03, 2017 11:49 am
Location: Switzerland
Contact: Website

Re: Automated provisioning of Raspbian Questions

Wed Mar 27, 2019 2:21 pm

I provision my RPi (for MoodleBox https://moodlebox.net/) with Ansible. See the project repo here: https://github.com/moodlebox/moodlebox

HTH
Nicolas – Maintainer of MoodleBox, a Moodle server on Raspberry Pi

User avatar
salsaman
Posts: 7
Joined: Wed Jun 03, 2015 9:16 pm

Re: Automated provisioning of Raspbian Questions

Thu Jun 13, 2019 6:41 pm

B.Goode wrote:
Thu Mar 21, 2019 9:13 pm
But while you are working out what the raspi-config code does from its source you could also look at how the nonint command line argument is processed... it is all there in plain sight for all to see.
Looking at a script's source code is not the way to fine a command's command-line interface. That is not "in plain sight for all to see."

It should report what to do with "man raspi-config" or "raspi-config -" or "raspi-config --help" or something, but there's no man page or help message.

It is disconcerting that raspi-config has a "nonint" option but no documentation whatsoever on how to use it.

Surely somebody has documented this somewhere. I found this thread looking for such documentation, and I will keep looking.

User avatar
B.Goode
Posts: 7870
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Automated provisioning of Raspbian Questions

Thu Jun 13, 2019 8:22 pm

salsaman wrote:
Thu Jun 13, 2019 6:41 pm
B.Goode wrote:
Thu Mar 21, 2019 9:13 pm
But while you are working out what the raspi-config code does from its source you could also look at how the nonint command line argument is processed... it is all there in plain sight for all to see.
Looking at a script's source code is not the way to fine a command's command-line interface. That is not "in plain sight for all to see."

It should report what to do with "man raspi-config" or "raspi-config -" or "raspi-config --help" or something, but there's no man page or help message.

It is disconcerting that raspi-config has a "nonint" option but no documentation whatsoever on how to use it.

Surely somebody has documented this somewhere. I found this thread looking for such documentation, and I will keep looking.

Maybe you should express your strong concerns on the Issues page for the code repository here: https://github.com/RPi-Distro/raspi-config/issues

They are more likely to come to the attention of a relevant developer there.

Return to “Advanced users”