Snaps on Gentoo
Why?
Many will think it is heresy to put binary packages on a Gentoo system let alone a package system which encourages binary packages to come with their own set of shared libraries.
While I tend to agree, the practicality of sticking to this arrangement can be difficult for a couple of cases. Here are a few I can think of:
- Source not available
- No binary package or source ebuild for Gentoo
- ebuild takes too long to compile
In the case of ebuilds taking too long (eg. chromium), I have a limited budget and can't really afford to leave my power hungry desktop on 24/7 to keep chromium builds up-to-date.
Here are a quick list of software that I use which fall into one of these categories:
- Citrix Reciever
- Powershell (Available as source, but no ebuild and I haven't had the time to try write one myself)
- Minecraft (Gaming with the kids)
- Discord (Chatting with games)
- Chromium (Primarily a firefox user, but have some trouble with getting it to see and work with Citrix)
With my excuses for putting snap's on Gentoo out of the way, here is how I've got it working for my systems.
Overlay
There are a few overlay's for Gentoo out there. Even an official one maintained (or as the case may be, unmaintained) by zyga from Canonical. I tried that one, and many of the forks with no such luck.
After googling around I stumbled on a thread on snapcraft.io and a post from user jamesb192 about the progress on their snapd overlay.
JamesB192 overlay works, but it doesn't have an overlay.xml file for adding with layman. To overcome this, I've hosted one on my site here. You can add this to your system using overlay like this:
echo app-portage/layman git >> /etc/portage/package.use/layman
emerge app-portage/layman
layman -o http://jesseharrisit.com/overlay.xml -f -a JamesB192
Now that you have the overlay installed should be able to emerge snapd like so:
emerge app-emulation/snapd
Note - You may need to adjust your kernel config and the ebuild is pretty good at highlighting which options need to be set.
Issues
During my testing of snaps on Gentoo, I've come across a couple of issues that either have been solved or could be solved in the ebuild
- snap packages only install and run as root (This was solved by setting suid on /usr/lib64/snapd/snap-confine, and solved in ebuild 2.34)
- /var/lib/snapd not created (manually mkdir the directory)
Final thoughts.
Snap packages feel like a great augmentation for Gentoo. It allows me to keep using Gentoo as a daily driver and augment some of it's missing packages with packages from more popular distros.
Downgrade Gentoo from testing to stable
At some point in my main Gentoo boxes life I added the ~amd64 keyword into my make.conf. I don't remeber why I did this, but I can't think of a reason I need my entire install to be bleeding edge.
I did some googling around on the best approach to achieve this and from what I read on forums, having a bunch of testing packages downgrade to stable is not such a good idea.
One reason might be that per app config files are usually only designed to be backward compatible, not forward compatible.
At any rate, the idea is to gather a list of currently installed testing packages and add them to package.keywords for their current version.
With this method, eventually those packages will become stable.
The method I used is basically from the sabayon wiki with a few tweaks.
First, edit make.conf ACCEPT_KEYWORDS to:
ACCEPT_KEYWORDS=amd64
Now use equery, sed and grep to construct a new packge.keywords
equery -C -N list -F '=$cpv $mask2' '*' | \ grep \~ | sed 's/\[~amd64 keyword\]/~amd64/' > \ /etc/portage/package.keywords/testpackages
Basically I added '-C' to remove colours and grep
Examine testpackages for sanity, and then test with a world upgrade.
emerge --ask --update --newuse --deep --with-bdeps=y @world These are the packages that would be merged, in order: Calculating dependencies... done! Nothing to merge; quitting.
Using the latest vim on Gentoo
Most people (including myself until recently), think of Gentoo as a bleeding edge source distribution. This is pretty far from accurate as most packages marked stable are quite out of date. And even if you decide to accept all unstable packages by adding:
ACCEPT_KEYWORKS="~amd64"
to your make.conf file, you will likely be a bit disappointed when you can't get the latest gnome bits.
As my last post indicated, I'm a bit of a vim user and I want to have the latest vim on all my machines (Windows at work, WSL/Ubuntu 18.04 on the Windows box, and Gentoo at home). To that end, here is the simple thing you need to do to get the latest Vim on Gentoo:
Overview
- Add a special keyword to vim's ACCEPT_KEYWORDS var
- Unmerge existing vim
- emerge the new vim
Keywords
Newer versions of portage allow /etc/portage/package.keywords to be a directory with simple files so that you can seperate files for seperate packages. Now, lets check if it is a file or dir and convert it if it is a directory.
cd /etc/portage
if test -f package.keywords; then
mv package.keywords keywords
mkdir package.keywords
mv keywords package.keywords/
fi
And now, lets use the special keyword for the vim package which will allow ebuilds from github
echo app-editors/vim "**" > package.keywords/vim
echo app-editors/gvim "**" >> package.keywords/vim
echo app-editors/vim-core "**" >> package.keywords/vim
Unmerge existing vim
emerge --unmerge app-editors/vim app-editors/gvim
Merge the new vim
emerge app-editors/vim app-editors/gvim
Final thoughts.
This is the way I did it, but thinking about it now, it may be unnessecary to unmerge vim. You could probably get away with running emerge --update vim gvim
Tags: gentoo, vim, git, ebuild
Burning a DVD Video on Gentoo
Quick note for my future self
Overview
- Convert media to dvd compatible format
- Author DVD title
- Author DVD Table of Contents
- Convert DVD folder to ISO
- (Optional) Loopback mount ISO and test.
- Burn ISO to DVD
Packages Required
media-video/ffmpeg
media-video/dvdauthor
app-cdr/dvd+rw-tools
Commands
Start by using ffmpeg to convert the media to a dvd compatible format:
ffmpeg -i Big\ Buck\ Bunny.mp4 -target pal-dvd BigBuckBunny.mpg
Now use dvdauthor to author a title
dvdauthor -t -o dvd --video=pal -f BigBuckBunny.mpg
Add a table of contents
dvdauthor -T -o dvd
Create the ISO file
mkisofs -dvd-video -o BigBuckBunny.iso dvd/
(Optional) Mount to a loopback for testing
mkdir mount
mount -o loop BigBuckBunny.iso mount/
Play the video using VLC or some other tool to check it, then unmount
umount mount/
Burn to a disc
growisofs -dvd-compat -Z /dev/sr0=BigBuckBunny.iso
Credit to andrew.46 over at the ubuntuforums
Tags: burn-a-dvd, gentoo, ffmpeg, linux