Tag Archives: apt-get

How to Solve the “linux-server : Depends: linux-image-server” apt-get upgrade Error Tips, Tricks and Tutorials 19 FEB 2016

After cleaning out an unexpected /boot full fault on one of the Ubuntu servers that I maintain, I next encountered an equally frustrating problem whereby apt-get stopped working thanks to a mismatched kernel version issue (introduced because of the upgrade that had failed halfway thanks to the earlier running out of disk space in /boot!).

Essentially, any apt-get operation like say “apt-get upgrade” or “apt-get install -f” would result in the operation breaking with the following string appearing in the error message:

dpkg: dependency problems prevent configuration of linux-server:
 linux-server depends on linux-image-server (=; however:
  Version of linux-image-server on system is
 linux-server depends on linux-headers-server (=; however:
  Version of linux-headers-server on system is
dpkg: error processing linux-server (--configure):
 dependency problems - leaving unconfigured

I spent a lot of time bashing away at this, trying to remove and install specific kernel versions, etc. (a lot of information on the issue can be found here), but in the end stumbled across this silly little fix that worked brilliantly efficiently:

sudo apt-get remove linux-server && sudo apt-get install linux-server

Yeah. Classics still work. When in doubt, uninstall and then reinstall!

dog fixing computer issues

How to Solve Ubuntu Server /boot full Issue Tips, Tricks and Tutorials 19 FEB 2016

If you manage an older Ubuntu server and do a lot of updates/upgrades, inevitably you’ll hit the annoying /boot full issue, which is essentially what happens when the ridiculously tiny /boot folder gets filled up with older kernel version as a result of all your upgrading.

To spot if this is in fact what currently plagues you, simply run the following command to get a quick snapshot of disk space usage:

sudo df -h

If your /boot directory is indeed full or close to 100%, you can run the following command that automatically locates and removes older kernels and headers from the system:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

With those gone, you can now clean up a bit further by removing packages that aren’t necessarily needed any more (because they were automatically installed to satisfy dependencies for the newly removed packages):

sudo apt-get autoremove
sudo apt-get --purge remove && sudo apt-get autoclean

This should solve your issue.

cat using laptop

Note: If you can’t use apt-get at all because of this problem, you can try to manually delete the kernels yourself. Run the following to get an idea of what can be removed:

dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')"

With that list now in your possession, craft a remove operation using those version numbers listed above, followed by an attempt to solve the new dependency issue with apt-get e.g.

sudo rm -rf /boot/*-3.2.0-{101,102,103}-*
sudo apt-get -f install

(As always though, tread with care though when it comes to messing with this part of your server install…)

Ubuntu Server: How to Install Applications from .deb Files Tips, Tricks and Tutorials 30 OCT 2014

It’s pretty seldom that you have to install packages that aren’t part of the official repositories (for which apt-get is king), but every now and then you will be presented with a .deb application installer file and told to install it on your server.

Luckily this is pretty painless, so long as you know the correct command, which is exactly why I’m noting it down here for future reference.

Packages are manually installed via the dpkg command (Debian Package Management System). dpkg is the backend to commands like apt-get and aptitude, which in turn are the backend for GUI install apps like the Software Center and Synaptic.

To install a .deb file, run:

sudo dpkg -i myInstaller.deb

If dpkg reports an error due to dependency problems, you can run:

sudo apt-get install -f

Running this should download the missing dependencies and configure everything automatically. If however this step reports an error… well let’s just say that you’ll have to sort out the dependencies yourself, something often referred to as “dependency hell” in the support forums!

Conversely, to uninstall a package, run dpkg with -r:

sudo dpkg -r myInstaller



XBMCbuntu: How to Upgrade Tips, Tricks and Tutorials 02 JUL 2014

I’m kind of fond of using XBMCbuntu on my media-serving PC hooked up to the Samsung flatscreen TV in the lounge, though I have had two epic failures thus far – which I can’t entirely blame on the operating system because I’m running some pretty ancient hardware with wonky drives. Anyway, the point is that I’ve had to reinstall from my install CD a couple of times, which then obviously puts me on a slightly out of date version at the end of the install process.

So the question is, how do I upgrade XBMCbuntu when doing a clean install is not really an acceptable option?

Well actually it is pretty easy – just use Ubuntu’s standard PPA and apt-get system.

First, you need a terminal to work in – ALT+CTRL+F1 will do the trick, though you can also select the Exit option from the XBMC power button menu, change the system selection from XBMC to XBMCbuntu, and log in with your username and password that you set when you first installed the operating system (if you can’t remember, then it is useful to note that XBMC’s root user account is ‘xbmc’ with a blank password).

Now, add the PPA using (You can probably skip this if you originally installed XBMC via an XBMCbuntu ISO):

sudo add-apt-repository ppa:team-xbmc/ppa

Finally, you simply run the usual apt-get update command (focused of course) to actually update XBMC:

sudo apt-get update
sudo apt-get --only-upgrade install xbmc xbmc.bin

So no surprises there and you should be all done.


(Just a note though, if you are moving up to v13, then it is suggested that you rather to a clean install, thanks to the myriad of rather substantial changes made audio wise due to a redesigned engine. If you don’t want to do this, then try removing all user configuration files for alsa or any alsa drivers)

Related Link: http://wiki.xbmc.org/?title=XBMCbuntu

Clear Up Some Space on your Ubuntu Server Install Tips, Tricks and Tutorials 25 NOV 2013

ubuntu orange logoI ran into an issue the other day installing VMWare Tools on a virtual server whereby the installer was moaning about not having enough space in the /boot directory in order to continue with the installation.

(Now of course, unless you’re a seasoned Linux pro, you don’t really want to be messing about with your /boot folder, even if you’re confident that after running uname -r you’re kind of 100% sure which kernel files you can safely remove! In other words, tread carefully and always have backups on hand.)

Thankfully there are some pretty useful commands that you can run in order to help you free up some much needed space, commands that remove unused kernels, left over dependencies, and just plain old cached .deb files!

To remove old kernels, inspect your /boot folder. If you run uname -r you’ll see your currently used kernel version. This is the one you want to keep, so make a note. (Oh, and it’s also usually a good idea to hang on one older one for just in case.)

The Ubuntu Forums offered up this particularly handy little command to list all the kernels and headers that can be removed, excluding the current running kernel:

dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')"

Now you can remove unneeded kernels one by one using the apt-get purge command (e.g. sudo apt-get purge linux-image-x.x.x-x), or you can make use of the above snippet to blast everything away at once:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

(Risky, I know, but it is a time saver if you have a lot of unused kernels lying around)

Next up in terms of clearing up some space on your Ubuntu install is making use of the sudo apt-get commands ‘autoclean’, ‘clean’ and ‘autoremove’.

From the apt-get MAN pages:

clean: clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.

autoclean: Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control.

autoremove: is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no longer needed.

First, run the autoclean package command that essentially removes partial package from the system, followed by the clean command that removes .deb packages that apt caches when you install, update, or upgrade:

sudo apt-get autoclean
sudo apt-get clean

Now run the autoremove command to remove any packages that should technically no longer be needed:

sudo apt-get autoremove

There, that should have freed up some space for you!

(Reminder to myself: I tend to Google this to get here: ubuntu server /dev/sda1 full)

Ubuntu: How to Install cURL via a Terminal CodeUnit 21 AUG 2012

The cURL library is a useful tool that allows you to connect and communicate to many different types of servers with many different types of protocols. If you implement a cURL operation in your PHP code and the web page spits out a “Fatal error: Call to undefined function: curl_init()” error message back at you, then it is probably safe to assume that the cURL library is currently included in your Apache, PHP stack.

(To verify this, run a phpinfo() call and then search for ‘curl’. If it isn’t installed, then the search should return nothing).

To install cURL in Ubuntu 12.04 using a terminal, enter:

sudo apt-get install curl libcurl3-dev php5-curl
sudo service apache2 restart

If the status messages returned after the two operations have completed look all successful, rerun your phpinfo() call and you should now be able to find a couple of curl entries on the resulting page.


How to Install Webmin on Ubuntu 11.10 Server using APT Software & Sites 09 APR 2012

Webmin is a user-friendly web-based interface for Linux server system administration. Previously installing Webmin on your Ubuntu server required a few workarounds thanks to its reliance on deprecated perl libraries, but nowadays you can actually do a full install via the standard APT mechanism.

First, edit your sources file to add the Webmin repository:

sudo nano /etc/apt/sources.list

Add the following two lines at the end of the file:

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Next, add the necessary key to ensure smooth access:

cd ~
wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc 

Now that we’re all set up, time to do the actual download and install:

sudo apt-get update
apt-get install webmin
apt-get -f install

Done. You should now be able to login to Webmin at the URL http://localhost:10000/. Or if accessing it remotely, replace localhost with your system’s IP address. You can login in with any user account that has sudo powers.


Related Link: Related Link: http://www.webmin.com/index.html

Ubuntu: Installing a Software Application from a Terminal CodeUnit 14 MAR 2010

Installing a new software package via a command line terminal in Ubuntu Karmic Koala (and basically all the other versions preceding it) is deceptively easy thanks to the powerful apt-get command that is used as the interface into Ubuntu’s Advanced Packaging Tool (APT). It can be used to install new software applications, upgrade existing software packages, update the current package list index and even go as far as upgrading the entire Ubuntu system.

The usage of apt-get to install a software package (like the network scanner nmap for example) is as simple as entering:

sudo apt-get install nmap

Similarly, to remove a package you simply change the above command to:

sudo apt-get remove nmap

Note that you can specify multiple packages to be installed or removed, separated by spaces. So for example sudo apt-get nmap gedit would install nmap and gedit respectively. Apt-get is also quite useful for updating the package index, in other words the database that holds all the available packages from the repositories defined in the /etc/apt/sources.list information file. The command to do this is:

sudo apt-get update

Lastly, apt-get is even powerful enough to update your Ubuntu installation itself. First run an update against your package index (as above) and then type:

sudo apt-get upgrade

As for log files of apt-get activity, see /var/log/dpkg.log. For more help on the command, a simple apt-get help will suffice.

There. Now you know! :)

(And for an easter egg while you’re at it, you may as well enter apt-get moo. If you get an answer, well then at least you know that you have Super Cow Powers!)

Related Link: https://help.ubuntu.com/8.04/serverguide/C/apt-get.html