timmyg
Posts: 1
Joined: Fri Jan 11, 2019 6:09 pm

copying file from /boot

Wed Apr 24, 2019 10:13 pm

Hi - I have an environment file that I would like to copy over during startup, preferably into /home/pi. I know how to copy the file via a systemd service, but the issue is that the file isnt visible in /boot. I am putting a file named environment.txt into the /boot directory (next to wpa_supplicant and ssh files) but when I plug in my pi and ssh into it and look at the /boot file, I dont see the environment.txt file there.

What am I doing wrong? Is there a better way to do this? I know I can put the file in there manually but I would like to not have to ssh in to do so.

Thanks in advance!

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

Re: copying file from /boot

Thu Apr 25, 2019 2:36 pm

Welcome to the Raspberry Pi forums.

What Operating System is running on your RPi?

And was it installed by directly 'flashing' an image of the Operating System to your microSD card, or did you use the NOOBS Installer? (My hunch is that you used the latter... )

tpylkko
Posts: 382
Joined: Tue Oct 14, 2014 5:21 pm

Re: copying file from /boot

Thu Apr 25, 2019 7:32 pm

if you install with noobs, you will have many boot partitions, one of noobs and one for each linux distro you install.

i am not sure i understand what you are doing

the better way to do it is either using scp (cp over ssh) or just copy paste (if it is a small amount of text). that is ssh in, open an editor like nano or leafpad (if you are using X forwarding with ssh (that is "ssh -X" ) and copy paste the content into it and save it to where ever you want. doinf it this way you don't need to remove the card at all.

you can also consider using a symlink

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: copying file from /boot

Thu Apr 25, 2019 9:40 pm

timmyg wrote:
Wed Apr 24, 2019 10:13 pm
Hi - I have an environment file that I would like to copy over during startup, preferably into /home/pi. I know how to copy the file via a systemd service, but the issue is that the file isnt visible in /boot. I am putting a file named environment.txt into the /boot directory (next to wpa_supplicant and ssh files) but when I plug in my pi and ssh into it and look at the /boot file, I dont see the environment.txt file there.

What am I doing wrong? Is there a better way to do this? I know I can put the file in there manually but I would like to not have to ssh in to do so.

Thanks in advance!
You put the file at the root level of the SD card and not in a folder /boot
The root level of the SD card becomes /boot only after the SD is mounted by the OS when booted by the RPi.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

Return to “General discussion”