SliTaz in a virtual machine
5.1
A virtual machine runs SliTaz in a window, on top of your usual system: try it, test a development image or install it on a virtual disk, without touching your real disks. This page covers QEMU, on GNU/Linux, and VirtualBox, on Windows, macOS or GNU/Linux.
Choose the ISO
Download an image from the Get SliTaz page and check it, see Handbook: Get SliTaz. SliTaz 5.1 comes as seven images:
- base (i486, x86_64): text mode, no desktop;
- core (i486, x86_64): the LXTaz desktop, the system tools and the installer, no web browser;
- core-retro (i486 only): core on the Linux 3.16 kernel, for very old hardware; a modern virtual machine does not need it;
- firefox (i486, x86_64): core plus Firefox and a few applications.
Take x86_64 on a 64-bit host. The x86_64 images boot on BIOS and on UEFI; the i486 images boot on BIOS only.
How much memory
A live system runs from RAM: it takes its unpacked size in memory, on top of what you run. Give the virtual machine at least:
- base: 128 MB on x86_64 (64 MB on i486);
- core and core-retro: 512 MB, 1 GB to browse heavy sites with Toile;
- firefox: 2 GB on x86_64, 1.5 GB on i486.
More memory also makes the boot faster: the whole system is unpacked into RAM before the desktop starts. An installed system runs from its disk and needs much less. See Handbook: Memory.
Virtual hardware that works
- Disk: SATA (AHCI) or IDE. Their drivers are built into the SliTaz kernel. A virtio disk does not boot: its driver is a module, and SliTaz boots without an initramfs to load it.
- Network: an Intel e1000 card (or PCnet in VirtualBox).
- Display: the default card of QEMU or VirtualBox.
- Firmware: BIOS for every image, or UEFI for the x86_64 images. SliTaz has no signed boot loader: Secure Boot must be off.
QEMU
On SliTaz x86_64, QEMU is a package (it brings qemu-img and the UEFI
firmware with it):
# spk-add qemu-x86_64
On another distribution, install its qemu package (often called
qemu-system-x86), and ovmf for UEFI.
Live, BIOS
$ qemu-system-x86_64 -enable-kvm -cpu host -m 2048 -smp 2 \
-cdrom slitaz-firefox-x86_64-5.1.iso \
-netdev user,id=n0 -device e1000,netdev=n0
-enable-kvm -cpu host uses the hardware virtualization of your
processor: the system runs close to native speed. It needs /dev/kvm
and the right to use it (often through the kvm group). Without KVM,
remove these two options:
QEMU then emulates the processor, which works but is slow. The same
command boots the i486 images.
In the QEMU window, Ctrl+Alt+G releases the mouse and Ctrl+Alt+F switches to full screen.
Live, UEFI
UEFI needs the OVMF firmware and a copy of its variables file, which the virtual machine writes to. On SliTaz:
$ cp /usr/share/qemu/edk2-i386-vars.fd my-vars.fd
$ qemu-system-x86_64 -enable-kvm -cpu host -m 2048 -smp 2 \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/qemu/edk2-x86_64-code.fd \
-drive if=pflash,format=raw,file=my-vars.fd \
-cdrom slitaz-firefox-x86_64-5.1.iso \
-netdev user,id=n0 -device e1000,netdev=n0
On Debian, the files are /usr/share/OVMF/OVMF_CODE_4M.fd and
/usr/share/OVMF/OVMF_VARS_4M.fd. The image opens on the SliTaz GRUB
menu; see Handbook: Boot menu.
Install on a virtual disk
Create a disk image of 8 GB. The installed system takes less than 1 GB; the rest is room for packages and files. The file only grows as it fills.
$ qemu-img create -f qcow2 slitaz.qcow2 8G
BIOS: put the disk on an AHCI controller and boot the ISO:
$ qemu-system-x86_64 -enable-kvm -cpu host -m 2048 -smp 2 \
-device ich9-ahci,id=ahci \
-drive id=d0,file=slitaz.qcow2,if=none,format=qcow2 \
-device ide-hd,drive=d0,bus=ahci.0 \
-cdrom slitaz-firefox-x86_64-5.1.iso -boot d \
-netdev user,id=n0 -device e1000,netdev=n0
Install (see below), then start the same command without -cdrom and
-boot d.
UEFI: two traps. Under OVMF, the live system does not see a CD-ROM on IDE (the installer stops on "/dev/cdrom: Mount failed"), and the firmware may not boot from a disk on AHCI. So the CD goes on AHCI for the install, and the disk goes on IDE to boot the installed system:
$ qemu-system-x86_64 -enable-kvm -cpu host -m 2048 -smp 2 \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/qemu/edk2-x86_64-code.fd \
-drive if=pflash,format=raw,file=my-vars.fd \
-device ich9-ahci,id=ahci \
-drive id=d0,file=slitaz.qcow2,if=none,format=qcow2 \
-device ide-hd,drive=d0,bus=ahci.0 \
-drive id=cd,file=slitaz-firefox-x86_64-5.1.iso,if=none,media=cdrom,readonly=on \
-device ide-cd,drive=cd,bus=ahci.1 \
-netdev user,id=n0 -device e1000,netdev=n0
After the install, boot the disk alone, with the same variables file:
$ qemu-system-x86_64 -enable-kvm -cpu host -m 2048 -smp 2 \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/qemu/edk2-x86_64-code.fd \
-drive if=pflash,format=raw,file=my-vars.fd \
-drive file=slitaz.qcow2,if=ide,format=qcow2 \
-netdev user,id=n0 -device e1000,netdev=n0
VirtualBox
In VirtualBox click New and set:
- Type: Linux. Version: Other Linux (64-bit) for x86_64, Other Linux (32-bit) for i486.
- Memory: see "How much memory" above.
- Hard disk: a virtual disk of 8 GB or more if you want to install.
- Settings > Storage: attach the ISO to the optical drive. Keep the disk on a SATA (AHCI) or IDE controller, not virtio-scsi.
- Settings > Network: Intel PRO/1000 or PCnet, not the paravirtualized (virtio) adapter.
- Settings > System > Enable EFI: optional, x86_64 images only. Leave it off for i486 and for a first try.
There is no VirtualBox guest additions package in SliTaz 5.1: no shared folders, shared clipboard or automatic screen resizing. The guest works for everyday use without them.
Boot and install
SliTaz starts a live system with the user tux (no password); the root
password is root. See
Handbook: Users and passwords.
To install on the virtual disk, click Install SliTaz in the welcome window and follow Handbook: Installation. The installer does not create partitions: prepare the disk first, for example with GParted from the firefox image: an ext4 root partition, plus an EFI system partition on a GPT disk for UEFI. See Handbook: Prepare the partitions.
When the install ends, remove the ISO from the virtual drive and reboot. Then update, as root:
# spk-up
Keep your changes
A live system forgets everything at shutdown. To keep your work without
installing, add a second small virtual disk, make an ext4 partition on
it and boot with the option home=sdb1 (the name depends on the
controllers: check with blkid). See
Handbook: Keeping your data.
Troubleshooting
The installed system does not boot, the kernel cannot mount its root: the disk is on virtio. Move it to SATA (AHCI) or IDE.
No network: use an e1000 card, and with QEMU check the -netdev and
-device options.
UEFI shell instead of GRUB after an install: the firmware does not see the disk. With QEMU, put the disk on IDE as shown above and keep the same variables file.
Very slow: KVM is not used. Check that /dev/kvm exists and that
virtualization (VT-x, AMD-V) is enabled in the firmware of the host.