Tom's Basement

Random Geekery

  • A pre-compiled Gentoo virtual image. Wait… what !?

Gentoo is about starting from scratch and learning. The pre-compiled virtual image you can download from this post seems then to defeat the whole purpose, and in a way I would agree. After all, you would miss all the fun:

But let’s say you have the following use-case: you already followed the Gentoo handbook so many times that you don’t see the point anymore. You want to test something and would like a working linux desktop, but you don’t want to go through hours of compile time just to get a basic desktop. Or, you’re a complete beginner, but you’re intimidated by the whole install process and you would benefit from playing with an already working environment.

If you think about it, Gentoo is not really “starting from scratch” anyway. The handbook is based on stage3 nowadays, but a stage3 is nothing else than a pre-compiled core of stuff you need all the time. Experienced Gentoo users even avoid starting from stage3 for each new install, they start from a so-called stage4 or stage5 which is their own backup of a fully working environment. What you have here for download is a kind of minimal KDE Plasma stage5 for VMware Workstation/Player version 12.5 or later.

But then you’ll say, “wait a sec, I still don’t get it, if I wanted to download a working KDE desktop, I would download Kubuntu or any other trusted distribution, why would I download your stuff ?”. Very valid point. As long as you want the Ubuntu environment, or you don’t care, then there is not a single good reason to get my virtual image. But if you specifically want Gentoo, and kind-of see the point, then keep reading.

  • Ok, what do I download exactly ?

-Updated on 4 feb 2017. I’ll try to refresh this post from time to time.

-Built with generic amd64 compiler flags, so it should run with close to native speed on pretty much any host hardware. If you have enough RAM to start this virtual machine you probably have a 64 bit CPU 🙂

-Gentoo sources version 4.9.8, you have the “.config” file in /usr/src/linux as usual. The kernel config is based on a stripped down Arch Linux kernel, with some minor tweaks to run as a guest. If you need any specific kernel feature, chances are that the option is not activated

-KDE plasma version 5.8, using the “kde-plasma/plasma-desktop” ebuild. A few other packages are included, see below in the world file

-The latest official vmware-tools already pre-installed. You get the accelerated vmwgfx video driver, shared folders (mounted in /mnt/hgfs when activated), drag and drop between host and VM as the main benefits

-Freetype is built with the “infinality” USE flag. I’m not sure of the settings in “eselect fontconfig” that should really be activated as there is some level of confusion around this, but the fonts look okay. Well, not worse than in your Windows or Ubuntu desktop, and having nice looking fonts used to be a pain in Gentoo or Arch, it still is to some extent. The future or the infinality patch is highly uncertain though, so a future version of freetype may not support infinality anymore like it happened recently in Arch.

  • Give it to me, where do I download it ?

Download from Google Drive

  • Install notes

-The file to download is ~760MB in size. Unzip it to your virtual machines folder. Expect a virtual image close to 6GB after decompression, so don’t unzip it on FAT32…

-Open the .vmx file using VMware Workstation/Player 12.5 or later, tweak the vCPU count and vRAM according to what your hardware allows. The image comes with 2GB vRAM and 2vCPUs configured by default. Hit “play”, then answer “I copied it” to the question asked.

-Change the account passwords. The installed account / password are user / user and root / root.

-With the modules activated in the kernel config supplied, vmware-tools should compile and install with any kernel version upgrade. The shared folders “vmhgfs” module used to be a pain the the @ss, and broke with each major kernel version update, but here we are using fuse. When “sys-fs/fuse” is installed, vmware-tools is using it instead of building the kernel module from source. It’s uglier, slower, but it always works. Choose your lesser evil.

-Once you’re on the desktop, you’ll notice on the bottom right that the input locale is set to “fr”. Left-click on it to change it to “us”, or go to the system settings and remove the fr layout completely. (Despite the us layout being the default one and set to higher priority, my fr layout seems to come up first, looks like a bug). Why is it here in the first place? Well I grew up with the fr layout and I’m too old to change my habits 😉

-Usual disclaimer: this image is provided as is, you’re the only one responsible of what you do with it. This is considered as “non supported software”: don’t open bugs with this image, if you suspect anything, try first using Gentoo supported configurations.

  • So what’s the diff ?

Or put it differently, what has been changed from the default settings ? knowing this, you can very easily override my settings to your taste.

Partition layout:
gentoo ~ # fdisk -l

(...)
Device     Boot    Start       End   Sectors Size Id Type
/dev/sda1  *        2048   2099199   2097152   1G 83 Linux
/dev/sda2        2099200  10487807   8388608   4G 82 Linux swap / Solaris
/dev/sda3       10487808 134217727 123729920  59G 83 Linux

note: the root partition is ~59GB of which ~51GB are free, which should be ok as a playground to begin with.

/etc/conf.d/hostname:
gentoo ~ # more /etc/conf.d/hostname

(...)
hostname="gentoo"

/etc/hosts:
gentoo ~ # more /etc/hosts

(...)
127.0.0.1       localhost gentoo
::1             localhost gentoo
(...)

/etc/locale.gen:
gentoo ~ # more /etc/locale.gen

(...)
en_US.UTF-8 UTF-8
(...)

/etc/conf.d/hwclock:
gentoo ~ # more /etc/conf.d/hwclock

(...)
clock="local"
(...)

note: time sync with the host is activated in the VM settings. The best I could find to have the same clock between host and guest is just to set “local” wherever I can. Or use NTP.

/etc/timezone:
gentoo ~ # more /etc/timezone

localtime

/etc/conf.d/net:
gentoo ~ # more /etc/conf.d/net

config_eth0="dhcp"

/etc/rc.conf:
gentoo ~ # more /etc/rc.conf

(...)
rc_logger="YES"
(...)
rc_sys=""

note: openrc logging can be useful to troubleshoot the services started at boot. Sooner or later you need this…

/etc/fstab:
gentoo ~ # more /etc/fstab

(...)
#<fs>                                           <mountpoint>            <type>          <opts>          <dump/pass>
UUID=fc83f3f2-6c7d-45c9-9749-b242ea186040       /boot                   ext2            auto,noatime            1 2
UUID=7d92c42c-f919-4562-be7b-02a9ea431571       /                       ext4            noatime                 0 1
UUID=4ca8640a-fe56-4adc-a6cb-cb53e8e83b48       none                    swap            sw                      0 0
#tmpfs                                          /var/tmp/portage        tmpfs           auto,nr_inodes=1M       0 0

note: the last line commented out can be activated if you have enough RAM (>8GB) and large packages to compile, like gcc. It can save quite some time (and the life of your SSD if your .vmdk file sits on an SSD…).

/etc/portage/repos.conf/gentoo.conf:
gentoo ~ # more /etc/portage/repos.conf/gentoo.conf

[DEFAULT]
main-repo = gentoo

[gentoo]
location = /usr/portage
sync-type = rsync
sync-uri = rsync://rsync2.fr.gentoo.org/gentoo-portage
auto-sync = yes

note: I live in France so I use a french rsync server. Change it for a mirror closer to you.

/etc/portage/make.conf:
gentoo ~ # more /etc/portage/make.conf

CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
USE="bindist python unicode xa libkms cleartype"
CPU_FLAGS_X86="mmx mmxext sse sse2"
#EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=4.0 --keep-going --with-bdeps y --complete-graph"
MAKEOPTS="-j2"
GENTOO_MIRRORS="http://gentoo.mirrors.ovh.net/gentoo-distfiles/"
L10N="en"
INPUT_DEVICES="evdev vmmouse"
VIDEO_CARDS="vmware"
SEARCH_DIRS_MASK="/usr/lib/vmware-tools /usr/lib64/vmware-tools /usr/lib64/vmware-caf"
PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"
PORTAGE_NICENESS=20

note: the commented out EMERGE_DEFAULT_OPTS can enable parallel building if activated. This also usually saves time if there are a lot of packages to build (but it disables gcc’s output, and then you can’t sit and contemplate ascii scrolling down your terminal anymore, which was probably the only reason you are using Gentoo 🙂 )
note2: I still live in France (yea, whatever), so set the mirror to one closer to you, and adjust MAKEOPTS to your vCPU setting.
note3: the SEARCH_DIRS_MASK prevents revdep-rebuild to look into the vmware-tools directories when it runs, where it usually generates complaints. We don’t care about broken vmware-tools dependencies.
note4: Notice the “bindist” USE flag. You’re downloading a precompiled image, and some software licensing prevents me from distributing precompiled binaries. So, once you have downloaded this image, remove this “bindist” USE flag, and recompile some packages that may depend on it using emerge -uDN @world to avoid some possible blocks.

/etc/portage/package.keywords:
gentoo ~ # more /etc/portage/package.keywords

sys-kernel/gentoo-sources
sys-kernel/linux-headers

note: I consider stable what Linus considers stable, so I always build the latest stable kernel. But this (and everything else actually) is up to you.

/etc/portage/package.use/freetype:
gentoo ~ # more /etc/portage/package.use/freetype

media-libs/freetype infinality -bindist

/etc/conf.d/xdm:
gentoo ~ # more /etc/conf.d/xdm

(...)
DISPLAYMANAGER="sddm"

note: install sddm as the handbooks says.

/etc/sddm.conf:
gentoo ~ # more /etc/sddm.conf

(...)
[Theme]
Current=breeze
(...)

/var/lib/portage/world:
gentoo ~ # more /var/lib/portage/world

app-admin/syslog-ng
app-portage/eix
app-portage/gentoolkit
kde-apps/kmix
kde-apps/konsole
kde-plasma/plasma-desktop
kde-plasma/systemsettings
media-sound/alsa-utils
sys-boot/grub
sys-fs/fuse
sys-kernel/gentoo-sources
x11-base/xorg-server
x11-misc/sddm

note: that’s all that has been manually installed. Konsole because you want a terminal, do you? Kmix because you want to be able to change the sound volume easily. Fuse is here for the vmware-tools shared folders feature. The rest is pretty much minimal, and you would likely end up with it following the handbook, or pretty soon when working a little bit with portage.

profile:
gentoo ~ # eselect profile list

(...)
  [8]   default/linux/amd64/13.0/desktop/plasma *
(...)

infinality:
gentoo ~ # eselect infinality list

(...)
  [2]   infinality *
(...)

note: as per the infinality wiki.

lcdfilter:
gentoo ~ # eselect lcdfilter list

(...)
  [7]   infinality-sharpened *
(...)

note: as per the infinality wiki.

fontconfig (showing only the enabled settings):
gentoo ~ # eselect fontconfig list

Available fontconfig .conf files (* is enabled):
(...)
  [5]   10-sub-pixel-rgb.conf *
(...)
  [9]   11-lcdfilter-default.conf *
(...)
  [24]  52-infinality.conf *
  [25]  57-dejavu-sans.conf *
  [26]  57-dejavu-sans-mono.conf *
  [27]  57-dejavu-serif.conf *
  [28]  60-latin.conf *
  [29]  62-croscore-arimo.conf *
  [30]  62-croscore-cousine.conf *
  [31]  62-croscore-symbolneu.conf *
  [32]  62-croscore-tinos.conf *
  [33]  65-fonts-persian.conf *
  [34]  65-khmer.conf *
  [35]  65-nonlatin.conf *
  [36]  69-unifont.conf *
  [37]  70-no-bitmaps.conf *
  [38]  70-yes-bitmaps.conf
  [39]  80-delicious.conf *
  [40]  90-synthetic.conf *
  [41]  99pdftoopvp.conf *

note: your mileage may vary, the infinality wiki is confusing about this. if you know a better way, drop me a comment.

/etc/default/grub:
gentoo ~ # more /etc/default/grub

(...)
GRUB_TIMEOUT=2
(...)
GRUB_CMDLINE_LINUX_DEFAULT="rootfstype=ext4 net.ifnames=0"
(...)

note: I hate the unpredictable predictable network interface names, but again this is your call.

services starting during boot that I added manually:
gentoo ~ # rc-update

(...)
            alsasound | boot
                 dbus |      default
             net.eth0 |      default
            syslog-ng |      default
               vmware |      default
                  xdm |      default
(...)

note: dbus was needed, else I would not get the notification for a usb key mount for example. If you install the more complete “*-meta” KDE ebuilds, dbus gets automatically started as a dependency, but here as the installation is quite basic I had to add it explicitely .

Groups to which the user “user” has been added:
gentoo ~ # grep "user$" /etc/group

wheel:x:10:root,user
audio:x:18:user
cdrom:x:19:user
video:x:27:root,user
cdrw:x:80:user
usb:x:85:user
users:x:100:user
plugdev:x:103:user

The rest is specific to make vmware-tools work.
You need to create the following file, and as root make it executable:

/etc/init.d/vmware:
gentoo ~ # more /etc/init.d/vmware

#!/sbin/openrc-run

depend() {
    need net
}

start() {
    ebegin "Starting VMware tools"
    /etc/init.d/vmware-tools start
    echo
    eend $?
}

stop() {
    ebegin "Stopping VMware tools"
    /etc/init.d/vmware-tools stop
    echo
    eend $?
}

The following was needed before running the vmware-tools install script for the first time:
mkdir /etc/rc{0..6}.d

The following created two scripts which are needed if the graceful shutdown, suspend or reset actions are used in the Workstation menu:
echo "/sbin/ifconfig $1 up" > /sbin/ifup
chmod 744 /sbin/ifup
echo "/sbin/ifconfig $1 down" > /sbin/ifdown
chmod 744 /sbin/ifdown

To install the official vmware-tools, mount the vmware-tools CD through the workstation VM settings menu, you should see a notification, click to mount the CD in KDE, then run the following as root in your home directory (/root):
rm -rf vmware-tools-distrib
tar xpf /run/media/user/VMware\ Tools/VMwareTools-*.tar.gz
cd vmware-tools-distrib
./vmware-install.pl -d

Then log out from the desktop, and log back in.

April 14th, 2016

Posted In: gentoo

Tags: , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.