User avatar
Nfarrow
Posts: 47
Joined: Sat Dec 20, 2014 1:24 am
Location: Oklahoma, USA
Contact: Website Facebook Twitter YouTube

SD card boot config question

Sun Jan 21, 2018 3:07 am

Hello fellow Pi people . One quick question. If I have a freshly made image of Raspbian on an SD card. I mount it in windows I see view able files and folders. Would there be a file that I can setup my shell commands to configure the pi after it boots up. if I place the shell code in it?
Twitter: @farrownick
Instagram veggievampire
I own a lot of Pis....

User avatar
DougieLawson
Posts: 33311
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: SD card boot config question

Sun Jan 21, 2018 5:58 am

No. That function doesn't exist.

The only files are an empty ssh or ssh.txt or wpa_supplicant.conf with WiFi credentials. Those two trigger special processing on first boot.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

n67
Posts: 718
Joined: Mon Oct 30, 2017 4:55 pm

Re: SD card boot config question

Sun Jan 21, 2018 7:37 am

Nfarrow wrote:
Sun Jan 21, 2018 3:07 am
Hello fellow Pi people . One quick question. If I have a freshly made image of Raspbian on an SD card. I mount it in windows I see view able files and folders. Would there be a file that I can setup my shell commands to configure the pi after it boots up. if I place the shell code in it?
The short answer is: Not yet.

The longer answer is that this functionality has been requested many times and will, I'm assuming, get implemented at some point. Currently, the "Pi Baker" system (which runs, I believe, only on Macs) does something like this. As I understand it, Pi Baker involves modifying the image so that a script on the FAT partition (the only one normally accessible by Mac or Windows) will be run on first boot of the Pi. I've never used PB, but my guess is that it (the custom script produced by the PB system) runs out of rc.local (on the Pi). All of this implies that for each new release of Raspbian this special modification must be done by the PB maintainer(s), in order to keep up. Obviously, it'd be better all around if this functionality were in the core OS release, so that no after-market modification was necessary.

Someday...

Incidentally, if you were doing this on a large enough scale, it might be worth it to you to develop a process similar to this - where you use a Linux system to modify the image file to run your script from rc.local. Then you'd have the functionality that you need.
"L'enfer, c'est les autres"

Heater
Posts: 9461
Joined: Tue Jul 17, 2012 3:02 pm

Re: SD card boot config question

Sun Jan 21, 2018 11:53 am

Yes. It can be done. I have done it many times. It's easy. There are at least two ways to tackle this:

1) Install the Linux File Systems for Windows by Paragon Software: https://www.paragon-software.com/home/linuxfs-windows/

You will then be able to edit any and all configuration files on the Linux partition on the SD card.

extfs is available as a free demo for a limited time. After that period expires it will still work but at limited speed. Still good enough for hacking a few scripts and such. It's very cheap to buy anyway.

2) Install VirtualBox on your Windows PC.

You can make an SD card visible to Linux running in a virtual machine under VirtualBox and edit files on it as you would from any Linux machine.

k-pi
Posts: 459
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: SD card boot config question

Sun Jan 21, 2018 12:09 pm

.....or run a 'live' Linux, pendrive or CD/DVD. :)

User avatar
rpdom
Posts: 12647
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: SD card boot config question

Sun Jan 21, 2018 1:40 pm

k-pi wrote:
Sun Jan 21, 2018 12:09 pm
.....or run a 'live' Linux, pendrive or CD/DVD. :)
What, like this one? ;-)

Heater
Posts: 9461
Joined: Tue Jul 17, 2012 3:02 pm

Re: SD card boot config question

Sun Jan 21, 2018 2:03 pm

The question in the OP specified "in windows".

n67
Posts: 718
Joined: Mon Oct 30, 2017 4:55 pm

Re: SD card boot config question

Sun Jan 21, 2018 2:33 pm

Heater wrote:
Sun Jan 21, 2018 2:03 pm
The question in the OP specified "in windows".
Quite so. Obviously, all of the "But I can run Linux on Windows; I do it all the time!" posts are cheating.

The implicit point in my previous post is that, yes, the author of the PB system "cheats" by going in via some mechanism that can read/write ext4 and makes the mod, so that the end user (of the PB system) doesn't have to.

Again, it would be very good if this functionality were made part of the core system so that the author of the PB system (and others of similar mind) didn't have to do this hack themselves.
"L'enfer, c'est les autres"

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

Re: SD card boot config question

Sun Jan 21, 2018 4:04 pm

n67 wrote:
Sun Jan 21, 2018 7:37 am
the "Pi Baker" system (which runs, I believe, only on Macs) does something like this.
There is a version of Pi Bakery for Windows: http://www.pibakery.org/docs/install-win.html



As I understand it, Pi Baker involves modifying the image so that a script on the FAT partition (the only one normally accessible by Mac or Windows) will be run on first boot of the Pi.
The documentation for Pi Bakery is worth reading. It does not only run on First Boot.

http://www.pibakery.org/about.html

and

http://www.pibakery.org/docs/index.html

ejolson
Posts: 1724
Joined: Tue Mar 18, 2014 11:47 am

Re: SD card boot config question

Sun Jan 21, 2018 10:29 pm

n67 wrote:
Sun Jan 21, 2018 2:33 pm
Heater wrote:
Sun Jan 21, 2018 2:03 pm
The question in the OP specified "in windows".
Quite so. Obviously, all of the "But I can run Linux on Windows; I do it all the time!" posts are cheating.
Running the x86 version of the Raspbian desktop in VirtualBox under Windows simply to edit the files on an SD card seems like too many layers of software; however, x86 hardware has been tuned for this kind of virtualization for about 10 years. That is, of course, if you ignore the recently discovered Meltdown and Spectre bugs.

Heater
Posts: 9461
Joined: Tue Jul 17, 2012 3:02 pm

Re: SD card boot config question

Sun Jan 21, 2018 10:49 pm

Yep. It's a lot of layers. Windows is such a useless operating system that you need them to get anything done.

Perhaps the inverse solution would be better. Boot Linux and run Windows in a VM. One day you might realize you have not used Windows for months and just delete it all.

Or just use the Paragon extfs driver for Windows solution.

User avatar
DougieLawson
Posts: 33311
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: SD card boot config question

Sun Jan 21, 2018 11:15 pm

Or build an SDCard with Raspbian (using Etcher) boot your RPi with that. Mount the wonky SDCard in a USB reader and use a familiar Linux system to fix your Linux problems.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
PiBakery
Posts: 13
Joined: Sat May 21, 2016 4:55 pm
Location: Edinburgh
Contact: Website

Re: SD card boot config question

Thu Feb 01, 2018 2:30 am

n67 wrote:
Sun Jan 21, 2018 7:37 am
Currently, the "Pi Baker" system (which runs, I believe, only on Macs) does something like this. As I understand it, Pi Baker involves modifying the image so that a script on the FAT partition (the only one normally accessible by Mac or Windows) will be run on first boot of the Pi. I've never used PB, but my guess is that it (the custom script produced by the PB system) runs out of rc.local (on the Pi). All of this implies that for each new release of Raspbian this special modification must be done by the PB maintainer(s), in order to keep up.
This is basically exactly how PiBakery works. I take the standard Raspbian image, modify it slightly so that it looks for and runs a script on the FAT32 partition (check out the pibakery-raspbian GitHub repo to see what files I add/change), and then this image is used by the PiBakery app.

It's definitely not the perfect solution and there are ways that it could be improved, but for now it seems to be one of - if not the only - solution to customise Raspbian installations from Windows and Mac without installing a multitude of programs and systems (FUSE, Linux subsystem, virtual machines, ext2fsd, etc...) that make it possible without a modified image.
PiBakery - The easiest way to setup a Raspberry Pi
www.PiBakery.org
@PiBakery

Return to “General discussion”

Who is online

Users browsing this forum: Google [Bot], W. H. Heydt and 59 guests