Do you want to have absolute disk speed nowadays, don't you? Let's revise how it could be done with versioning and automation in 2018.
From the moderator: we received an article in English in the Sandbox. We read it and decided to publish it as a Friday experiment. Do not judge strictly, all peace and happy Friday! Let's come together! In short, from the bottom of the office of aua hearth.
/dev/sdb
to any else ( /dev/sdd
)/root/Projects/debirf/
to your choice ( /home/username/Documents/debirf
)/media/root/8B46-1189
to /media/username/myflashdrive
They are (optional) enable non-free components for basic installation. In addition, I think you will need a non-free repository.
/usr/bin/debirf
like nano +107 $(which debirf)
create_debootstrap
local OPTS="
--components main,contrib,non-free
in bracketsLet's imagine our flash drive:
/media/root/8B46-1189
./root/Projects/debirf/
apt-get install -yq debirf mtools genisoimage
mkdir -p /root/Projects/debirf tar xzf /usr/share/doc/debirf/example-profiles/rescue.tgz -C /root/Projects/debirf cd /root/Projects/debirf/rescue
DEBIRF_LABEL="debirf-rescue" DEBIRF_SUITE=stretch DEBIRF_DISTRO=debian DEBIRF_MIRROR=http://ftp.ru.debian.org/debian/
debirf make .
and go away. It need many time, at minimum 15 minutes on top hardware.debirf makeiso .
for create not working iso (needed for grub.cfg file)apt-get install -yq qemu
brew install qemu
-smp 1
1 real kernel-m 1G
1G memory-nographic
will launch VM in current terminal window--enable-kvm
enables hardware accelation-kernel vmlinuz-*
permit directly pass kernel-initrd *.cgz
direct access to .cgz file with initramfs-append
allows bypass kernel params,The command to start the virtual machine:
qemu-system-x86_64 --enable-kvm -kernel vmlinuz-* -initrd *.cgz -append "console=tty0 console=ttyS0,115200n8" -m 1G -smp 1 -net nic,vlan=0 -net user -nographic
I recommend you use bios legacy boot and package grub-pc. Not tested with UEFI, but must work. Next lines will be do:
mkdir -p /media/root/8B46-1189 mount /dev/sdb1 /media/root/8B46-1189 grub-install --boot-directory=/media/root/8B46-1189/boot /dev/sdb cp /root/Projects/debirf/rescue/iso/boot/grub/grub.cfg /media/root/8B46-1189/boot/grub/ cp /root/Projects/debirf/rescue/*.cgz /media/root/8B46-1189 cp /root/Projects/debirf/rescue/vmlinuz-* /media/root/8B46-1189 umount /media/root/8B46-1189 rm -rf /media/root/8B46-1189
mkdir -p rescue/iso/isolinux/ wget -O rescue/iso/isolinux/isolinux.bin 'http://mirror.yandex.ru/centos/7/os/x86_64/isolinux/isolinux.bin' cat << EOF > rescue/iso/isolinux/isolinux.cfg TIMEOUT 5 DEFAULT lir LABEL lir LINUX /vmlinuz-4.9.0-7-amd64 INITRD /debirf-rescue_stretch_4.9.0-7-amd64.cgz EOF genisoimage -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -l -input-charset default -V LiR -A "Linux in RAM" -o rescue/rescue.iso rescue/iso/
apt-get install -yq qemu
qemu-system-x86_64 -enable-kvm -m 512 -hda /dev/sdb
-enable-kvm
Module - executable sh script for running during LiR creating
#DEBIRF_PACKAGE>+
$DEBIRF_ROOT
debirf_exec
cat <<< EOF > rescue/modules/mi #!/bin/sh -e # debirf module: mi # prepare to run on mi notebook # # This script were written by # Eduard Generalov <eduard@generalov.net> # # They are Copyright 2018, and published under the MIT, #DEBIRF_PACKAGE>+firmware-iwlwifi #DEBIRF_PACKAGE>+firmware-misc-nonfree #DEBIRF_PACKAGE>+wpasupplicant echo 'iwlwifi' >> $DEBIRF_ROOT/etc/modules cat << EOF > $DEBIRF_ROOT/etc/wpa_supplicant/wpa_supplicant-wlp1s0.conf ctrl_interface=/run/wpa_supplicant update_config=1 network={ ssid="WiFi_SSID" psk="WIFIPASSWORD" } EOF cat << EOF > $DEBIRF_ROOT/etc/systemd/network/wireless.network [Match] Name=wlp1s0 [Network] DHCP=ipv4 [DHCP] RouteMetric=20 EOF
and replace line with resolved
rescue / modules / network with debirf_exec systemctl enable wpa_supplicant@wlp1s0.service systemd-networkd.service systemd-resolved.service
module rescue / modules / lxc
#!/bin/sh -e # debirf module: lxc # prepare lxc # # This script were written by # Eduard Generalov <eduard@generalov.net> # # They are Copyright 2018, and published under the MIT, #DEBIRF_PACKAGE>+lxc mkdir -p $DEBIRF_ROOT/root/.ssh/ ssh-keygen -b 2048 -t rsa -f $DEBIRF_ROOT/root/.ssh/id_rsa -q -N "" cp $DEBIRF_ROOT/root/.ssh/id_rsa $DEBIRF_ROOT/root/.ssh/authorized_keys chmod 400 $DEBIRF_ROOT/root/.ssh/authorized_keys debirf_exec systemctl enable lxc-net cat << EOF > $DEBIRF_ROOT/etc/lxc/default.conf lxc.network.type = veth lxc.network.link = lxc lxc.network.name = eth0 lxc.network.flags = up lxc.network.hwaddr = 00:FF:AA:FF:xx:xx lxc.mount.entry=/var/cache/apt var/cache/apt none bind,rw 0 0 lxc.mount.entry = /root/.ssh/ root/.ssh none bind,create=dir 0 0 EOF cat << EOF > $DEBIRF_ROOT/etc/default/lxc-net USE_LXC_BRIDGE="true" LXC_BRIDGE="lxc" LXC_ADDR="10.0.3.1" LXC_NETMASK="255.255.255.0" LXC_NETWORK="10.0.3.0/24" LXC_DHCP_RANGE="10.0.3.2,10.0.3.254" LXC_DHCP_MAX="253" LXC_DHCP_CONFILE="" LXC_DOMAIN="lxc" EOF
Source: https://habr.com/ru/post/420501/
All Articles