Debian Installer and copy files

Help with issues regarding installation of Debian

Debian Installer and copy files

Postby wlnx » 2019-11-15 00:23

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
wlnx
 
Posts: 2
Joined: 2019-11-15 00:00

Re: Debian Installer and copy files

Postby Head_on_a_Stick » 2019-11-16 19:42

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?
Don't break DebianHow to report bugs

SharpBang GNU/Linux® — a pre-configured Openbox/Tint2 desktop running on Debian stable
User avatar
Head_on_a_Stick
 
Posts: 10695
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Debian Installer and copy files

Postby wlnx » 2019-11-17 11:48

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.
User avatar
wlnx
 
Posts: 2
Joined: 2019-11-15 00:00


Return to Installation

Who is online

Users browsing this forum: arzgi, Kenshin Himura and 8 guests

fashionable