QEMU in a terminal

When I use text only VMs I usually find more convenient to just work from terminal. After a bit of research I found the perfect solution for me.

Inside your guest system edit /etc/default/grub to start a serial console on /dev/ttyS0 and disable GRUB graphical terminal:

GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"
GRUB_TERMINAL=console

Then update GRUB.

Next open /etc/inittab and enable login on the serial console. On Devuan you just need to uncomment this line:

T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100

Serial console however can't dynamically adjust to your terminal resolution. Luckily I found a solution on StackExchange.

After setting up your guest you can now use your VM directly from your terminal emulator, just append -nographic to your QEMU options.

Change GNOME Shell font

Having switched to Gentoo I had to look for a desktop environment to replace Unity, which I've been using for years under Ubuntu. I tried to use XFCE and KDE 5 for some months, but... just no (and I'm being very kind). Luckily I found an overlay for GNOME without systemd, including some extra patches to restore deprecated behaviours.

With the proper extensions installed it's quite usable, but I noticed an option for setting the shell font was missing.

cantarell_vs_sourcesanspro

Since GNOME Shell themes are basically CSS you can modify whatever you want in a fairly simple way, provided that you know where to look. If you are using the default theme create a file named .local/share/themes/<NewThemeName>/gnome-shell/gnome-shell.css (also create the eventually missing folders), in this example I'm using Source Sans Pro, 10pt:

stage {
	font-family: "Source Sans Pro";
	font-size: 10pt;
}
/* Fixed icons size in GNOME Shell panel */
#panel .panel-button .system-status-icon {
	icon-size: 16px;
	padding-top: 0px;
	padding-bottom: 0px;
}
/* Fixed icons size in GNOME Shell panel menus */
.popup-menu-icon {
	icon-size: 16px;
}

The last two rules are necessary to avoid blurry icons in the panel

blurry_icons

If you are using a custom theme and it's not the first time you hear about CSS, you may already know what to do. Anyway, here's an example based on Arc theme (the last fad, no one seems to give a damn about the "superb" (cit.) Numix anymore):

@import "/usr/share/themes/Arc/gnome-shell/gnome-shell.css";
stage {
	font-family: "Source Sans Pro";
	font-size: 10pt;
}

Set your preferred font and select the new theme from GNOME Tweak Tool.

Keyboard backlight on VPCS11E7E with Ubuntu 14.04

As you may know some Sony Vaio models offer the possibility to manage the keyboard backlight settings using the two interfaces

kbd_backlight

kbd_backlight_timout

in /sys/devices/platform/sony-laptop.

After setting them manually for years, I finally decided to quickly create a simple script to save me the trouble. I conveniently associated this script to the function keys Fn+F9 and Fn+F10 (those with the magnifying glass) and I added a visual notification with libnotify.

libnotify-img

Requirements

Install

Log in as root, download and extract the package in /etc/acpi:

sudo -s
cd /etc/acpi
wget https://storage.shibotto.tk/blog_uploads/keyboard_backlight-en.tar.gz
tar -xvf keyboard_backlight-en.tar.gz
rm keyboard_backlight-en.tar.gz
service acpid reload

You'll end up with 3 new files:

By default it moves back and forth between the options, just like the sound and backlight keys, following this order:

Off → 10 seconds → 30 seconds → 60 seconds → Always on

If you like it this way, you can stop reading now. Otherwise I added some other combinations you might be more comfortable with.

Configuration

The script kbd_backlight.sh has the following options:

Usage: ./kbd-backlight.sh toggle|timeout|cycle|previous|next

You can try them anytime launching it as root. If you want to change the key associations I set for a certain key, all you have to do is change the option in the last line of the correct event file in /etc/acpi/events.

$ cat /etc/acpi/events/sony-fn-f10
# Fn + F10

event=sony/hotkey SNY5001:00 00000001 00000015
action=/etc/acpi/kbd-backlight.sh next

After every change you must reload acpid with sudo service acpid reload, or you won't be able to use your association until next reboot! Some possible combination you should take into account are:

Move back and forth between the options (default)

That's how I like it to, because it's the same behavior of sound and backlight. The options are:

One key on/off & one key timeout

Could be convenient if you habitually set a long timeout (60 seconds/always on) and you often turn the light on/off. This is especially useful because you don't have to move between all the options to toggle the light, and when you turn it back on the last timeout you set will be restored. The options are:

One key to cycle all the options

This will cycle through all the available options. It might not be as convenient as the other combinations, but it might be your only options if you only have one key left (ex. the other key is already assigned). The option is:

Of course it can still be combined with one of the other options.

Screen backlight on Sony Vaio VPCS11E7E with Ubuntu 14.04

Install the proprietary driver, then open /etc/X11/xorg.conf.d/20-nvidia.conf and add the line 6, as in the example:

Section "Device"
	Identifier "Nvidia Card"
	Driver "nvidia"
	VendorName "NVIDIA Corporation"
	Option "NoLogo" "true"
	Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection

Now log out and log back in. That’s all.

Bring TTYs back and Plymouth resolution on Sony Vaio VPCS11E7E with Ubuntu 14.04

In a terminal

sudo apt-get install v86d

then open /etc/default/grub and edit GRUB_CMDLINE_LINUX_DEFAULT and GRUB_GFXMODE as follows

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset video=uvesafb:mode_option=1360x768-24,mtrr=3,scroll=ywrap"
...
GRUB_GFXMODE=1360x768

then

echo uvesafb mode_option=1360x768-24 mtrr=3 scroll=ywrap | sudo tee -a /etc/initramfs-tools/modules
echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash
sudo update-grub
sudo update-initramfs -u

Thus the Ubuntu logo at boot will be at the correct resolution and you will have your TTYs back.


Source: http://idyllictux.wordpress.com/2010/04/26/lucidubuntu-10-04-high-resolution-plymouth-virtual-terminal-for-atinvidia-cards-with-proprietaryrestricted-driver/