Warning: THE VOID WIKI IS DEPRECATED. It is no longer being maintained, contains outdated and incorrect information, and will eventually be shut down. Please refer to the Void Handbook, https://docs.voidlinux.org/, for the official documentation. If you can't find the information you're seeking, please raise an issue at https://github.com/void-linux/void-docs/issues

Difference between revisions of "Install Void Linux onto a USB Stick"

From Void Linux Wiki
Jump to navigation Jump to search
(Style guide, typos, enhanced readability by reducing styling, suggested Visudo to edit /etc/sudoers instead of nano.)
m (Added Category:Installation)
Line 137: Line 137:
Welcome to the Void.
Welcome to the Void.

Revision as of 01:52, 25 August 2017

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).

Tip: Just after login type bash to ease the installation progress. Void uses dash as the default /bin/sh.
Note: If you are going to use anything different from ext* then we strongly recommend that you create a separate /boot partition. This is a good practice in any case nonetheless.


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. A /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 /boot partition.


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. blkid or 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.

Note: If you are going to use this USB in a variety of computers, it is recommended that you install all the drivers and firmware possible, in that case the probabilities of a piece of hardware failing will decrease. Also, keep your system updated, remember that Void is a rolling release distro.

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 http://repo3.voidlinux.eu/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 inetutils fluxbox

Extra recommended applications: NetworkManager, network-manager-applet, lxdm, cgmanager, ConsoleKit2.

Changing root

Now to prepare to mount the system to chroot into we run these commands:

$ sudo mount --rbind /dev /mnt/void/dev
$ sudo mount --rbind /proc /mnt/void/proc
$ sudo mount --rbind /sys /mnt/void/sys
$ sudo chroot /mnt/void

Change the shell to bash to easy the further usage

$ bash

System configuration

Change the root password:

# passwd root

Change permissions:

# 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,nodiratime,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

Configure your 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

Now edit /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:


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 /var/service:

# 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 /dev/sdd
# grub-mkconfig -o /boot/grub/grub.cfg

If everything was done correctly, you can exit and reboot into your new Void installation!

Post install

See Post-installation to further develop your system to what you want.

Welcome to the Void.