Subsections of Platforms
Running GoboLinux under QEMU
Note
This article has been written for an older GoboLinux release and is potentially out of date!!
We’ll illustrate how to:
- create a disk image
- boot an ISO image of Gobo under QEMU
- install Gobo to a disk image on the host filesystem
- reboot the newly installed guest
- initialize networking
- launch QEMU from a helper script
Create a disk image
This is where we will install our Linux system.
qemu-img create gobo.img 20G
Boot the installer
Here is the full command you can edit and paste into the terminal:
sudo qemu-system-x86_64 \
-cdrom GoboLinux-016.01-alpha-x86_64.iso \
-hda gobo.img \
-boot d \
-m 768 -enable-kvm -show-cursor -cpu host -daemonize \
-vga std -soundhw ac97 -rtc base=utc \
-usb -usbdevice tablet -device usb-mouse -vga std -clock unix
To test boot only the ISO, omit the -hda option.
Boot the disk image
After you’ve finished the installation, shutdown the guest OS and terminate QEMU. Start QEMU again, this time booting from the disk image:
sudo qemu-system-x86_64 \
-hda gobo.img \
-boot c \
-m 768 -enable-kvm -show-cursor -cpu host -daemonize \
-vga std -soundhw ac97 -rtc base=utc \
-usb -usbdevice tablet -device usb-mouse -vga std -clock unix
Networking under QEMU
QEMU provides a networking stack so that the guest OS running on this virtual machine can access the internet, or ssh to the host.
The only extra setup needed is to run Gobo’s DHCP client inside the guest.
dhcpcd
By default QEMU acts as a firewall and does not permit any incoming traffic. It also doesn’t support protocols other than TCP and UDP. This means that ping and other ICMP utilities won’t work.
Details can be found here.
Helper script
Qemust
is a perl5 script you can use to start your QEMU processes. With most
options defined in the script, the command line becomes much simpler.
To boot from an ISO and install to a disk image:
qemust --iso=GoboLinux-016.01-alpha-x86_64.iso --image=gobo.img
To boot from the disk image
qemust --image=gobo.img
To test an ISO:
qemust --iso=GoboLinux-016.01-alpha-x86_64.iso
The script has some library dependencies. The most convenient way to install
them (and any CPAN modules) is to use cpanminus
(cpanm). So install
cpanminus
, then the dependencies:
cpan App::cpanminus
cpanm Getopt::Long::Descriptive
The script follows below. Edit the QEMU options to your liking, put the script
in somewhere in your $PATH
, and make it executable with something like
chmod a+x ~/bin/qemust
.
#!/usr/bin/env perl
use strict;
use warnings;
# qemust - start QEMU
use 5.012;
use Getopt::Long::Descriptive;
my ($opt, $usage) = describe_options(
'%c %o',
[ 'iso=s', "ISO file to boot" ],
[ 'image=s',"OS disk image file" ],
[ 'help', "print usage message and exit" ],
[ 'n', "print QEMU startup command and exit" ],
);
print($usage->text), exit if $opt->{help} or ! keys %$opt;
my $boot_drive = $opt->{iso} ? 'd' : 'c';
my @cmd = grep{! /^\s*$/} map{s/\s*#.*$//; $_} split "\n",<<"CMD";
sudo # run as root
qemu-system-x86_64 # for 64-bit CPUs
-enable-kvm # faster virtualization
-show-cursor #
-boot $boot_drive # boot from DVD/CDROM if present
-m 768 # use memory 768MB
-cpu host # same CPU model as host
-daemonize # avoid race conditions when QEMU started by external program
-vga std # probably -vga vmware would work, too
-soundhw ac97 # typical soundcard, -soundhw hda should also work
-rtc base=utc # timer related
-usb # enable USB driver
-usbdevice tablet # so QEMU can report mouse position without grabbing mouse
-device usb-mouse #
-clock unix #
CMD
push @cmd, "-cdrom $opt->{iso}" if $opt->{iso};
push @cmd, "-hda $opt->{image}" if $opt->{image};
my $cmd = join " \\\n",@cmd;
say $cmd;
system($cmd) unless $opt->{n};
__END__
Running under VirtualBox
Note
This article has been written for an older GoboLinux release, and is potentially out of date!!
Setting up VirtualBox guest additions
VirtualBox requires its own graphics drivers in order to perform advanced features such as smart mouse sharing and running at a window-dependent full resolution.
These drivers can be built using the “Guest Additions” ISO image included with VirtualBox.
The catch is that we are already using the virtual CD drive from VirtualBox to
run the ISO, so we need to add a second one. With the virtual machine shut down,
right-click the image, then at the Storage pane, add a second optical drive, and
insert the VBoxGuestAdditions.iso
file that should be somewhere in your
VirtualBox installation:
Then, boot GoboLinux normally in VirtalBox, and do the following:
mount /dev/sr1 /Mount/CD-ROM
cd /Mount/CD-ROM
./VBoxLinuxAdditions.run
udevadm trigger
When you run udevadm trigger
the drivers should be loaded, and the console
will change resolution immediately. (It will also lose the nice-looking
GoboLinux font: to reload it, type setfont lode-2.0-lat1u-16
.)
Now, you can start Xorg normally with:
startx
If you want to resize your VirtualBox window, make sure “Auto-resize guest display” is turned on in the VirtualBox “Machine” menu, then, after resizing the VirtualBox window, type in the GoboLinux terminal the following
xrandr --output VGA-0 --preferred
This will resize the desktop to match your window size.
Note that this installation of the VirtualBox guest additions will only last for the current Live-CD session. If you install GoboLinux into a VirtualBox virtual hard drive, you will have to do the same again.
Running under GNOME Boxes
GNOME Boxes is a new virtual machine manager and remote desktop manager powered by QEMU, KVM, and libvirt virtualisation technologies. Running Gobolinux under GNOME Boxes is quite easy, even more so than under Virtualbox.
Setup Instructions
- Create a new Virtual Machine by clicking “New” in the top left corner.
- Click “Select a file”.
- Select the Gobolinux LiveCD ISO file.
- Boxes will be ready to create a virtual machine with 2GB of RAM and 21.5GB of storage. If that is sufficient, click “Create”.
- Otherwise you can click “Customize” and adjust the sliders for RAM and storage respectively, then click the back arrow.
- The LiveCD session will then start. Continue normal installation procedures. Remember to eject the LiveCD prior to reboot by going to the top right menu and clicking “Properties” -> “Devices & Shares” and then clicking “Remove” beside the CD/DVD section.
Installing SPICE
Spice allows for integration with the host system including setting native resolutions, file transfers, clipboard support etc.
- Compile
SPICE-VDAgent
- Run
StartTask Spice-VDAgent
after login - Run
spice-vdagent
- Run
xrandr --output Virtual-0 --preferred
to update the resolution
Installing to external storage devices
Note
This article has been written for an older GoboLinux release and is potentially out of date!!
GoboLinux 016 comes with two installation modes: UEFI and BIOS-compatibility mode. Depending on how your computer firmware is configured you may need to follow one or another recipe below.
BIOS-compatibility mode
Ensure that your external disk has been configured with a MSDOS partition table. You need to have at least one Linux partition (e.g., ext4), with the BOOT flag set.
You can then proceed with the installation of GoboLinux by selecting that Linux partition as install target and by enabling the installation of the bootloader on the master boot record (MBR) of that disk.
UEFI mode
Ensure that your external disk has been configured with a GPT partition
table. You need to have at least one Linux partition (e.g., ext4) and a FAT
(32/16/12) partition which is where the UEFI application embedding the GRUB
bootloader will be stored. The FAT partition needs to have both the ESP and
BOOT flags set. If you are using GParted, that FAT partition will be
automatically formatted by the tool. If you are not, then make sure to invoke
mkfs.msdos
to format it yourself.
Once the partitioning is arranged, you can proceed with the installation of Gobo by selecting the Linux partition as system install target and by selecting the FAT partition (also called EFI System Partition) as bootloader install target.
Troubleshooting
Unable to mount root fs
Both USB-Storage and UAS (USB-Attached-SCSI) drivers are built into the kernel.
However, at times the kernel may not have time to discover the partitions on
your external disk and may fail to mount the root filesystem. This particular
problem can be fixed by adding the rootwait
parameter to the kernel command
line.
For BIOS-compatibility mode:
- Mount your system partition using the LiveCD under
/Mount/GoboLinux
- Edit the file at
/Mount/GoboLinux/System/Kernel/Boot/grub/grub.cfg
. Look for the lines starting withlinux /System/Kernel/Boot/kernel-4.8.2-Gobo
and append the wordrootwait
to the very end of those lines - Unmount the partition under
/Mount/GoboLinux
and reboot.
For UEFI mode:
- Mount your boot partition (the one with a FAT filesystem) using the LiveCD
under
/Mount/GoboLinux
- Edit the file at
/Mount/GoboLinux/EFI/BOOT/grub-efi.cfg
. Look for the lines starting withlinux /System/Kernel/Boot/kernel-4.8.2-Gobo
and append the wordrootwait
to the very end of those lines - Regenerate the UEFI application. This is a large command, so it’s better to just copy+paste it.
cd /Mount/GoboLinux/EFI/BOOT
grub-mkstandalone-efi -d /lib/grub/x86_64-efi -O x86_64-efi --modules="part_gpt part_msdos iso9660 all_video efi_gop efi_uga video_cirrus gfxterm gettext font" --fonts="unicode" --themes="" -o BOOTx64.EFI --compress=gz "boot/grub/grub.cfg=grub-efi.cfg"
Afterwards, unmount the partition under /Mount/GoboLinux
and reboot.