the itjerk

my adventures with technology

Tag Archives: Ubuntu

raid, finally

I’ve always kept my media on a second drive in my linux box and backed it up to a remote NAS. While a perfectly acceptable setup, what I always wanted was two mirrored drives with all my data. The computer already a WD Red 1TB drive so I thrilled when I found another of the exact same drive for $67. Always a best practice to use the same model when building a mirrored RAID1.

I bought a Syba 2-port SATA RAID controller card that plugged into the empty PCI-e slot on the motherboard. It was only $25, but honestly if I had a motherboard with more features, I wouldn’t have needed it. Nonetheless, after moving the drives around in the case so the power connectors would match up to all the drives, I booted the computer and used CTRL-R immediately to get to the card’s BIOS to setup the RAID. It didn’t initially recognize all the drives, so I booted into Ubuntu and used the program Disks to format the new drive. (I also edited /etc/fstab and took out the reference to the old single drive). Rebooting again, the card recognized both drives, and then setup them up as a RAID1 using the card’s BIOS utility.

Continuing into Ubuntu, I again ran Disks and formatted the new single drive. I then edited /etc/fstab with the new mount point (which I had to create), and then ran a sudo mount -all to access it.

Now it’s time to copy everything back to my new mirrored data drive. Remember, when it comes to data, you must have two copies of everything you’d ever expect to keep. But two drives mirrored are really only one copy (think accidental erase), so I’ll still need to keep a backup of files I want to keep forever.

ubuntu 16.04 xenial xerus

Last week the first point release for Ubuntu 16.04 LTS triggered the update on my 14.04 computer and I went for it. There are several questions that pop up and need an answer for the upgrade to continue, so it’s an attended upgrade. I didn’t pay too much attention to what was upgraded, removed, not supported, etc, I just figured I would figure out whatever I need to.

Drupal 6 did work because 16.04 ships with Php7, but it was easy enough to install Php5.6, with the help of this repository (the guy is an official packager for Debian) so now I again have a local copy of my website.

I also needed to upgrade Logitech Media Server to 7.9, which is a beta version, but once installed, my Slimserver – the thing that got me into linux so many years ago – started working again right away.

I have to admit, that with the LTS releases, there really isn’t much of a point to upgrading, because the base distribution is supported for five years. At that point, it’s time for a new computer and a clean install.

On the web: Xenial Xerus

ubuntu not enough free space

I went to do updates today and I got the following message. Seems my /boot partition doesn’t have enough space to update to the newest kernel.
Screenshot from 2014-08-14 20:42:55
Seems autoremove isn’t working. This is easy to fix, but the potential for n00b disaster is high. First, get your current kernel version by issuing:

 uname -r

Now let’s go to /boot and take a look at what’s taking up all the room /boot:

cd /boot
total 152330
drwxr-xr-x 4 root root 3072 Aug 12 17:41 .
drwxr-xr-x 23 root root 4096 Aug 12 17:41 ..
-rw-r--r-- 1 root root 1161764 Jun 4 16:57 abi-3.13.0-29-generic
-rw-r--r-- 1 root root 1162257 Jul 4 17:18 abi-3.13.0-30-generic
-rw-r--r-- 1 root root 1162712 Jul 14 23:29 abi-3.13.0-32-generic
-rw-r--r-- 1 root root 1162712 Jul 29 12:41 abi-3.13.0-33-generic
-rw-r--r-- 1 root root 165544 Jun 4 16:57 config-3.13.0-29-generic
-rw-r--r-- 1 root root 165576 Jul 4 17:18 config-3.13.0-30-generic
-rw-r--r-- 1 root root 165611 Jul 14 23:29 config-3.13.0-32-generic
-rw-r--r-- 1 root root 165611 Jul 29 12:41 config-3.13.0-33-generic
drwxr-xr-x 5 root root 1024 Aug 12 17:41 grub
-rw-r--r-- 1 root root 28137510 Jun 13 08:43 initrd.img-3.13.0-29-generic
-rw-r--r-- 1 root root 28189493 Jul 6 09:09 initrd.img-3.13.0-30-generic
-rw-r--r-- 1 root root 28223565 Jul 23 16:24 initrd.img-3.13.0-32-generic
-rw-r--r-- 1 root root 28222396 Aug 12 17:41 initrd.img-3.13.0-33-generic
drwx------ 2 root root 12288 May 22 13:20 lost+found
-rw-r--r-- 1 root root 176500 Mar 12 07:31 memtest86+.bin
-rw-r--r-- 1 root root 178176 Mar 12 07:31 memtest86+.elf
-rw-r--r-- 1 root root 178680 Mar 12 07:31 memtest86+_multiboot.bin
-rw------- 1 root root 3378267 Jun 4 16:57
-rw------- 1 root root 3378641 Jul 4 17:18
-rw------- 1 root root 3381262 Jul 14 23:29
-rw------- 1 root root 3381262 Jul 29 12:41
-rw------- 1 root root 5792544 Jun 4 16:57 vmlinuz-3.13.0-29-generic
-rw------- 1 root root 5792608 Jul 4 17:18 vmlinuz-3.13.0-30-generic
-rw------- 1 root root 5798112 Jul 14 23:29 vmlinuz-3.13.0-32-generic
-rw------- 1 root root 5798688 Jul 29 12:41 vmlinuz-3.13.0-33-generic

Yep, a whole bunch o’ files, previous kernels that I no longer need. Let’s delete them by purging them with apt-get. Remember, don’t delete your current kernel!

sudo apt-get purge linux-image-3.13.0-29-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-3.13.0-29-generic* linux-image-extra-3.13.0-29-generic*
0 upgraded, 0 newly installed, 2 to remove and 15 not upgraded.
After this operation, 193 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 347115 files and directories currently installed.)
Removing linux-image-extra-3.13.0-29-generic (3.13.0-29.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.13.0-33-generic
Found initrd image: /boot/initrd.img-3.13.0-33-generic
Found linux image: /boot/vmlinuz-3.13.0-32-generic
Found initrd image: /boot/initrd.img-3.13.0-32-generic
Found linux image: /boot/vmlinuz-3.13.0-30-generic
Found initrd image: /boot/initrd.img-3.13.0-30-generic
Found linux image: /boot/vmlinuz-3.13.0-29-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Purging configuration files for linux-image-extra-3.13.0-29-generic (3.13.0-29.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
Removing linux-image-3.13.0-29-generic (3.13.0-29.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.13.0-33-generic
Found initrd image: /boot/initrd.img-3.13.0-33-generic
Found linux image: /boot/vmlinuz-3.13.0-32-generic
Found initrd image: /boot/initrd.img-3.13.0-32-generic
Found linux image: /boot/vmlinuz-3.13.0-30-generic
Found initrd image: /boot/initrd.img-3.13.0-30-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Purging configuration files for linux-image-3.13.0-29-generic (3.13.0-29.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic

Gone! Now do those updates.

linux box, clean install

Hardware all happy, it’s time to do a clean install of Ubuntu 14.04 LTS. The most important step before installing is to get a complete backup and a list of applications/settings etc. before tearing down the old computer! It’s also a good time to think about your new system, so consider what needs to be installed, and what needs to stay backed up, and what needs to be forgotten.

After installing from disk and running apt-get update/upgrade, there are a few usability tweaks I want to do right away:
1. Add packages nautilus-terminal, openssh-server, numlockx, update-motd, weather-util, landscape-common.
2. Setup ssh keys for my hosted server, and secure sshd!
3. Disable guest login in lightDM.
4. Import bookmarks and set panel applets (this could be a lot easier Canonical).
5. Fix writing to USB drives, then flash motherboard bios (F9 to F12)
sudo hdparm -r0 /dev/sdg

1. Configure router DHCP to give computer a fixed IP via MAC address.
2. Set privacy options in Unity. Include Imageviewer and Movie ;).
3. Install firewall (using gufw).
4. The fstab entries: Mount my new media hard drive. Side note here, always, always mount these things to /mnt/. The /media/ directory is not for anything in /etc/fstab. My backup directory (which is on a NAS drive), I have to enable cifs-utils, and set the cifs password.
5. Restore data from backup, sparingly.
6. Install applications, ditto.

Music stuff:
1. sudo apt-get install eyed facc lame flac vorbis-tools moc sox
2. I also installed Audex, Banshee, EasyTag, DeVeDe, Asunder, VLC, Audacious and Audacity.
3. Reinstall Logitech Media Server, located here.

1. Reinstall LAMP. You’ll be prompted to set MYSQL password, so be prepared with the one for your old databases!
sudo apt-get update.
sudo apt-get install tasksel
sudo tasksel install lamp-server

2. Create empty MYSQL databases, then restore backups. It’s as easy as:
mysql -u root -p
Create database databasename;

mysql -u root -p databasename < path/to/backup.sql
3. Copy website backup to /var/www (or wherever), fix permissions. Then set initial directory in sites-available/default.conf and restart apache2.
4. For Drupal, I need to install php5-gd and add cron.php to crontab. For clean urls, I need to enable mod_rewrite (a2enmod rewrite) and configure .htaccess by adding this to sites-available/default.conf:

<Directory /var/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

5. Restart apache2.

Because I now have a speedy SSD drive (oh yes, it’s fast!), I read up on potential tweaks to improve performance and life of the drive. With 14.04, the trim command is executed weekly (/etc/cron.weekly/fstrim) by default. This is fine because my box is on 24/7, otherwise it should be moved to rc.local so it executes on boot. If you want to check if trim is enabled, try this script:
sudo hdparm -I /dev/sda | awk '/.*TRIM supported.*/{ if ($1 == "*") print "Yes, TRIM is enabled"; else print "No, TRIM is not enabled.";}'
1. Add noatime parameter to /etc/fstab for / to disable file read stamps.
2. Create a virtual file system with /etc fstab:
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0
3. Then, move browser Firefox and Chromium caches to /tmp
4. Change swappiness? Actually I don’t use swap. RAM is cheap and faster!
5. Finally, I debated moving /home off the SSD, but couldn’t discern any benefit: I mean, every $$$ notebook ships with one, right? Easy to get sucked into all the tweaking… So I’ll opt for just paring down what’s in my home folder, and moving music, photos and videos to my /mnt/media drive. Heck I should buy another disk and create a RAID 1 for all that media…

Anyway, that’s got me up and running. Job complete.

Ubuntu LTS the only way to go

When I first configured my cloud server, I was under the impression that I would just be trying it out, a test environment. It didn’t occur to me that I’d actually put it in production. Flippantly, I chose 12.10 instead of opting for 12.04 LTS, which is supported through May 2017. Well, 13.04 was already out of service by the time I got my notice that 12.10 was end-of-life, so the upgrade path was 12.10 -> 13.10 -> 14.04 LTS. Good news is that was easy enough to do. Bad news was 13.10 broke Apache’s Auth_MYSQL, which is used with AWSTATS in iRedMail. 

Like a good itjerk, I didn’t panic, went straight from 13.10 to 14.04 LTS, and would worry about the mess from there. Ends up that Auth_MYSQL isn’t supported in Apache 2.4.x, which is what 14.04LTS ships with. So I had to switch to Auth_DBD instead. Zhang at iRedMail was very helpful, and I got everything back up and working. BTW, Denyhosts is no longer supported in 14.04 LTS, that package had to be purged.

Apache2.conf needs this:

DBDriver mysql
DBDParams "host= port=3306 dbname=mail user=mail pass=xxxx

While awstats.conf needs:

AuthType Basic
AuthName "Authentication required"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s"
Require valid-user

Then, do this:
a2enmod auth_dbd
apt-get install libaprutil1-dbd-mysql
service apache restart

Moral of the story: Use LTS. Always. 

ubuntu edge

It's a tall order to crowdfund a very high-end smartphone, especially when the goal is $32,000,000 – yes, that's 32 million dollars. But why expect anything less than stunning from Ubuntu? The idea is "to provide a low-volume, high-technology platform" device, namely the Ubuntu Edge. It will run (the very latest?) Android OS out of the box, but soon after launch (and through a planned update) the phone will provide the so-called integrated Ubuntu experience, "seamlessly between the two environments" of your desktop and smartphone. Here's Mark Shuttleworth:

The fun begins in mid-2014, but funding must be met by August 22nd 2013. I'm in! Please visit:

On the web:
Ubuntu Edge Indiegogo

Update 08/22/12 – Funding, while achieving $12,814,196, did not reach the intended goal. Next…

google nexus 4

T-Mobile recently came out with the "un-plan" – no contract and unlimited talk/text and data (up to 500MB at 4G) for only $50 a month. Considering I was paying $49.99 for considerably less service, it was a very good "upgrade" for me. It also coincided with my two year anniversary with my old LG Optimus-T. A good phone, it was getting a little long in the tooth, especially once I started using my Google Nexus 7 tablet, which features Android 4.2 (Jelly Bean).

I purchased the Nexus 4 from Google direct, and the number one reason for my choice was price: $299 for the 8GB model (which was really $341 by the time it got to my door). No contract, no monthly payment, no waiting for an anniversary, I straight up bought the phone. It's comparable in features to the Samsung Galaxy S4, HTC One and probably even iPhone 5, but make no mistake, price was the deciding factor. The phone is made by LG, and known as their LG E960. You can read all about it's features at the link below.

And after two years with the Optimus-T, yes, I did have a change of heart with "cheap phones". So, yes, I did pay a fair amount for the Nexus 4. Maybe it's because of the Nexus 7, or maybe the maturity of the Android operating system, but cheap phones don't cut it anymore. I wanted a phone that can do everything, quickly, and I want the full-features of a top-of-the-line phone. Nexus 4 fit the bill.

Ordered over the weekend, it arrived to my door by Wednesday. I was eager to set it up, but that quickly was dashed when I realized that I needs a micro-sim card, and not the regular sim (Subscriber Identity Module) card from my old phone. I called T-Mobile and they assured me that I could go to a local T-Mobile store and they'd replace mine, without charge. Good thing he put a note in my account record, as the guy at the store first quoted me $30 for one (which was more than the $22 the guy on the phone quoted!).

Okay, got the new micro-sim card, used the tool to stick it in the Nexus 4, and then had to call T-Mobile to get it activated. Was a little disappointed when the rep asked for the sim number, as the guy at the store didn't give me the card the sim was mounted to (requiring me to take it out of the phone and squint like crazy to read the numbers).

When I started the phone, it immediately asked me if I wanted to sign into my Google account, and have Google manage my phone backup. I happily did, and after downloading a ton of stuff (yes, I was on Wi-Fi), most every app that was installed on my Nexus 7 tablet was now installed on my phone! I suppose you can argue whether that's a good thing or not, or about privacy concerns with having everything linked to the big G, but what's the point? It's just too easy.

I had a favorite ringtone (Neu's Euphoria) on my old phone, but when I plugged the Nexus 4 into my computer running Ubuntu 12.04 LTS to copy the mp3 file, it didn't mount. That's because the Nexus 4 uses MTP (Media Transfer Protocol). Fortunately, it was an easy fix, I just installed the Gnome virtual file system and rebooted.

sudo add-apt-repository ppa:langdalepl/gvfs-mtp
sudo apt-get update
sudo apt-get upgrade

Now, if I would have only known to copy the file to the Ringtones folder on the Nexus 4…

On the web:
Nexus 4 Tech Specs

ubuntu 12.04 LTS precise pangolin

The latest version of Ununtu Linux operating system was released today. Named "Precise Pangolin" and carrying the number 12.04, it is a LTS (long term support) release that will be supported for the next five years.

Installation was painless after a reboot of the previous 11.10 was needed to get the "Distribution Upgrade" button to show up in Update Manager. Unity is still Unity, and I'm beginning to care less and less about specific applications, themes, HUD, global menus, etc. The work is what is important. Banshee was replaced by Rhythmbox; it also crashed when I attempted to run it, so it was quickly removed. I did get a few "internal errors" when Rhythmbox did its import, but smartly enough, I was informed that they were already reported. There was also a kernel update immediately after the upgrade.

On the web:
Download Ubuntu

Ubuntu 11.10 mysql problem after upgrade

If you find that mysql doesn't run after upgrading to 11.10, it could an issue with the fact that /var/run was replaced with /run.

Check /var/log/mysql/error.log, and you'll find something like this:

111104 19:11:33 [Note] Plugin 'FEDERATED' is disabled.
111104 19:11:33  InnoDB: Initializing buffer pool, size = 8.0M
111104 19:11:33  InnoDB: Completed initialization of buffer pool
111104 19:11:34  InnoDB: Started; log sequence number 0 44233
111104 19:11:34 [ERROR] Can't start server : Bind on unix socket: Permission den
111104 19:11:34 [ERROR] Do you already have another mysqld server running on soc
ket: /var/run/mysqld/mysqld.sock ?
111104 19:11:34 [ERROR] Aborting

Or if you try to login to mysql, you'll get this:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Well, here's the fix! Go edit /etc/apparmor.d/usr.sbin.mysqld as root and replace

  /var/run/mysqld/ w,
  /var/run/mysqld/mysqld.sock w,


  /{,var/}run/mysqld/ w,
  /{,var/}run/mysqld/mysqld.sock w,


sudo service mysql restart

and viola! our mysql db's are back!

Ubuntu 11.10

Did the distribution upgrade to Ubuntu 11.10 on Thursday. Unity is now the default desktop. Yes, it's different, but so is Gnome 3.0. (which is as easy to install as sudo apt-get install gnome-shell). I'm not fond of the Mac-like "global menu", and switching between open windows is a pain – there's just some dots on Dash. It's also not that configurable – just check out CompizConfig Settings Manager. I mean, what if you don't want to save recent documents?

Took the computer a few boots for Ubuntu to recognize my Intel® G33 x86/MMX/SSE2 graphics. Unity still is not that happy, and it looks like I'm stuck running the 2D version. Anyway, it is functional enough and I'm going to get used to it, especially if I can get Nautilus to stop crashing all the time (is this the nautilus-open-terminal bug?)!

BTW, only application hiccup was that I needed to upgrade Squeezebox Server from 7.6.x to version RC 7.7.x – now called Logitech Media Server.

On the web:
Good tweaks from Webupd8
Launcher tweaks from Askubuntu