On Upgrading Gentoo

So a few weeks ago, I started running into problems updating Chromium. If you have not checked it out, by the way, it’s about as fast as custom-compiled firefox, and takes as long to compile. Anyway.

After a few days, the problem spread to LightDM. I could no longer update LightDM either.

Two days ago, upgrading anything became impossible, due to incompatibilities between packages (they said they conflicted: only a Use flag difference was causing it).

I decided this was a real problem. So, what I did was simple: I reorganized my “package.use” file. This is under /etc/portage/package.use, and if you have not manually cleaned it up, you may have a problem.

I removed about 90% of the lines in the file, moving some to make.conf, and deleting others that were no longer really necessary. Hint: If you enable the “icu” flag on a single package, it’s probably a really good idea to enable it globally. It can cause a mess of dependencies if you don’t. My package.use now looks like this:

# Just good ideas, user added!

sys-libs/zlib minizip
app-admin/conky lua lua-cairo lua-imlib iostats
media-plugins/alsa-plugins pulseaudio
x11-libs/libdrm libkms video_cards_nouveau video_cards_radeon
media-libs/mesa xa gles2
net-wireless/bluez test-programs
net-fs/cifs-utils -acl upcall
x11-terms/aterm background
app-editors/gobby avahi
# Fluxbox vim syntax
x11-wm/fluxbox vim-syntax
# Claws Mail plugins
mail-client/claws-mail webkit

#====================================================#

# Added by emerge wanting stuffs.

# required by sys-devel/clang-3.3-r100
# required by clang (argument)
=sys-devel/llvm-3.3-r1 clang
# required by xfce-base/thunar-1.6.3[udev]
# required by xfce-base/xfdesktop-4.10.2[thunar]
# required by xfce-base/xfce4-meta-4.10
# required by xfce4-meta (argument)
>=gnome-base/gvfs-1.16.3 udisks
# required by sys-devel/prelink-20130503
# required by app-emulation/wine-1.7.0[prelink]
# required by wine (argument)
>=dev-libs/elfutils-0.156 static-libs
# Firefox wants this. Don’t ask.
dev-lang/python sqlite

I removed most of the version information (the >=, =, and numbers after the package atom) because I figured that it didn’t make sense to limit it in that way, clutter the package unnecessarily. If I update beyond the use of a particular flag, I want to remove the USE flag, not keep it around forever.

I removed about 50-60 lines (remember, this includes the comments that emerge inserts if you “emerge –autoumask-write” and “dispatch-conf”)  regarding Chromium, 30 talking about enabling a single USE flag that selects a ruby version. “ruby_targets_ruby20” or something like that. I moved the “icu” flag to make.conf, and the same with the ruby targets (if you are going to compile something with ruby, don’t you want everything running the same version?) and deleted most of the specific use-lines installed for chromium. Too many inter-dependencies, and besides, many of them were just the “icu” flag.

I thought I was done, so I ran my emerge line “emerge –ask –update –deep –changed-use –with-bdeps=y –backtrack=50 @world”, and was on my way!

Except I wasn’t.

LightDM, GPM, and Chromium still failed to build.

Reading the report just a tiny bit before the build news (why the last lines of this are not recorded, I don’t know), I noticed the line going something like “Couldn’t find JSON.pm in @INC” and scanning forward in the line, I saw the word “perl.” Well, I knew what to do with that! I switched to another tmux pane, and entered “cpan JSON” and as you can imagine, it didn’t work. Then I tried “cpan JSON.pm” and it installed something! I reran the update, and got a different perl module missing, I installed that too. I repeated this a few times, and now my system is completely updated.

OwnCloud – Part 4 – Finishing the Cloud

I have 2 goals right now.

First, I should point out that enabling SSL was just a matter of wandering through the settings page of OwnCloud itself. No problems at all, although I don’t have a valid certificate…

Anyway.

So I want to: Have a static IP address on the Pi (So far, I have used DHCP) and to get my local Gentoo computer (Hello!) running a CLI interface, so I can use my OwnCloud as a normal folder. Sure, it may be a little slow, but it’ll work.

Piece of advice. DON’T stop DHCP before the alternative is ready. You will kill your SSH connection. (This guy here). If you have a physical terminal, power to you.

So I’ll start with the Gentoo Client.

emerge –ask davfs2

# Following the Ebuild’s instructions…

vim /etc/davfs2/secrets

And then echoed the string required to the /etc/fstab file.

Good resource for signing Apache:

http://superuser.com/questions/73979/how-to-easily-create-a-ssl-certificate-and-configure-it-in-apache2-in-mac-os-x#74012

And the static IP tips should be followed from the official wiki.

 

OwnCloud on the Pi – Part 3 – OwnCloud

So it turns out that Gentoo has a package for OwnCloud already! Only the OwnCloud database doesn’t show it, and I want to run 2 owncloud implementations side by side (Family and Girlfriend). So I decided to go ahead and make sure everything would work fine…

First, I made sure I had the dependencies.

emerge –ask –onlydeps owncloud

It installed a list of things. When I tried to `emerge owncloud` it told me through symbols

[ N    *] Owncloud

that there was a missing keyword. So I decided not to trust that.

Instead, I figured I had installed enough, and downloaded the tarball to my wbeserver root (as /owncloud). This will become my family OwnCloud.

tar -xjvf own<TAB>

Just a note, when I say <TAB>, I mean “Press Tab and auto-complete, it’s not worth typing out”. If you have not yet learned Tab Autocompletion on the shell, then you are missing out and must learn right now.

I navigated to the webserver in my browser (I copied `owncloud` to /var/www/localhost/htdocs/, so I went to “192.168.18.6/owncloud”) and got a nice error:

Can’t create data directory (/var/www/localhost/htdocs/owncloud/data)

This can usually be fixed by giving the webserver write access to the root directory.

That’d be, for this,

chown -R apache:apache /var/www/localhost/htdocs/owncloud/install/data

Except it seems it doesn’t exist yet! I need to let it be created in the installation. Except I can’t install yet… This stinks of a missing dependency, to me.

So I finished the setup of the server first, enabling “mod_rewrite” in httpd.conf, and making sure AllowOverride was set to All.

cd /etc/apache2

vim httpd.conf

grep Allow */*

I got more files than I cared to make sense of with that last search. Luckily, the OwnCloud docs tell me that, for Gentoo, /etc/apache2/vhosts.d/00_default_vhost.conf should have

<Directory /var/www/localhost/htdocs/owncloud>

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Order allow,deny

allow from all

</Directory>

and that I should run a different command to change the permissions:

chown -R apache:apache /var/www/localhost/htdocs/owncloud

So I followed the directions, and restarted Apache

/etc/init.d/apache2 restart

And got an error for my troubles.

* apache2 has detected an error in your setup:

AH00526: Syntax error on line 49 of /etc/apache2/vhosts.d/00_default_vhost.conf:

Invalid command ‘Order’, perhaps misspelled or defined by a module not included in the server configuration

* ERROR: apache2 failed to stop

Well then. Everybody seems to think I have a missing dependency. I can believe it.

Or I can just comment out the “Order”. A quick Google search tells me that’d be unadvised. So I googled the problem.

It turns out that the responsible module is loaded in httpd.conf using:

LoadModule authz_host_module modules/mod_authz_host.so

Except that IS loaded in httpd.conf! So what’s going on here?

And… then I discovered that the Order directive was removed from Apache 2.4!

The fixed version (I think, from my research) is:

<Directory /var/www/localhost/htdocs/owncloud>

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Require all granted

</Directory>

Please do let me know if I flunked it up.

Anyway, so now Apache restarts!

And this time, when I loaded OwnCloud, I was met with a prompt:

Create an admin account

Boo yeah!

Username, password, and a few minutes to wait for installation to finish. When I clicked on the “Advanced” tab, I found an option: SQLite, or MySQL. I chose SQLite, I wasn’t that interested in using something so heavy as MySQL on the Pi, and OwnCloud configures SQLite itself!

I started using OwnCloud, and I found it to be sluggish. I suppose it IS running on the Raspberry Pi, after all…. Then I realized I was running a system upgrade using Emerge, and python really bogs down the computer. I will report back on the actual speed later.

Then I read the server logs, found that OwnCloud had an htaccess problem, using the old Deny directive.

tail /var/log/apache2/error<TAB>

So I fixed the htaccess file by replacing the line with:

Require all denied

and the error died.

So, things I did: Installed OwnCloud, got it working, tested a file upload, read the se

Things to do: See how well it performs when not emerging,  and get it working over SSL.

OwnCloud on the RPi – Funtoo – Part 2 – MySQL

So where we left off, we had PHP and Apache2 working. Now, we had also installed MySQL, but had not yet done anything with it. Now’s the time to fix that. The Gentoo Wiki suggested that, since this was the first install, I should do this (It seems the ebuild ends with this message. So go figure).

emerge –configure mysql

I was presented with a warning… my hostname was not allowed to be “localhost”. Oops. So I changed that:

hostname Chester

and re-tried. It asked for a password, I gave it one, confirmed, and then it started spinning around and doing stuff.

Currently playing: “You Spin Me Round (Like A Record)” by “Dead Or Alive” on “Youthquake”

It started the server, set it up, then stopped it. Now to continue the gentoo wiki!

Start the SQL server…

/etc/init.d/mysql start

We have already set our password, so we now try to log into the server!

mysql -u root -h Chester -p

and then enter our password at the prompt, and we are in!

SQL is configured, and now we just need to remember to do whatever we must when the next step happens: We install OwnCloud.

OwnCloud on the RPi – Funtoo – Part 1

So there is almost no documentation for Funtoo itself, getting this working. So now I’m writing it!

Now, this is OwnCloud SERVER. I’m interested in the client for Gentoo… but that comes after OwnCloud is working.

I decided to start at the Gentoo Wiki article on owncloud, but it’s just a stub. Basically, what it said was useless to a person who didn’t know that form of shorthand, and had not set up a LAMP stack yet. LAMP. Google it. You want to know what it is.

My rPi didn’t have any USE flags set in make.conf, this is probably due to the special theming that can be done using eselect profile.  So I want to set up a LAMP stack…

Add "apache2 mysql" to USE in /etc/portage/make.conf. They will affect PHP and it’s dependents, and it can’t hurt, since your system will be running them majorly, and support would be nice.

L: Linux. Done

A: Apache (version 2)

emerge –ask www-servers/apache
# No configuration NEEDED, but it’s at /etc/conf.d/apache2

M: MySQL. If using a different SQL engine, this can be different. Like PostgreSQL is a LAPP stack🙂

emerge –ask dev-db/mysql

P: PHP. An awesome server-side language! Version 5.5 at time of writing. Perl or Python also would work in a LAMP stack, but OwnCloud uses PHP.

emerge –ask eselect-php dev-lang/php
# Configuration: Add “-D PHP5” to the APACHE2_OPTS, and un-comment the module line, so as to load the module.
vim /etc/conf.d/apache2

Bam. LAMP installed. Now to test it!

/etc/init.d/apache2 start

Worked for me, first try! “It works!

So now to test the PHP.

I added a page “confirm.php” to the webserver directory with the following content (partial credit goes to http://www.penguintutor.com, but I wrote the PHP).

<!doctype html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Test successful</title>
</head>
<body>
<h1>Test successful</h1>
<p>Congratulations.</p>
<p>Your webserver is working. </p>
<?php echo”<p>And PHP is working.</p>”; ?>
</body>
</html>

It didn’t work, the first time. Then I restarted apache:

/etc/init.d/apache2 restart

And it worked!

Oh, I found the Document Root… Apache2 does this strange thing where they decentralize the config files. All well and good… except the DocumentRoot (where all the HTTPD docs are) is set in a module config file… I ran the following commands to find it.

cd /etc/apache2
grep -i Document */*

And mine was located in /var/www/localhost/htdocs

I have not yet set up SQL, I’ll take care of that step soon enough.

On Installing Funtoo on the Raspberry Pi

So I have a Raspberry Pi, got it for my birthday (Thanks Grandpa!) and I was running Arch Linux on it for a while. Now, I have a confession to make. I HATE pacman. It’s just so… bloated, in so many strange ways. Anyway. So I wanted to install Funtoo. I wrote using the handy Funtoo install guide (I won’t copy it here, in case it gets outdated, but it basically told me to follow the Gentoo Raspberry Pi quikstart guide, using different tar files).

So I booted up the new system, and everything is going really well, and I’m happy, I have networking up, I switched to the swclock from the hwclock (rc scripts are so elegant!), and I was ready to pick my profile.

BAM. Errors.

# eselect profile list

!!! Error: Can’t find /usr/portage/profiles/profiles.eselect.desc

#

Well that wasn’t so nice. So I try an emerge –sync

# emerge –sync

And it spat out some error about how I wasn’t on a repository.

So I asked in the IRC chatroom, and someone pointed me to a site, which told me to run the following command (which wasn’t even referenced to in the starting guides).

# cd /usr/portage; git checkout funtoo.org && emerge –sync

So I’m running that command now, it’s taking a little while, we will see how it goes.