This note is a kind of improvement over its earlier version at
muwlgr.dreamwidth.org/48219.html .
I created a Windows10 installation media on a 64GB(57.7GiB) USB flash drive, where I still had >40GB of free space even after copying lots of additional useful software and drivers there.
The FAT32 volume contains EFI folder with all needed subfolders for UEFI/SecureBoot booting.
As well it has some boot code for BIOS/CSM systems not supporting UEFI.
I plug the USB drive into a running Debian 13 system, mount it as
/media/someone/ESD-USB and
cd into this folder in
bash shell.
All the following operations are done within this folder
Note, with this setup, your linux folder is going to take at least 8 GB of storage space, most probably, closer to 9..10GB on the FAT volumeLater update: I moved most scripts into my GitHub repository to avoid repelling the reader with vast code blankets.
More explanations on how they work you may read in the follow-up article at muwlgr.dreamwidth.org/54809.html.
So, what is left to do now, is :
( cd /tmp
wget https://raw.githubusercontent.com/muwlgr/scripts/refs/heads/main/debootstrap/populate.sh )
. /tmp/populate.sh
You may be asked about re-creating ext4 fs over already-initialized loop image.
Also you will be asked to set a new host name for a newly-
debootstrapped system.
Then a root session will be started in the chroot of
debootstrapped system.
And you will be asked (in
green text) to run this :
. root/complete-stable.sh
You will need to confirm a number of
apt installs and
removes, as well as select your preferred
locales, time zone and console font.
After the above steps, you should have a well configured Debian system, taking up to
600MB or
15..16% of
4GB root filesystem space
and needing only to add a first user with
sudo rights, in Ubuntu style, that is, without
root password :
# the script will ask you in green text to do the following :
u=user # choose your preferred name
adduser $u # set your password and other details
adduser $u sudo # give this user sudo permissions
Now type
exit # wait for umounts ; paste the following commands separately
sudo umount -v $target
cd
umount -v $base
and try booting this newly-created system on a real or virtual hardware.
If your UEFI BIOS does not recognize Debian boot loader and only boots Windows instead, plug your USB back into the original host system, mount it,
cd into its root folder in
bash shell and do this:
[ -d efi ] && { cd efi
[ -d boot ] && mv boot ms-boot
cp -av debian boot
cd boot
cp -av shimx64.efi bootx64.efi
} Umount and remove the USB media, plug it into the desired system and try booting again.
If you want to restore Windows bootability, rename
boot into
deb-boot , and
ms-boot back into
boot .
Or you might meet a sane BIOS capable of recognizing multiple boot loaders in one UEFI ESP
See
wiki.debian.org/UEFI and search for
bootx64 in this page to learn more about this unpleasant topic.
Below some useful next steps are described :
Suppose you have been able to log in to the booted system as the user you have added before.
Ensure that you can run
sudo id , enter your password and see
uid and
gid equal to
0, which means that
sudo gives you
root access.
If you have booted on some new/unfamiliar hardware, take a moment to review the printout of
sudo dmesg | grep -i firm to see whether any drivers were unable to find their firmware files.
If you see messages about missing firmware files, find them using
packages.debian.org and install needed packages using
apt installYou may also want to install some useful packages to bring more familiar experience to yourself
(add sudo and eatmydata before apt install as needed - useful if your USB flash drive is slow on writes) :
bash-completion to improve
Tab completion in bash command line;
command-not-found to automate searching for not yet installed packages;
man-db to read invaluable documentation within your running system;
openssh-server to access your system remotely;
rsync to optimally copy local and remote files over the network (works over ssh);
nmap and
tcpdump to scan and diagnose your network, to discover its resources;
icewm xdm xorg xterm to get basic GUI environment in which you may run other GUI software
x11vnc to provide remote access to your locally-running GUI session
And/or
xvfb to run GUI applications in headless mode (works over ssh port forwarding) and access them by
x11vnc as well
Or maybe
xpra.org to get more advanced remote access to persistent headless GUI applications (also works over ssh)
pciutils usbutils lshw smartmontools to discover, enumerate and learn more about the available hardware and its operation statistics
sysstat iotop to monitor storage i/o and its statistics, a useful addition to
ps,
top and
vmstat from
procps package
iw rfkill wireless-tools wireless-regdb wpasupplicant to take control over your WiFi adapter
(already installed by the complete-stable script)hostapd instead of
wpasupplicant to turn your computer into a WiFi access point and router (ensure it has more than 1 network interface)
dkms to build out-of-kernel modules for your VGA or WiFi hardware
module-assistant for even better automation of the preceding task
You may be walking around with your bootable USB drive, plugging it into various computers, booting, logging in and trying to access the Internet.
Your
systemd-networkd is configured for dynamic IP allocation for
en* and
wl* interfaces (see it by running
grep . /etc/systemd/network/*.network ).
For
en* interfaces everything should work as expected, just run
ip a to see your allocated address.
For
wl* interfaces there is additional configuration using
wpa_supplicant.
First, a script in
/root/wpa-networkd.sh to start
wpa_supplicant for every found
wl* interface; see its source at
github.com/muwlgr/scripts/blob/main/wpa/wpa-networkd.sh.
Next, a short udev rule in
/etc/udev/rules.d/99-wpa-wl.rules to start this script; see its source at
github.com/muwlgr/scripts/blob/main/wpa/99-wpa-wl.rules.
It is attached to
ACTION=="move" since
udev usually renames (moves) the network interface the kernel initially names
wlan0 after successful module and firmware loading.
May be it is worth to attach it to
ACTION=="add" instead, testing will show.
If you see a wl* interface in ip a printout (with flags NO-CARRIER and UP), run sudo systemctl status | grep wpa and ensure you see wpa_supplicate@wl... service running for this interface.
Then you are ready to learn a minimal bit of knowledge on using wpa_cli :
Run it as
root :
sudo wpa_cli , and you will enter its command line with
> prompt
Run
scan and after some pause
scan_results to see discovered wireless networks
Run
add_network and remember the number of a newly-created empty network (denote it as
N)
Run
set_network N ssid "WiFiNetName" and
set_network N psk "WiFiNetPassword" to set some name and password known to you for this network
Run
enable_network N to let
wpa_supplicant connect to this network
Run
list_networks to see if you are connected to any network (marked
[CURRENT])
Run
save_config to save your updated network list
Run
exit or type
Ctrl+D to exit
wpa_cli and return back to your shell
Then run
ip a to see what addresses your interface had received.
wpa_cli together with systemd-networkd allow you to use your wireless interfaces without heavyweight management tools such as NetworkManager