Install Void Linux onto a USB Stick

From Void Linux Wiki
Jump to: navigation, search

If you want a full blown Void Linux OS on a USB Stick to give to your friends or for yourself. Then you've come to the right place.

It can be installed in a USB as little as 8Gb, and 4Gb should be sufficient too, but keep in mind we want a usable Linux installation, we may will need at least 8Gb. This guide is not recommended to new users.

Some advantages and tips before we get started: 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
  Notice: 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 

Install Void Linux onto a USB Stick


First create the partitions on your USB Stick, using your favourite method. One for the system, and the other for your swap drive. Create a new file system on root to work with. Same applies to /swap

  Important note: 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
  For advance users: you 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, 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.
  -S is used to sync with the repositories.- -R to specify the repository. -r to specify the target
  sudo xbps-install -S -R -r /void base-system xorg ipw2100-firmware ipw2200-firmware inetutils dhclient 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

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

Change the shell to bash to easy the further usage


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 you can edit your fstab to make entries to your partitions here. Using Either UUID, or old school, /dev/sdxx method. UUID would be a preferred if you intend on using it everywhere, here it was not used to ease the exemplification.

Make your entries now. 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 by hand, or just shoot it into your file.

  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 user to the groups needed, you can add more groups to suit your needs.

  usermod -aG wheel,storage,network,audio userName
  nano /etc/sudoers

Uncomment only one wheel to get sudo privileges

  nano /etc/sudoers

Uncomment 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 Void Wiki Page to do that. But, Basically, All I've had to do what, 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 in this case. Be careful where you install it! Double check the direction!

  grub-install /dev/sdd
  grub-mkconfig -o /boot/grub/grub.cfg

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