How to get back the raspi config in startup?


16 posts
by Pascal » Thu Jan 03, 2013 5:55 pm
I have made a backup of my image and wount to copy it to another sdcard for my brothers.
But for them i want to place back the raspi config just like the image what we can download from here.
I mean if you put the image from here on your sdcard you get at startup the raspi config, can i do that also in my backup image for my brothers so they see also the raspi config at startup?
Posts: 70
Joined: Sat Oct 20, 2012 7:23 am
by ghans » Thu Jan 03, 2013 6:21 pm
Why don't you image their SD Card with the official download ?
Should be the same effort like using your backup.

A
Code: Select all
 
sudo raspi-config

should work at any time.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Posts: 3895
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany
by gragib » Fri Jan 04, 2013 5:23 pm
If you are using Windows, you can do it in Win32DiskImager. On your Windows machine, insert the SD card you want to backup, chose a backup location in the Image File input box, and click Read. This will create an image file of the SD card.

On a Linux box, your should be able to use the dd command with the appropriate flags to create a disk image for backup and cloning.
Posts: 99
Joined: Sat Dec 22, 2012 8:09 pm
Location: Calgary, AB, Canada
by pjc123 » Sat Jan 05, 2013 1:16 pm
I can definitely see the point of what the OP is trying to do with a scenario similar to the following. If he/she made many changes to the original image (New software, config settings, etc) and wants it to look the same for the brother, making a new image and reloading all that does not make sense, so a backup image is the way to go. Now the brother may need a different configuration at bootup (For instance, maybe he was adopted from Russia and needs a different keyboard layout), so it is required to see the config screen immediately at boot. Therefore it is necessary to find the code that loads at boot (but only once) and add it to the new image.

Of course, if such a specific scenario is not needed and the config can be run at any time, as was mentioned, just running raspi-config at any time after being booted would be a much easier solution.
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm
by Burngate » Sat Jan 05, 2013 2:12 pm
So what (& where) is in the original image, that runs once and is then deleted?

I presume a script that deletes itself
User avatar
Posts: 2325
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
by pjc123 » Sat Jan 05, 2013 2:24 pm
Burngate wrote:So what (& where) is in the original image, that runs once and is then deleted?

I presume a script that deletes itself


That is correct. It either self destructs or looks at another parameter in the filesystem such as time stamps, or maybe a proc parameter, or config file change to know whether it should run again. I am kinda curious how it works as well.
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm
by Burngate » Sat Jan 05, 2013 3:13 pm
I'd have a look myself, but by the time I've booted into it, it's already gone!

The only cunning plan I've come up with is to put a freshly installed SD card into a USB card reader, then look to see what's gone missing from it compared to the booted card.
User avatar
Posts: 2325
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
by Joe Schmoe » Sat Jan 05, 2013 3:26 pm
I think we are all missing the obvious here.

You can certainly run raspi-config after the initial time - and I'm 99.87% sure that nothing is deleted (nothing substantive, that is - see below). All you have to do is to run (as root) the command "raspi-config".

Re: Does anything get "deleted": Well, I suppose they set some kind of flag or something so that raspi-config is automatically run on the first boot - and that that flag is cleared after that first run. But, again, as stated, you can run it anytime you want to after that.
Never answer the question you are asked. Rather, answer the question you wish you had been asked.

- Robert S. McNamara - quoted in "Fog of War" -
Posts: 2246
Joined: Sun Jan 15, 2012 1:11 pm
by pjc123 » Sat Jan 05, 2013 4:22 pm
Joe Schmoe wrote:I think we are all missing the obvious here.

You can certainly run raspi-config after the initial time - and I'm 99.87% sure that nothing is deleted (nothing substantive, that is - see below). All you have to do is to run (as root) the command "raspi-config".

Re: Does anything get "deleted": Well, I suppose they set some kind of flag or something so that raspi-config is automatically run on the first boot - and that that flag is cleared after that first run. But, again, as stated, you can run it anytime you want to after that.


No we are not missing anything, that is exactly what we a saying. A script is either deleted or made inactive and the raspi-config executable is never touched and can still be run at any time.

Burngate wrote:I'd have a look myself, but by the time I've booted into it, it's already gone!

The only cunning plan I've come up with is to put a freshly installed SD card into a USB card reader, then look to see what's gone missing from it compared to the booted card.


I was thinking the same thing. Too bad I am too lazy to do it.
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm
by Burngate » Sat Jan 05, 2013 5:57 pm
Joe Schmoe wrote:... as stated, you can run it anytime you want to after that.

Not the point. How did the Grand Masters of the Raspbian Universe get it to run on first boot? Intellectual noseyness.
pjc123 wrote:... Too bad I am too lazy to do it.

Me too ;)
User avatar
Posts: 2325
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
by SimonSmall » Sat Jan 05, 2013 8:32 pm
The full path of the raspi-config file is "/usr/bin/raspi-config.sh" and that is the file that is run when you type "raspi-config" at the prompt. If you look at the contents of this file, there is a line that deletes "/etc/profile.d/raspi-config.sh". There are also lines that modify "/etc/inittab" (not too sure what, as I don't have the un-modified file)

When the Raspberry Pi starts it runs "/etc/inittab" and the files in "/etc/profile.d"

You could copy "/usr/bin/raspi-config.sh" to "/etc/profile.d/raspi-config.sh", then reboot and see if the raspi-config script runs. I am not sure that this is the case, and don't want to risk my SD card to check it. You (or someone else) probably need to do a bit more investigation, and need to understand what the lines in raspi-config actually do

You need to backup your card, in case it does not boot if you do this, or use one that you can replace :D
Posts: 200
Joined: Tue Oct 09, 2012 8:13 pm
by Joe Schmoe » Sat Jan 05, 2013 8:37 pm
Where are you getting this notion of a ".sh" extension from?
Never answer the question you are asked. Rather, answer the question you wish you had been asked.

- Robert S. McNamara - quoted in "Fog of War" -
Posts: 2246
Joined: Sun Jan 15, 2012 1:11 pm
by SimonSmall » Sat Jan 05, 2013 9:03 pm
I don't have access to my Pi, but searched on the internet for the location and contents of the raspi-config file. The file in /etc/profile does have the .sh extension, I cut and pasted the filename into my post; the file in /usr/bin might not have the extension

I was trying to respond to the speculation about "magic". There is a file that runs on first-start, which is deleted. No magic, just simple
Posts: 200
Joined: Tue Oct 09, 2012 8:13 pm
by SimonSmall » Sun Jan 06, 2013 5:11 pm
This set my curiosity running wild, so I have done as suggested by Burngate - I had a spare SD card that I have loaded with Raspian, and have plugged it into a USB adaptor on the R-Pi using my other SD card

I have put the answer (it is a bit detailed) on the wiki (http://elinux.org/RPi_raspi-config#First-boot_activity), but it is as I suggested above. A script is run on first boot, then deleted.
Posts: 200
Joined: Tue Oct 09, 2012 8:13 pm
by Burngate » Sun Jan 06, 2013 5:32 pm
Nice one :)
Thankyou
User avatar
Posts: 2325
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
by pjc123 » Sun Jan 06, 2013 7:57 pm
See, I knew we could get someone else to do the work !
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm