Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Debian Installer and copy files

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
User avatar
wlnx
Posts: 2
Joined: 2019-11-15 00:00

Debian Installer and copy files

#1 Post by wlnx »

Hello.
I got a point of interest, but Google and mans couldn't help. Either they don't know or I ain't able to understand. :roll:
I try to preseed Stretch, one of tasks is to copy some stuff from installation media during setup. The stuff is as large as 15 GB, thus I'd like to avoid wget.
I found three places to run cp in preseed, but all of them are a bit out of point:
preseed/early_command and partman/early_command are run before partitioning.
preseed/late_command is run after installation media is unmounted.
Thus, I cannot cp from installation media to new system because there's no place where both of them are accessible.
Now I Alt+F2 and run commands by hands while setup does it's magic, but the way doesn't seem to be unattended.
Did someone do something like this? Maybe you can help me with my task?
Thanks in advance. :wink:

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Debian Installer and copy files

#2 Post by Head_on_a_Stick »

I've not tried this but does copying the files to /tmp as an early_command then copying it out again as a late_command work?
deadbang

User avatar
wlnx
Posts: 2
Joined: 2019-11-15 00:00

Re: Debian Installer and copy files

#3 Post by wlnx »

Head_on_a_Stick wrote:I've not tried this but does copying the files to /tmp as an early_command then copying it out again as a late_command work?
Well... As there is no storage available at the moment of early_command, root is mounted as a kind of ram-disk.
I tried your advice and can confirm: while my VM had 4 GB of RAM, "cp -R /cdrom/10GBdir /tmp/" made busybox totally unusable ("cannot fork" error on any command), and after I increased RAM to 16 GB the same cp worked like a charm.
Thus I cannot transfer stuff this way if it is greater than RAM size.

But your idea helped me.

First of all, I disabled disk eject.

Code: Select all

d-i cdrom-detect/eject boolean false
Than I saved mountpoint at partman/early_command:

Code: Select all

d-i partman/early_command string \
    mount | grep 'iso9660' | sed 's/\(.*\)\son\s\(.*\)\stype.*/\1 \2/' > /tmp/mnt.dd
It was unexpected for me, but there is no cdrom mounted at preseed/early_command stage.
And, after all, I mounted back the installation disk and copied all I needed:

Code: Select all

d-i preseed/late_command string \
    mount `cat /tmp/mnt.dd`; \
    media=`sed 's/.*\s\(.*\)/\1/' /tmp/mnt.dd`; \
    cp -R $media/somestuff /target/srv; \
    umount $media; \
    unset media
Mission accomplished, thanks.

Post Reply