Properly Cleaning Up /boot Partition

This is a follow-up post to a post I made earlier today: Cleaning Up /boot Partition.

I won’t say that the steps in that post aren’t going to help clear up space, but it certainly didn’t do the trick for me. I still had a piled up /boot partition loaded with the kernel images. I can’t explain why, but completely removing them via Synaptic apparently didn’t completely remove them. So, it appears this method is more effective.

Search for installed packages named linux-image* to see the kernels on the machine:

dpkg -l linux-image*

Like before, you can find the current kernel using this command:

uname -r

I recommend keeping the current and its previous kernel, but that choice is yours. Either way, you do not want to remove the current kernel! Using the same example from the previous post, I’ll change the step to remove the same kernel images but using this method.

sudo apt-get remove linux-image-{34,35,36,37,39,40,43,44}-generic

Then, remove dependencies.

sudo apt-get autoremove


Cleaning Up /boot Partition

It’s very easy to lose track of how many times the Linux kernel is updated on your system, and, depending on the amount of space allotted to the /boot partition, you’re likely to come across an error stating that there isn’t enough space to provide updates at some point. You may be confused if you see this message, especially since it isn’t always clear where the lack of space is in the message – and you’ll easily tell yourself that there’s no way your root partition doesn’t have the 100MB of space to perform the update. Instead, it’s the boot partition that is lacking the available space.

Why? Because every time the Linux kernel is updated, the previous kernel is kept on the system as well. You might think it pointless, but it’s actually rather nice – especially if a kernel update creates an issue with something you have installed on the system. You can easily boot into a previous kernel in that situation. The problem is that there is no limit to how many kernels are stored, and so after about ten kernel updates, you’re likely going to be out of space – especially with the default 500MB partition allotment that Ubuntu and its derivatives tend to stick with.

The easiest way, in my opinion, to remove these unnecessary kernel images off of the boot partition to provide space for future updates is using Synaptic Package Manger. Some explanations state using the command line to remove the packages, but the UI of Synaptic works great for this.

The first thing I’d advise to do is look at the images stored on the boot partition. You can do that by entering this into your console:

ls /boot/

You’ll see a lot of different files listed, but the most important part of each filename is the version number. Despite the variances in the list of files (abi, config, System, etc.), they should all share the same version numbers in that part of their filenames. The thing I recommend doing is removing all but the last two, which should be the current kernel and the previous one before it. You can check which kernel the system is running with this command:

uname -r

In my situation, I had the following kernels residing on my system:


So, I’m removing kernels 3.13.0-34 through 3.13.0-44. After opening Synaptic Package Manager, first click on Installed in the left-hand column to filter out all uninstalled packages. Then, search for the first part of the version numbers for the kernels. eg.: 3.13.

Select each package title linux-headers-x.xx that fits within the kernel versions we’re removing, and after you’ve highlighted all of them click the green box next to it and select Mark for Complete Removal. You’ll notice that all of the linux-image-x.xx packages have also turned red and are selected for removal. Simply hit Apply at the top and confirm with the popup for the packages to be removed and Synaptic will do the rest. It should take only a few seconds, but less than a minute in any case.

While you’re in Synaptic, you can also remove any residual configurations by selecting Not installed (residual config) in the left-pane and removing any packages listed there as well. This will clear up any configurations left by packages that have been removed from the system – freeing up wasted space.

ReadyShare USB Storage via NETGEAR Router in Ubuntu

Okay. Maybe I’m missing something here, but I was confused about how to access an external USB drive that I decided to connect to my NETGEAR router and use as for shared network storage in my house. All searched online led to explanations of using fstab to mount the drive and map it to a location such as /media/network, which I instantly thought seemed like too much work for the simple ability of accessing a USB drive connected through the router. After all, finding such a drive is as easy as viewing Network locations in Windows, and I refused to believe that it could be any harder in Linux.

Apparently, I was right. I would have manually entered the location that I expected the drive to be in the file manager, but I don’t have an address bar that I can manually enter locations into (or I haven’t configured Nautilus to show on if it’s capable of doing so). But, as soon as I opened Nautilus and looked in the left-pane displaying locations such as Locations, Devices, Bookmarks and Network, I saw a hint as to what I was looking for: Browse Network.

As soon as I select Browse Network, I see exactly what I’m looking for. Two options, among several others, listed as READYSHARE and readyshare(for Time Machine). Both lead to the same place, a location listing USB_Storage, which was exactly what I needed. Clicking on USB_Storage reveals the contents of my USB drive that I have connected to the router’s USB port. Just to be sure I could, I created a new text file on the drive and saved a small string of text into it to make sure I would be able to alter the drive in some way from my Ubuntu PC. Everything worked as expected.

So, I really don’t know the benefit of following other explanations of accessing and manipulating storage devices in Ubuntu that are connected to NETGEAR’s ReadyShare port, but this way worked fine for me.

Install Oracle Java 8 in Ubuntu with Updates via PPA

Thanks to WebUpd8, you can install the most up-to-date JDK and JRE directly from Oracle, as opposed to using OpenJDK which is the default in the Ubuntu repositories. As far as I know, this should work for any *buntu OSes, including Linux Mint and elementaryOS. They should also get updates automatically via the Update Manager while they are within the support window for the OS version you’re using.

I know this isn’t exactly news, and WebUpd8 posted this information over two years ago now, but I was shocked to find out about it myself just recently, and figured I’d just go ahead and post it on my blog for anyone else who happens across it without knowing as well.

Here are the steps, all together, for adding the PPA and installing Java 8 (currently update 40). I also included an additional step to remove all remnants of the OpenJDK package. I’m uncertain if the presence of OpenJDK would cause any problems, but I figured its not needed and so worth it to clear up an easy ~50-100MB of space anyway.

sudo apt-get purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

The PPA is hosted at this location on Launchpad. As you will see if you visit the page, WebUpd8 doesn’t actually maintain any Java binary packages for on the PPA. Instead, it simply hosts the installers that pull the packages from Oracle’s own servers. An alternative might be to manually download and install the software from Oracle, but you would have to manually update it every time Oracle pushes out a new version. With this PPA, you will get updates for it automatically through the Update Manager for as long as your OS is within its support window.

If you prefer to use version 7 instead, you can issue the following commands to install the JDK and JRE packages installer for version and alternate the versions used.

sudo apt-get install oracle-java7-installer
sudo update-java-alternatives -s java-7-oracle

Then just use the following command to return to version 8, if you decide to.

sudo update-java-alternatives -s java-8-oracle

phpBB3: In-Line Code

One of the best features that was added in phpBB3 when it came out was the ability to add custom BBCodes for use in forum posts. It made it possible to include abilities like text effects, embedding videos and other things without having to use mods. It’s one of the best features in phpBB, and it’s also one reason why I prefer it over competitors like SMF (which, as far as I know, don’t even have this ability in the upcoming 2.1 release).

If discussions in your board center around programming, it’s probably worthwhile to you for posters to have the ability to bring attention to certain words or characters in their posts, particularly related to code, without the need to isolate it inside of a <div> the way the standard BBCode block does. Fortunately, it's extremely easy to do.

Assuming you're familiar with the phpBB ACP, navigate to the POSTING -> BBCodes section, and select Add a new BBCode.

You can use whatever you wish for the actual BBCode, but I chose iCode to keep it relatively simple and similar to the standard Code BBCode option.

For the BBCode usage section, define the usage as shown (with the exception of using a different BBCode name):


Then under HTML replacement, put the following:

<code style="background-color:#FFF; color:#2E8B57; border:1px solid #C9D2D8; padding: 0 1px; font:0.9em/1.3em Monaco,'Andale Mono','Courier New',Courier,mono;">{TEXT}</code>

Lastly, define a help-line, if you wish to have one, and select whether or not you want the button for the BBCode displayed on the posting page. Then just hit Submit, and you're done!

Here is how the text placed within the BBCode will look in a post (using prosilver):

phpBB3 In-Line BBCode

If you're using a different style other than prosilver, it may be worthwhile to define CSS style elements inside the theme stylesheets for each style so that the in-line code will look different depending on the style your forum users are using. In that case, you would want to use something like the following for your HTML usage section for the BBCode:

<code class="inline-code">{TEXT}</code>

After all, it would be more appropriate for this BBCode to style text in the post to follow the way it does in the regular Code block, that way people know what they're looking at.

Just remember that text placed inside of custom BBCodes is still parsed the way all other text in the post is, and so using other BBCodes within this one will result in the effects of those other BBCodes still being applied rather than showing them in an un-parsed format the way the standard Code BBCode tag does.

Nexus 7 (2012): Revert to Previous Firmware using Ubuntu 14.04

First of all, this is for the 2012 version of the Nexus 7 Wi-Fi. Though the steps for doing this on other Nexus devices may be similar enough to make following this post safe, I would still try to find some verification of that before doing it. Second, this will wipe the tablet of all data, applications and settings. With the exception of items that can be recovered via Google’s account backup service, you will lose everything on the tablet. I recommend using the USB link to back up any data you wish to keep before continuing.

I decided to post this after doing some research and reverting my Nexus 7 tablet – which had recently been updated to Android 5.1 – back to Android 4.1.2. If you’re wondering why I’d want to revert back, it’s safe to say you haven’t ran Lollipop on the 2012 Nexus 7. In fact, I haven’t ran it either, because crawled it would be a more fitting description. I suppose it’s to be expected that an OS three years newer than the hardware it’s installed on might make that hardware run sluggish, but I think it should be unjustified for a company with Google’s technical foundation to even release such an update for the device if it is going to be incapable of running in a state that provides any kind of real experience. A lot of us are used to being a step or two behind when it comes to Android updates anyway, especially with the pace that most phone manufacturers push out their updates.

To get back on subject, the process of reverting the Nexus back to an older version was actually quite easy. Though all of the tutorials and examples online referred to doing it from Windows – with occasional references to Mac in the form of “oh, just change this command to be like this,” nothing referred to using Linux. In fact, I couldn’t even find a location to download fastboot for Linux. Luckily, I didn’t need to. Apparently, Ubuntu has both fastboot and adb compiled in the repositories – at least for Ubuntu 14.04 – and supposedly from version 12.10 on. I believe there’s a PPA you can add to grab it if you’re using 12.04 or earlier, but I can’t speak to that from experience.

As far as the process of reverting the tablet to a former version goes, you can start with grabbing the image of whichever version you’re looking to revert to from Google’s page for factory Nexus images. Based on what I’ve seen since reverting back, OTA updates seem to be in succession, so you’ll be updating to the next immediate version (eg: from 4.1.2 to 4.2.2), in case you are afraid that you will have to re-image the tablet to go from one older version to a newer version that isn’t 5.1 Lollipop. You also want to make sure you have fastboot installed on your computer from the Ubuntu Software Center.

Make sure the tablet has USB debugging enabled. In newer versions of Android, you have to reveal the location, which is hidden by default, in Settings by first going to Settings -> About tablet and tapping several times on the Build number field. You’ll see a small message pop up saying that you’re on your way to becoming a developer. After a few more presses, there will be a new settings location under the System category titled Developer options, which holds the setting for enabling USB debugging. Make sure it’s enabled.

Next, power the tablet off, and then restart it by holding down all three physical buttons simultaneously (Power + Volume Up + Volume Down) until you see the Google splash screen and the Android bootloader screen. Lastly, make sure the tablet is plugged into the computer’s USB port using the charge cable. At this point, you’re done with the tablet itself and can set it aside (somewhere it won’t get knocked around!).

Now navigate to the tgz file for the factory image you downloaded. First, extract the archive. Then, open a terminal and navigate to the directory where the tgz and extracted folder are located. In my case, it was my Downloads folder, which can be easily accessed by:

cd ~/Downloads

Next, check the hash value of the archive and make sure it matches the one listed on Google’s page for the factory image you downloaded. In my case, I used 4.1.2. If using a different Android version, or the 3G tablet (which is codenamed nakasig instead of nakasi), you will obviously have a different filename.

jerry@Ubuntu:~$ md5sum nakasi-jzo54k-factory-973f190e.tgz
d906b505ccae0d439839d3c5fafb137a  nakasi-jzo54k-factory-973f190e.tgz

If the hash value matches, we’re good. If not, you need to re-download the file and check again. Assuming the hash was good, navigate to the folder that was extracted.

cd nakasi-jzo54k

Now we need to verify that fastboot recognizes the tablet is connected to the computer. If you just type fastboot into the terminal, it will return some information for what commands and options can be pushed to it. The command we need is devices.

fastboot devices

If the terminal line breaks directly back to prompt without listing any devices, it means the computer is not able to communicate with the tablet. You may need to restart the tablet, or you may not have enabled USB debugging. Otherwise, you’ll see a serial number beside the word fastboot.

Assuming your device was recognized, it’s now time to unlock the bootloader (which will wipe the tablet – make sure you backed up any important data beforehand) and flash the image.

fastboot oem unlock

At this point, the tablet will display a screen warning about unlocking the bootloader (guess I was wrong about being done with the tablet). Make sure Yes is selected and hit the power button. Once it returns to the bootloader screen, proceed with flashing the image to the tablet.

At this point, a lot of tutorials state to enter each fastboot command manually. If you look at in a text editor, you’ll see that the shell script enters the exact same commands, but saves you the work of doing it. I decided to use the shell script.


At this point, you’ll see fastboot spitting some information and time lapses into the terminal. You want to leave it alone until it finishes. You’ll know when it’s done, because it will end with the following lines:


finished. total time: 105.989s

The value for total time will vary, but it typically shouldn’t take more than 2-3 minutes. Still, I would wait for 30 minutes if it seemed to take that long, because I would assume that trying to interrupt the process could cause problems for the tablet.

After the process has finished, the tablet will automatically restart and boot into the reverted Android version. It will prompt you with a screen similar to the one it did when you bought the tablet and turned it on for the first time. At this point, I would follow the prompts and any steps it has you do to initialize the tablet. But once you’re at the home screen, you will want to go to Settings -> Developer options, turn the slider from OFF to ON and then check to enable USB debugging. Now turn the tablet back off and reboot into the bootloader.

Once you’re into the bootloader and verified with fastboot that the tablet is recognized, re-apply the bootloader lock to re-secure the tablet and help protect your data.

fastboot oem lock

The main reason for doing this is to protect the data on your tablet, in case it is ever lost or stolen. If the bootloader is locked, fastboot and adb cannot be used to access or manipulate data on the tablet – and unlocking it again will wipe the data again. If it is left unlocked, this safeguard will not be in place.

Virtualmin: Default IPv4 Address of

If you’ve installed Virtualmin on your fresh VPS, ran through its initial checks, and then try to add a new Virtual Server only to find that it keeps detecting and setting as the default IPv4 address, here’s how to fix this problem.

For reference, you can determine the proper network interface to use by going to Webmin -> Networking -> Network Configuration -> Network Intefaces, which will bring you to the screen you see here.

Webmin - Network InterfacesThe line that has the red marker blocking out the IP would be the one of importance. This should be where your actual external IPv4 address is shown. Due to the fact that this seems to be an issue mainly for OpenVZ VPS servers, it’s likely that the interface will be the same for you as it is in my example: venet0:0.

To fix the issue, head over to Virtualmin -> System Settings -> Virtualmin Configuration, and then in the drop-down menu at the top of the page select Network settings. There’s a chance that the value for Network interface for virtual addresses will be defined rather than being set to Detect automatically. If so, it will likely be venet0. Either way, the setting needs to be changed. This is what the configuration page looks like in my situation.

Virtualmin - Network Configuration (Original)It needs to be changed to whatever interface was configured with your real external IPv4 address from the Network Interfaces section in Webmin – which is likely venet0:0, as already mentioned. Whatever the case, manually set the interface to whatever it is for your situation and click Save.

Virtualmin - Network Configuration (Changed)As soon as the change is applied and the page reloads, Virtualmin should display an alert informing you that the primary address has changed and virtual servers using the incorrect address may be unreachable or serving the wrong material. Simply click the button Update Incorrect IP Addresses to have Virtualmin bring you to the configuration page where you can correct the address for all Virtual Servers you have configured simultaneously.

Virtualmin - Update Incorrect IP AddressesThe Change IP Addresses configuration page should have all necessary changes automatically populated for you. You should only have to hit the Change Now button to apply the changes and complete the process.

Virtualmin - Change IP AddressesI hope this helps.

phpBB 3.1: prosilver Forum Heights

I like some of the new additional features in the phpBB 3.1 branch, but I personally am not a big fan of the way forum tables are styled. In the 3.0 branch, I used a mod to display the last post subject on the board index, but this was a feature included in 3.1 by default. Whereas a lot of people seemed to hate how wide the last post column was in prosilver for 3.0, it worked out well for me, because it made sure I had plenty of space to accommodate the text for the post subject – as well as to include the poster’s name, moved to the line with the time-stamp, without having to break to a third line. That made it possible to keep the rows narrow and, in my opinion, more appealing.

Well, I’m admittedly not very educated when it comes to styling or using CSS, so I really couldn’t determine how to make the changes to the prosilver style in 3.1 to have the same width distribution as it had in 3.0. I didn’t want to blindly tinker too much either, just in case any changes I might make would create issue with other elements in the board’s style. But what I thought was worth doing, and should have been done by the style team anyway, was to just set a minimum height for the rows. The reason I think this is worth doing, and should have been done by the phpBB style team by default, is because it is extremely ugly, in my opinion, to see the typical narrow forum rows for forums that have no posts, and then see the expanded rows for the forums that do have post info. If nothing else, it should have been consistent.

I found that the height of forums that have posts in them tend to be 50px after accommodating for the subject, author and time-stamp. So, I simply made that small change to those forum table styles to make it so that they were always a minimum of 50px in height. The colours.css file in the style’s theme folder is the one that holds these settings.

If you want to make this change, just open colours.css and find the following lines:

.forum_link			{ background-image: url("./images/forum_link.gif"); }
.forum_read			{ background-image: url("./images/forum_read.gif"); }
.forum_read_locked		{ background-image: url("./images/forum_read_locked.gif"); }
.forum_read_subforum		{ background-image: url("./images/forum_read_subforum.gif"); }
.forum_unread			{ background-image: url("./images/forum_unread.gif"); }
.forum_unread_locked		{ background-image: url("./images/forum_unread_locked.gif"); }
.forum_unread_subforum		{ background-image: url("./images/forum_unread_subforum.gif"); }

And just define a minimum height for each one with min-height: 50px;.

.forum_link			{ background-image: url("./images/forum_link.gif"); min-height: 50px; }
.forum_read			{ background-image: url("./images/forum_read.gif"); min-height: 50px; }
.forum_read_locked		{ background-image: url("./images/forum_read_locked.gif"); min-height: 50px; }
.forum_read_subforum		{ background-image: url("./images/forum_read_subforum.gif"); min-height: 50px; }
.forum_unread			{ background-image: url("./images/forum_unread.gif"); min-height: 50px; }
.forum_unread_locked		{ background-image: url("./images/forum_unread_locked.gif"); min-height: 50px; }
.forum_unread_subforum		{ background-image: url("./images/forum_unread_subforum.gif"); min-height: 50px; }

Now all rows displaying forum names and post information will have the same height, whether they have a post to display information for or not.

Note that you may have to purge your forum’s cache from the ACP after making the changes.