For me, the holy grail of working with virtual machines is
$ ssh root@my-vm
I am tired of manually updating /etc/hosts or looking at arp tables1. There’s got to be a better way. And there is! Here’s how. This works with Fedora 20. Your mileage may vary with other distros.
Add the following line to /etc/NetworkManager/NetworkManager.conf
under the [main] block:
dns=dnsmasq
This line tells NetworkManager to run a dnsmasq process.
hosts
style file that dnsmasq will use for name resolution.
$ curl -o /usr/bin/virt-hosts https://raw.github.com/awood/virt-utils/master/virt-hosts && chmod 755 /usr/bin/virt-hosts
$ echo "addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts" >> /etc/NetworkManager/dnsmasq.d/virt-hosts
This line tells NetworkManager to add the default.addnhosts
file to the list of places that dnsmasq looks at for name resolution.
$ yum install -y incron
$ systemctl enable incrond.service && systemctl start incrond.service
Set up incron to run virt-hosts
every time we detect a change in the status of a virtual machine.
$ echo "/var/lib/libvirt/dnsmasq/default.leases IN_MODIFY /usr/bin/virt-hosts -ur" > /etc/incron.d/virt-hosts
Add the following line to /etc/sysconfig/network-scripts/ifcfg-em1
DOMAIN="default.virt"
$ systemctl restart NetworkManager
$ ssh root@your-vm
Done!
1 The arp table solution seems really simple, but half the time my VMs vanish from the arp table and I can’t get their IP anymore.
Spotify is pretty damn cool. I think we can all agree on this. What’s even cooler (if you’re an Open Source/Linux geek) is running a third-party ncurses client to connect to Spotify. Here’s what I had to do on Fedora 17 (64 bit).
subversion libtool libogg-devel libvorbis-devel pulseaudio-libs pulseaudio-libs-devel zlib-devel gstreamer-devel libao-devel openssl-devel ncurses-devel
svn co https://despotify.svn.sourceforge.net/svnroot/despotify despotify
despotify/src
directory
cd despotify/src
make
sudo make install
libdespotify.so.0
got installed. Now, I’m sure there’s a more intelligent way to do this (please tell me if you know by commenting on this blog post, or hit me up on twitter: @tbielawa), but lacking the necessary knowledge, I opted use symbolic links (note: this fixes the “despotify: error while loading shared libraries: libdespotify.so.0:" cannot open
error message you may be seeing)
cd /usr/lib64
sudo ln -s ../lib/libdespotify.so.0
?
” key to see a list of shortcuts. ctrl+e
is a shortcut for :connect
)
despotify
User not found
” error message. Per the information in this thread on the archlinux forumsI did the following:
That’s everything I had to do. So, is it worth it? No. Not really. But it was a fun little experiment/challenge.
The interface is immature, at best. It’s lacking most/all of the functionality I really enjoy in the official Spotify client, such as creating and listening to artist/song based radios, receiving/sending music suggestions to friends, Starring songs for offline listening later, etc…
What you can do is search for artists/tracks and play the results, and, impress your friends? I guess. (probably not though)
I just went through a harrowing experience of attempting to install Fedora 14 on a Lenovo T520 Thinkpad with my good friend, abutcher. The issue presented itself first as X failing to start after the installer loaded. After switching into low graphics mode we were able to go through the installer successfully. But that did not solve our problems completely. After booting into the desktop we were unable to change the display resolution from 1280×1024 to the native 1600×900.
We started as most people would, Googling for numerous combinations of “fedora 14 thinkpad T520”, “sandybridge linux”, “sandybridge fedora”, etc. The results were surprising. Numerous sources report the T520 works with “no special setup needed.” This was not true for us. We Tried installing a newer Kernel from rawhide and the newer xorg-x11-drv-intel
driver (2.16). This did not fix the issue.
To compound our confusion, we noticed numerous posts referencing a BIOS option to disable the Nvidia 4200M (Optimus) card. Our system showed no signs of said card or any “internal”/”external” BIOS option.
Next we attempted installing Fedora 15. *ugh* GNOME 3 was not on our list of things to try today. But it was all we could think of.
This also did not work.
I started doing some heavy research. Somehow I ended up researching Kernel Mode Setting (KMS). The Debian Wiki was an especially useful resource for this.
Kernel Mode Setting (KMS) provides faster mode switching for X and console. It also provides native-resolution VTs on some laptops and netbooks which, prior to this, would use some standard mode, e.g. 800×600 on a 1024×600 panel.
This was relevant to my interests. “KMS provides native-resolution virtual terminals” you say? A quick trip to /boot/grub/grub.conf
showed that we were booting our kernel with the nomodeset option. We made a new boot entry (protip: never change your boot loader without leaving a known “working” entry) and omitted the nomodeset option. We also set the value of the default variable to our new entry, set timeout
to 10, and commented out the hiddenmenu
directive.
This almost worked. We removed the xorg config file (/etc/X11/xorg.conf
) and restarted the computer for good measure.
voila.
Our Lenovo Thinkpad T520 was booting X using the laptops native resolution.
Just to clarify:
xorg-x11-drv-nouveau
package/driver had nothing to do with this. That package provides an Nvidia driver (which did not affect us)kmod-nvidia
package/driver also has nothing to do with thisTonight I’m upgrading my desktop (“fridge”) from Fedora 11 to 12. For my own personal benefit I’ll be documenting the process. Things I want to take note of in particular include: which additional files must be backed up for system services like samba, my current partition map, and what process I used to perform the upgrade (optical media, netboot?).
Andrew and I put together a small Linux 101 tutorial for new CS kids in our department. We collaborated on it using google docs for the outline and then google presentation to make the actual presentation.