Installing Astra Linux (or any other Linux) in a vhd file on a computer with windows installed + installing usb wi-fi

We continue the week of “adoring linux on Habré”, but not in the style of “Linux is freedom, Linux is promising” https://habr.com/ru/companies/gnivc/articles/746104/ https://habr.com/ru /articles/746064/ , and we take the keyboard and mouse in our hands, and we begin to install this Linux of yours on your computer with your favorite Windows.

Why is it necessary:

1. Linux runs on a physical machine, not a virtual machine, so there is no loss in efficiency.

2. One vhd/vdi file can be loaded in both Legacy BIOS mode and UEFI mode.

3. Linux doesn’t need a disk or partition, just a file. For example, Windows is your primary OS and you put several Ubuntu/Debian/Arch… files in their own VHD file on C:\. You can download any of them however you want. If you no longer need it, just delete it like a normal file.


Downloading our most Russian AstraLinux https://download.astralinux.ru/astra/stable/2.12_x86-64/iso/alce-2.12.46.6-17.04.2023_15.09.iso

download bourgeois VirtualBox https://download.virtualbox.org/virtualbox/7.0.8/VirtualBox-7.0.8-156879-Win.exe

We put VirtualBox, create a machine, Go to Expert mode

Name – any
ISO image – connect alce-2.12.46.6-17.04.2023_15.09.iso
Linux type
Version – doesn’t matter

Equipment >
specify memory allocation>=2GB (not 1GB, otherwise there will be an Initramfs Unpacking Failed error)
Processors – specify more than 1
turn on the checkbox “Enable EFI (Only special operating systems)” !! MANDATORY !!
(you can set it without a daw, the difference is that with a daw the disk will be marked as GPT, without a daw as MBR and without a daw when loading into EFI, you will have to press ENTER once again (vdiskchain will write that the image is only for Legacy))

Hard disk >
Type VHD (can be VDI no difference)
check the box “Select a place in full size” !! MANDATORY !!
create C:\Astra.vhd file >=10Gb (standard astra installation takes 7.4Gb)
better at the root of the drive, but not necessarily

Starting the installation in VirtualBox
disk partitioning – manually
select SCSI1 sda
create new empty partition table – YES

if you don’t want to bother, then choose auto-layout
or like a real Linuxoid we do everything our own way:
choose free space
select Create new partition
size 10MB
Primary
End
Use as: FAT16 (if you want FAT32, then the disk size should be >=100MB, but for some reason it didn’t boot on my real machine with FAT32, only with FAT16)
Mount point: manually enter /boot/efi
Partition setup completed

choose free space
select Create new partition
ENTER size (maximum)
Primary
Mount options – can be added – discard, noatime, nodirtime
Reserved blocks – 0%
Partition setup completed

Finish partitioning and write changes to disk

No EFI Partitions Found – NO
Did not specify a swap partition – NO (if there is not enough memory on the real machine (<=2Gb), then create a partition)
Write changes to disk – YES

kernel 5.15-generic

The system clock is set to local time !!REQUIRED!! otherwise there will be a difference of 3 hours between linux and windows
Enable autologin to the system (if necessary, you can turn it off in the control panel)

GRUB bootloader – YES !!MUST!!
choose /dev/sda

so you installed astra to GPT with EFI bootloader

now add MBR bootloader
if you do not need to download from Legacy, then you can skip

We load the virtual machine, run fly-terminal
sudo su
apt update
apt install grub-pc-bin

so we added an MBR bootloader

Now we patch astra to boot on a real machine
start terminal:
wget https://github.com/ventoy/vtoyboot/releases/download/v1.0.29/vtoyboot-1.0.29.iso
or look at the newer version https://github.com/ventoy/vtoyboot/releases
7z x vtoyboot-1.0.29.iso
tar -xvf vtoyboot-1.0.29.tar.gz
cd vtoyboot-1.0.29
sudo sh vtoyboot.sh

turn off the virtual machine and check the boot in both MBR and EFI modes
with the “Enable EFI (Special OS only)” checkbox on and off (Settings-> System)

Now we prepare the image for loading on real hardware.
add the .vtoy ending to the vhd file, it will turn out astra.vhd.vtoy !! MANDATORY !!


The easiest way to download astra.vhd.vtoy is to install https://www.ventoy.net/ to a flash drive and run astra.vhd.vtoy from it.

But it is possible to load astra.vhd.vtoy from the Windows bootloader, via Grub4dos, but only in Legacy boot mode.

to download via Legacy
download grub4dos http://dl.grub4dos.chenall.net/grub4dos-0.4.6a-2023-06-10.7z
it is grub4dos-0.4.6a-2023-06-10.7z that the following versions give error c000007b when booting from the Windows bootloader.
in the root of disk C put the grldr file
in the root of drive C put the menu.lst file and add
title Astra.vhd.vtoy
kernel(hd0,1)/ipxe.krn vdisk=/Astra.vhd.vtoy
initrd(hd0,1)/vdiskchain
another variant
kernel (hd0,msdos1)/ipxe.krn vdisk=/Astra.vhd.vtoy
initrd(hd0,msdos1)/vdiskchain

(hd0,msdos1) disk and partition where astra.vhd.vtoy is located

put the vdiskchain and ipxe.krn file along with the astra.vhd.vtoy file
https://github.com/ventoy/vdiskchain/releases/download/v1.3/vdiskchain-1.3.tar.gz

loading Grub4Dos we register in the screw bootloader
in BootIce open bcd file and add RealMode Grub/Linux
specify the partition where grldr is located
change \grldr.mbr to \grldr
reboot – select the grub entry from the menu

or in BootIce, load Grub4Dos on the disk partition itself
select disk – MBR management – GRUB – Installation – 0.4.6a – Save to disk
reboot – F8 / F11 and select the disk on which you installed grub


to boot via UEFI, you need to install another bootloader (grub4dos-for_UEFI, rEFInd, grub2-efi), but it is better to use the SilentSuperBoot (Super-UEFIinSecureBoot-Disk_minimal_v3.zip) or Ventoy bootloaders, there is MokManager and SecureBoot support

put the vdiskchain file along with the astra.vhd.vtoy file
https://github.com/ventoy/vdiskchain/releases/download/v1.3/vdiskchain-1.3.tar.gz

add a new menu item in grub2-efi or another bootloader

menuentry 'Astra' {
	search --no-floppy --file /astra.vhd.vtoy --set root
	chainloader /vdiskchain vdisk=/astra.vhd.vtoy
}

other examples:

==== 2.1 i386-pc ====
grub4dos:
kernel /ipxe.krn vdisk=/MyVdiskDir/Astra.vhd.vtoy
initrd /vdiskchain

GRUB2:
linux16 (hd0,1)/ipxe.krn vdisk=/MyVdiskDir/Astra.vhd.vtoy
initrd16(hd0,1)/vdiskchain

====2.2×86-64-efi====
grub2:
chainloader (hd1,1)/test123/vdiskchain vdisk=/MyVdiskDir/Astra.vhd.vtoy

rEFInd:
loader /vdiskchain vdisk=/MyVdiskDir/Astra.vhd.vtoy

systemd-boot:
efi /vdiskchain vdisk=/MyVdiskDir/Astra.vhd.vtoy


Fixing various bugs:

If it does not run on real hardware in EFI
then boot to another linux for example xubuntu
there the FAT partition should be visible and mounted, if it is not visible, then delete the entire partition and create it again
use blkid to find out the UUID of the new partition and change it in /etc/fstab

mkfs.vfat /dev/sda1

#sed “/boot/efi/d” /etc/fstab > /etc/fstab2
#blkid /dev/sda1 | cut -f2 -d’ ‘ >> /etc/fstab2

#blkid /dev/sda1 | awk ‘{print $2,” /boot/efi vfat utf8 0 0″}’ >> /etc/fstab
#blkid /dev/sda1 | awk ‘{print $3,” /boot/efi vfat utf8 0 0″}’ >> /etc/fstab

UUID=1234-1234 /boot/efi vfat utf8 0 0

If it does not run on real hardware in Lefacy
if it says Waiting for vtoy device…
then you need to defragment the image file Astra.vhd.vtoy

download Defraggler https://www.softportal.com/get-8257-defraggler.html
you can not install the program, but open dfsetup222.exe as an archive (7z or via TotalCommander using Ctrl+PageDown)
there is a utility for defragmenting individual files.
copy df.exe from archive to c:
run in command line
c:\df.exe c:/Astra.vhd.vtoy

The second installation option without a checkbox “Enable EFI (Special OS only)”
the only difference is that when booting on a real machine, you will have to press ENTER again (vdiskchain will write that the image is only for Legacy)
install as well, but now add the EFI bootloader to the FAT partition
if you do not need to boot from UEFI, then you can skip

We load the virtual machine, run fly-terminal
sudo su
apt update
apt install grub-efi-amd64-bin

mkdir -p /boot/efi/efi/boot
cp /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi /boot/efi/efi/boot/bootx64.efi
cp /boot/grub/grub.cfg /boot/efi/efi/boot/

so we added an EFI bootloader to the FAT partition


For Bluetooth to work
apt install blueman fly-admin-bluetooth

Set an empty user password or shorter than 8 characters
sudo usermod -p ” user

Install driver for Nvidia
apt install nvidia-driver-510
or sudo sh astra-nvidia if the card is older than nvida rtx

Install Vine
apt install wine-staging winetricks


We connect different USB WI-FI

=========================

Tp link 150m
0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
Surprisingly, it connects and works

=========================

Chinese 802.11n with red border
0bda:f179 Realtek USB Wireless Adapter Drivers [rtl8188fu]

sudo apt update && sudo apt-get install build-essential git dkms linux-headers-$(uname -r)
git clone https://github.com/kelebek333/rtl8188fu

mcedit ./rtl8188fu/Makefile

CONFIG_POWER_SAVING = n
CONFIG_WIFI_MONITOR=y

sudo dkms add ./rtl8188fu
sudo dkms build rtl8188fu/1.0
sudo dkms install rtl8188fu/1.0
sudo cp ./rtl8188fu/firmware/rtl8188fufw.bin /lib/firmware/rtlwifi/
sudo modprobe rtl8188fu

=========================

Ourlink 300m
0bda:818b Realtek Semiconductor Corp. RTL8192EU 802.11b/g/n WLAN Adapter
RTL8192EU rev B (SMIC) 2T2R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0
Sees networks but won’t connect

sudo apt update && sudo apt-get install linux-headers-$(uname -r) build-essential dkms git
git clone https://github.com/clnhub/rtl8192eu-linux.git
cd rtl8192eu-linux
sudo rmmod rtl8xxxu
echo “blacklist rtl8xxxu” >> ./blacklist-rtl8xxxu.conf
sudo mv ./blacklist-rtl8xxxu.conf /etc/modprobe.d/
sudo dkms add .
sudo dkms install rtl8192eu/1.0
sudo modprobe 8192eu

=========================

Comfast 600Mb
0bda:c811 Realtek Semiconductor Corp. 802.11ac NIC
https://4te.me/post/realtek-8821-linux-driver/
Linux Driver for USB WiFi Adapters that are based on the RTL8811CU, RTL8821CU, RTL8821CUH and RTL8731AU Chipsets

sudo apt update && sudo apt install build-essential git dkms bc iw rfkill

git clone https://github.com/morrownr/8821cu-20210916.git
cd 8821cu-20210916
sudo sh install-driver.sh

==============================

Netgear rtl8812au

sudo apt update && sudo apt install build-essential git dkms bc iw rfkill
git clone https://github.com/gnab/rtl8812au.git
sudo cp -r rtl8812au /usr/src/rtl8812au-4.2.2
sudo apt install dkms
sudo dkms add -m rtl8812au -v 4.2.2
sudo dkms build -m rtl8812au -v 4.2.2
sudo dkms install -m rtl8812au -v 4.2.2
sudo modprobe rtl8812au

==============================

0b05:17eb Asus USB-AC55 Wireless-AC1300
This driver supports Ralink / Mediatek mt766u, mt7632u and mt7612u chipsets.
the driver supports several USB dongles such as Netgear-A6210, ASUS USB-AC55, ASUS USB-N53 and EDUP EP-AC1601

sudo apt-get install git build-essential linux-headers-$(uname -r)
git clone https://github.com/jurobystricky/Netgear-A6210.git
cd Netgear-A6210
make
sudo make install

==============================

If there are many likes, I will add a video with the complete installation process …

(and then you can only minus for nothing ..)

There is a similar article on Habré https://habr.com/ru/companies/domclick/articles/547150/ but my linux did not boot according to this article.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *