Wednesday, July 6, 2016

Fedora 24 and Nouveau drivers

My laptop uses Nvidia Optimus for video.  This means the GPU built in to the CPU is for for 2D, and the Nvidia adapter is used for 3D.  The idea I'm assuming is to save power.  Great, who doesn't want their laptop battery to last longer?

In Linux land though, Optimus is problematic.  The proprietary Nvidia drivers don't support it (licensing issues are getting in the way unfortunately).  Given that's the case, I've been sticking to Nouveau, the open source driver for Nvidia cards that comes stock with Fedora.  I haven't been able to play any 3d games on my laptop because of this, but do I have a Windows machine sitting around somewheres if I really need to scratch that itch.

Fedora 24 and Nouveau drivers turned out to be a whole different ball game however.  After installing F24, I noticed my laptop was running really really hot.  Lm sensors, a hardware monitoring tool for Linux, told me my idle CPUs were sitting at a little under 70 degrees Celsius.  Yikes!  Not good.

Bumblebee to the rescue!  Bumblebee is an open source Linux project that lets you switch between the integrated GPU and the Nvidia adapter.  With Bumblebee, by default graphics are handled by the integrated chip.  You can manually run applications with the "optirun" or the "primusrun" commands though and then graphics will be handled by the more powerful Nvidia chip.  Bumblebee supports the proprietary Nvidia drivers as well, so 3d games are not a problem.

So why have I been sticking with Nouveau?  Well, setting up Bumblebee in the past has been a bit involved and didn't always turn out well.  But it seems some Fedora folks have been busy making it all very simple.  Following this guide I had Bumblebee installed and working in a matter of minutes.  A quick reboot, and my CPU temperatures went down to under 50 degrees Celsius.  So sure, things started out a bit rocky with Optimus, but give it time and the open source community does not disappoint.  Looks like I will not be running Nouveau drivers again any time soon.

Sunday, July 3, 2016

Upgrading Fedora

I recently upgraded my laptop to Fedora 24 and took notes about the process.  I'm collecting them here, mostly for future reference, but also for anybody else out there that maybe happens to stumble upon them.

First things first, before upgrading I make sure to do the following:
  1. Push any git commits that need to be pushed.  This includes dot files if I've changed them (haha, argh! Just got burned by this one actually).
  2. Make sure Syncthing is properly syncing the files I have under its control, and that everything is up to date everywhere.
  3. Go through ~/Applications and see if there's anything I want to save, and if so manually back things up. 
  4. Manually back up my documents and projects.
  5. Manually back up any videos or other large files I happen to want to save
First off, let me say Syncthing is awesome.  Fairly easy to set up and really low maintenance once it's up and running.  I use it to keep all my documents and projects in sync between 3 of my home systems.  If you haven't tried it you should check it out.

Why all the manual backing up of things?  Well, for anything 'important' I mainly rely on Syncthing to distribute things around my network, and then rsnapshot to throw things onto a back up drive.  But it definitely doesn't hurt to have a few extra copies of important stuff lying around.  Everything else?  Well, I'm a digital packrat and there's no way I'd be able to keep everything (not without spending a ton of money anyhow).  I'm keeping enough mooc videos I'll probably never watch as it is.  Upgrades always motivate me (well, make it necessary perhaps) to organize and cull both old and new data, so I do.  I like to think it's a good thing.

I never have trusted the Fedora upgrade process.  I've heard a lot of bad things, so I always perform a fresh install.  Maybe this just means I'm making more work for myself?  Anyhow, post upgrade, I did the following:
  1. Add the following to /etc/dnf/dnf.conf: "fastestmirror=True".
  2. Run "dnf update", and reboot.
  3. Change the desktop and lock screen backgrounds (I may do some of these while updates are running of course), which is in Gnome settings, under background.
  4. Turn off the terminal bell.  Found on the terminal edit menu, under profile preferences.
  5. Disable screen lock.  Found in Gnome settings, under privacy.
  6. Clone my dot files from git and copy them to where they need to be.
  7. dnf install hexchat p7zip vim-enhanced gnome-tweak-tool
  8. Enable Firefox sync.
  9. Configure my Gnome favorites.
  10. Import rpmfusion gpg keys: "gpg --keyserver pgp.mit.edu --recv-keys (ID)".  IDs and more info are found on the site.
  11. Install rpmfusion free and non-free repos.  The "localinstall" option isn't a thing anymore.  Just download the rpms and run "dnf install rpmfusion.foo.rpm".
  12. Install fonts: "dnf install freetype-freeworld".
  13. Install media codecs:  "dnf install gstreamer-plugins-bad gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree gstreamer-plugins-good-extras gstreamer-plugins-ugly gstreamer1-plugins-bad-free-extras gstreamer1-plugins-ugly gstreamer1-plugins-bad-free-fluidsynth gstreamer1-plugins-bad-freeworld gstreamer1-plugins-base-tools gstreamer1-plugins-entrans gstreamer1-plugins-fc gstreamer1-plugins-good-extras gstreamer-ffmpeg ffmpeg-libs ffmpeg x264 x264-libs h264enc lame lame-libs lame-mp3x twolame mpg123-plugins-extras mpg123 faad2 gstreamer1-libav"
  14. With Gnome Tweak tool enable the global dark theme, enable the date on the top bar, set font antialiasing to "rgba", set font hinting to "none", and set the window focus mode to "mouse".
  15. Add the following to /etc/X11/Xresources: "Xft.lcdfilter: lcddefault".
  16. Install whatever it is I'm working on at the moment, in this case: "dnf install octave qtoctave python2-matplotlib python3-matplotlib python-ipython-notebook python3-ipython-notebook python2-pandas python3-pandas python2-numpy python3-numpy python2-scikit-learn python3-scikit-learn python2-statsmodels python3-statsmodels"
  17. Install and set up Syncthing so I have my projects and data back.
  18. And finally save a list of available packages for future reference, so: dnf list available >& /root/available_packages
One thing I've noticed, I'm not able to play videos half the time if I follow some of the guides you find out there.  So then I always have to sit there installing things until I finally get working videos.  This time around I was determined to figure out what's wrong with the available guides.  So I could be wrong, but it seems to me they're typically missing the gstreamer1-libav package.  Once I installed that I was able to play videos no problem.  Well, maybe Quicktime or Real videos could still be problematic?  Eh, are those even a thing anymore?  At any rate, gstreamer1-libnav and I'm happy.

And that's how it's done on my end.  I'm not saying this is what everyone should do, but it's what I do to get myself back up and running and productive again.  If you're reading this, maybe you'll pick up some tricks?  Or maybe just satisfy a bit of your curiosity.  Cheers.

Saturday, July 2, 2016

Booting Fedora to RAM

So I installed Fedora 24 yesterday.  And while not the only option, the default installation CD is a live CD that boots up a Gnome desktop, and from there gives you the option to either just play around with Fedora or to run the installer application and install Fedora to your hard disk.

As an aside, I chose the Gnome live CD because that will install Gnome.  If another particular environment happens to be your thing, then you'll need to choose the appropriate live CD.  In Fedora land these are called spins, and you can find out more about them here.

And as another aside, while I don't always do it, a lot of times upon a new release of Fedora I'll force myself to switch up from Gnome to something different, until the next Fedora release or until I tire of it.  I suppose KDE might be the only environment I've actually stuck with for a full release cycle besides Gnome (I miss the more polished, integrated, and full featured applications too much I guess), but still, switching it up every now and again helps me not to stagnate I like to think.  Speaking of which, I should probably give xmonad (a tiling window manager) or the like a try for once.  Maybe I will this time around.

Anyhow, given my wealth of ram, it makes sense to me to, if at all possible, load my live CDs into RAM when I boot them.  This is easy to do with Fedora, though not as simple as I'd like it to be, namely it being a menu item.  But still pretty easy.  When presented with the initial live CD menu, hit the 'e' key to edit the menu entry.  Then append the kernel line with 'rd.live.ram'.  Hit ctrl-x to boot and you're set.  It will take a bit longer to boot of course as everything needs to be loaded into ram.

So what's the point?  If you're simply wanting to give a particular desktop a go, loading things into RAM will make everything much more responsive and way closer to to what the true desktop experience would be like.  But even if you're just performing an install, if you're like me you might need to fire up a terminal and do some low level pre-install or post-install tasks.  Or you might just want to bring up a browser or the like while you wait for the installation to finish.  Booting to RAM makes this so much more pleasant.

And a bit of trivia.  Though it wasn't exactly a live CD, older versions of Solaris were the first perhaps, the first install CDs I ever encountered anyway, where you could use a browser while you were waiting for the installer.  Quite neat back in the day.