Install Void Linux onto a USB Stick
If you want a full blown Void Linux OS on a USB stick to give to your friends or for yourself, then you have come to the right place.
Void can be installed in an USB stick as little as 8Gb, and 4Gb should be sufficient too, but keep in mind that for an usable Linux installation you may need at least 8Gb. This guide is not recommended to new users.
Having a portable system which behaves as a normal installation is specially aimed towards mobility, security, backup plan and sharing. A -musl installation will require a bit less space and less memory, however, musl is still not fully working with some important packages, so keep that in mind (the
-musl installation requires a modification in the steps to follow, which won't be explained).
First, create the partitions on your USB stick using your favourite method. One for the system, and the other for swap. Create a new filesystem on root to work with. Same applies to
/swap partition is specially recommended if you may need to use older systems with heavy loads; do not worry about the USB's internal degradation, Linux tries to use
/swap as little as possible.
Advanced users can very easily adapt this installation process to have an encrypted
/root system, just remember to create a separate
Now we need to create a directory in which we will be mounting and working with our USB:
# mkdir /mnt/void
Remember to use the correct device address when mounting.
fdisk -l will give you the correct address:
$ sudo blkid /dev/sdd1: UUID="1ef89660-45dc-49b2-b16b-c4fb74903dd4" TYPE="ext4" PARTUUID="3f012745-01" /dev/sdd2: UUID="2e925665-7ffe-489d-ad9c-6ab2c8809aea" TYPE="swap" PARTUUID="3f012745-02"
Now mount your
/root partition to
/mnt/void. Here we will be using
/dev/sdd1 as our
root install. We can also activate the swap now.
# mount /dev/sdd1 /mnt/void # swapon /dev/sdd2
Before installing the base-system, you will have to decide what more you want to install on your OS before going ahead with this installation. Things like your video driver, desktop, method of gaining Internet access, and utilities you love to use. They all can be added during this part of your install, or afterwards. This install is for Fluxbox, with basic utilities: Internet connection, alsa sound system, Firefox, video player, file access, etc... Suit this section to your own specific needs.
In the following (long) instruction, -S is used to sync with the repositories, -R to specify the repository and -r to specify the target:
$ sudo xbps-install -S -R https://alpha.de.repo.voidlinux.org/current -r /mnt/void base-system xorg ipw2100-firmware ipw2200-firmware inetutils dhclient AlsaMixer.app alsa-tools alsa-utils nano volumeicon Thunar pcmanfm gvfs adwaita-icon-theme terminator mplayer gkrellm file-roller polkit gparted dbus pavucontrol firefox xterm usbutils menumaker usbmuxd grub wireless_tools fluxbox
Extra recommended applications: NetworkManager, network-manager-applet, lxdm, cgmanager, ConsoleKit2.
Now to prepare to mount the system to chroot into we run these commands:
$ sudo mount --rbind --make-rslave /dev /mnt/void/dev $ sudo mount --rbind --make-rslave /proc /mnt/void/proc $ sudo mount --rbind --make-rslave /sys /mnt/void/sys $ sudo chroot /mnt/void
Change the shell to bash to easy the further usage
Change the root password:
# passwd root
# chown root:root / ; # chmod 755 / ;
Change your HOSTNAME to whatever you want:
# echo "USB8Void64Linux" > /etc/hostname ;
Your system should boot without error without you editing your
fstab file, but it is still needed before you continue using your USB stick. If you want to, you can edit your
fstab to make entries for your partitions, using either UUID or the old school /dev/sdxx method. UUID would be preferred if you intend on using it everywhere, here it was not used to ease the exemplification.
Make your entries now, then save and exit nano:
# nano /etc/fstab /dev/sdd1 / ext4 defaults,noatime 0 1 /dev/sdd2 none swap sw 0 0
Now edit your libc-locales to set your
locale. Either do it by hand, or just shoot it into your file, e.g.
# nano /etc/default/libc-locales
# echo en_US.UTF-8 UTF-8 >> /etc/default/libc-locales
Rebuild the locales:
# xbps-reconfigure -f glibc-locales
initramfs through dracut:
# echo hostonly=yes > /etc/dracut.conf.d/hostonly.conf # xbps-reconfigure -f linux*
Add a user to your system besides root:
# useradd username # passwd username
Add that user to the groups needed, you can add more groups to suit your needs:
# usermod -aG wheel,storage,network,audio userName
/etc/sudoers with visudo and uncomment only one wheel to get sudo privileges. Uncomment the following line to allow members of group wheel to execute any command:
%wheel ALL=(ALL) ALL
Same thing without a password:
%wheel ALL=(ALL) NOPASSWD: ALL
For NetworkManager, and other methods that can be used, you can find more on this wiki to do that, but basically all you have to do is install NetworkManager - cgmanager - ConsoleKit2 and start them at boot. Link then to
# ln -s /etc/sv/dbus /var/service # ln -s /etc/sv/dhcpcd /var/service # ln -s /etc/sv/alsa /var/service # ln -s /etc/sv/udevd /var/service # ln -s /etc/sv/uuidd /var/service
Installing the bootloader
In this case we will use
grub as the bootloader. Be careful where you install it! Double check the direction!
# grub-install --removable /dev/sdd # grub-mkconfig -o /boot/grub/grub.cfg
If everything was done correctly, you can exit and reboot into your new Void installation!
See Post-installation to further develop your system to what you want.
Welcome to the Void.