“Database Locked” After Adept Manager Crashed
The Problem
If you have ever used the Adept package manager for Kubuntu (or other Debian based systems running KDE) you already know how valuable a tool it can be. It provides a very convenient way to install new software and keep your system updated. However, when such a convenient tool suddenly stops working, it can be very disorienting.
This is exactly what happened to me last weekend when I was trying to setup Eclipse on my PC. For those of you who haven’t heard of Eclipse, it is an Integrated Development Environment (IDE) that can be extended with plugins to support new languages, debugging tools, analytic tools, and more. I was planning on using it to manage some of the PHP projects I have been working on lately. I selected Eclipse from the Adept window and installed it, but it only came with the most common languages such as C, C++, and of course Java.
After searching online, I found out that there is an Eclipse project called PDT (PHP Development Tools) that provides exactly the functionality I am looking for, so I started to follow the instructions on the Eclipse PDT page (http://www.eclipse.org/pdt/) to install it on my PC. Since Eclipse is Java based, it needs to run on a Java Virtual Machine.
Unfortunately, the JVM that comes bundled with Kubuntu is GCJ (GNU Compiler for Java) and the Eclipse PDT instructions said that either a Sun or IBM Virtual Machine would be necessary. Luckily that is already a package in Adept, so naturally I selected it to install and clicked next to continue. This was a big mistake apparently, since I overlooked the little checkbox for “I agree”, which you need to scroll to the end of the End User License Agreement (EULA) to even see.
This caused Adept to crash, and it crashed hard. When I tried to open it again it said “Database Locked - Adept Manager” and then a short message that another process had locked the package database - even after restarting my PC. I could still open Adept, but only as read-only which makes it pretty useless.
I could go on and on about how it should have just aborted if I didn’t check the “I agree” box, instead of breaking Adept altogether - it’s not like anyone reads the EULAs anyways, but that’s a rant for another day.
After a little bit of Googling, I found a few posts on the official Ubuntu forums of others who were having similar problems, and one of them (http://ubuntuforums.org/showthread.php?t=348952) had a simple solution using only two commands…
The Solution
To fix the “Database Locked” message, you will need to open a terminal window. To do this, go to the K menu, then to the System submenu, and select Konsole - Terminal Program. Then just type the following two commands one at a time:
sudo apt-get -f install
sudo dpkg –configure -a
That’s it! The first command tries to automatically fix any broken dependancies, which for me just gave an error message. I’m not entirely sure if it is necessary but I would run it anyway. The second command tries to “reconfigure all unpacked but unconfigured Debian packages” (according to the man pages). This ran for a moment listing a bunch of packages, and when it finished I was able to run Adept once again!
I’m not sure whether the culprit for this problem was Adept or the Sun JDK package. I had read about other specific packages causing this problem with Adept, but that doesn’t tell me anything. All of the pages I came across recommended these steps or something very similar. Since this was the simplest approach and it worked like a charm, I would recommend you start with this. As always, you can search the Ubuntu forums or use Google if this doesn’t work.
Mounting Shared Folders to Play Media Files in Kubuntu
The world’s most complicated fix for the world’s simplest problem
As a warning, this article is not for people who are afraid to run some commands from a text-based terminal or edit some system files used by Linux. I’ve tried to make things as simple as possible, and you can use the GUI for most of these tasks, but some steps will require you to open a shell and type a few commands by hand. I don’t think there is much risk of hosing your system if you follow the steps carefully- it is more likely that the new changes just won’t work- but if you get too far off track or something goes poorly enough, I can’t be held responsible if it messes up your system. You have been warned.
Anyway, if the intro didn’t scare you off, you’re probably wondering “just how hard could it actually be to play .mp3 and .avi files over a network share?” Well, Kubuntu (or Dolphin to be specific) can open shared folders on PCs running Windows right out of the box, but it can’t seem to open media files without first copying them to the local hard drive. The reason is because shared folders on NTFS hard drives (the file system used for most Windows installations) are not “properly mounted”, which is a fancy way of saying that Linux doesn’t have enough control over them.
I almost uninstalled Linux when I first encountered this problem, because it is so ridiculously complex for such a simple request, but I’m glad I stuck with it because although Windows doesn’t have this particular problem, it has plenty of others. Now, let’s get started!
In case you were wondering, you can access shared folders by going to the System menu (next to the K menu) and selecting “Samba Shares”. Then you should be able to find the PC you are looking for. Although this is useful for some things, it is not useful for playing media, which tend to be large files.
The solution for this, as I mentioned before, is to properly mount your network drives. This involves a little bit of trudging through the command line, and there is probably a better way to solve this problem but after all the searching I did, this is the best I can come up with. There are basically 4 parts to this fix.
- Setup a local folder for mounting
- Create a credentials file under your root directory (optional, but recommended so your password is not revealed to other users on your PC)
- Edit your fstab file to mount the folders from step 1 upon booting into Linux
- A “fix for the fix”, because of a known bug when unmounting drives (during shutdown)
Setup a local folder for mounting
Go to the system menu and click any option to open Dolphin. Click on the root shortcut on the left, and then choose the option on the right hand column for “Open as root“. In here, right click and create a new folder named “net” without quotes. It doesn’t really matter what you call it here but you will use it later and it is case sensitive. In any case, open this new folder you just created and create another folder.
I named this new folder after the computer I was connecting to, then created another folder under that with the same name as the shared folder of the machine I’m connecting to. This is because I have a few computers on my network and I wanted it to be like a re-creation of my network tree, but you really just need one folder for each shared folder you want to connect to. For this demonstration, I will make a directory structure of /net/mkd/d, but again, you can call it whatever you want. mkd is the name of my computer, and d is the name of the shared folder on that PC (my D: drive in Windows).
Create a credentials file
To create the credentials file, go back to Dolphin and click on the root shortcut again (from the column on the left). You should still have root access unless you closed the window or opened the wrong Dolphin window, so go to /root in the folder list below. Right click here and create a new text file named “.smbcredentials“. The dot as the first character means it is a hidden file, so you will have to click Alt+. (alt and the period key at the same time) to see it in dolphin. Do this and then open the blank file you just created and add the following two lines:
username=[YOUR_USER_NAME]
password=[YOUR_PASSWORD]
Obviously, replace the parts that are in brackets with your actual username and password that you would use to connect to your network share. This would be your Windows password.
Edit your fstab file
Click on the root shortcut in dolphin again and open the folder named “etc“. In here, scroll down a ways and look for the file named “fstab“. Right click on it and choose Actions -> Edit as root. In this file, scroll down to the very bottom and add a couple of blank lines. Then add the following line:
//[IPADDRESS]/[SHAREDFOLDER] [MOUNTEDFOLDER] cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
Again, replace the parts inside the brackets with real information. [IPADDRESS] is the IP address of the machine you are connecting to. You *can* use the computer name however for some reason this causes problems so I reccomend you find the IP address and use that. If you need to find out what the IP address is, go to your windows machine that you are trying to connect to and click on the start menu. Choose “run” and type “cmd” (without quotes) and press enter. When the window pops up type in “ipconfig” to see your ip address.
[SHAREDFOLDER] is just the name of the shared folder you are trying to access, and [MOUNTEDFOLDER] is the directories we created in the first part of this guide, for example, “/net/mkd/d“. Remember that uppercase and lowercase matters here. Also, note that between each field is a tab, though I think any whitespace (tabs or spaces) will do fine. In all, there should be 6 fields: ip address & shared folder name, mounted folder name, file system type (cifs), a long string of different options, 0, and another 0. I’m not sure what the last two are for but they are necessary.
Now when you restart you should have a network drive mounted for the shared directory sitting right on your desktop. Rename this to something meaningful like “d on mkd” and you’re almost done! You can add as many lines as you want to to fstab, and if it can’t find the network share it will simply ignore it. Just make sure to have a different folder in your net folder (or whatever name you gave it) for each network share you are trying to access. Going back to the example I used before, I might have folders for /net/mkd/d, /net/mkd/c, and /net/mediabox/d as different shared folders I’m connecting to.
A Fix for the Fix
Since that was not nearly complicated enough, we get to cover an additional fix for that fix. All of this just to be able to open a media file without copying it to your local hard drive! As you may notice when you restart, Kubuntu will take it’s jolly time to shutdown. It will also show the same cryptic error message for each of your mounted drives, which will usually add about an extra minute or two to the shutdown time for each shared folder you added. If you only mounted one shared folder then maybe this is acceptable, but if you mounted 6 like I did it is absolutely not acceptable.
First, we will need to use a script for unmounting all cifs drives before shutdown (all shared folders). Fortunately, two contributors to the Ubuntu forums came up with a solution for us: Max.durden modified a simpler version of jferrando’s script and posted it on the ubuntu forums here (http://ubuntuforums.org/showthread.php?t=293513). You may need to log in to be able to download the archive. Once you have downloaded it, right-click on it and choose Actions -> Extract to get the script file “mountcifs“.
Next, we have to install it. Open dolphin again if it isn’t already, and click on the root shortcut again. You may as well click on the option on the right for “open as root” now, since everything you do here will need to be done as root. Go into the folder /etc and look for the folder in here named “rc6.d“. Open this and copy and paste the script that you downloaded here.
Now, go to the K menu, choose “system“, and select “Konsole” to open a shell window. type the following commands one by one:
cd /etc/rc6.d
sudo chmod +x mountcifs
sudo ln -s /etc/init.d/mountcifs K02mountcifs
If all went well, you should be all set! Restart your machine and check to make sure that it doesn’t hang during shutdown anymore. If you still have problems with either mounting or unmounting your shared folders, I’m afraid you will have to consult the Ubuntu/Kubuntu forums or google. For me, the script worked fine and I believe this solution is complicated enough as it is.
I now have a shortcut on my desktop to all of the shared folders I regularly access on my Windows machines. Eventually, I will migrate them over to Linux, and hopefully this problem will go away altogether, but for now I can enjoy listening to music over the network on my Linux machine without any problems!
AddAsPodcast Bug for Amarok on Kubuntu
Does it really have to remind me every time I move my mouse?
I recently switched to Linux from Windows XP, and I could not be happier, but getting where I am today has not been a walk in the park. A friend once told me that “Linux isn’t free, you pay for it with your time” and although that may be true to some extent, it is not as true today as it once was.
That being said, I thought that I would chronicle my experiences with Kubuntu and write an article on any inconveniences I come across as a former “Windows user”. To start things off, here is a very annoying bug between Amarok and Dolphin - a combination of two bugs.
For those of you who are not familiar with these programs, Dolphin is the file explorer for KDE that comes with Kubuntu, and Amarok is the popular media player for KDE. Apparently, developers for Amarok forgot a line in one of their .desktop files (menu/shell extensions for dolphin) which results in an error. Meanwhile, developers of Dolphin thought it would be really funny if every time you had an error message in a .desktop file it should show a popup error message to tell you about it.
Now, if you don’t do anything with .html files or xml files, then you may never see this bug, but if you do then you’ll know what I mean. Dolphin accesses the broken file every time you mouse over an html or xml file, which means just moving your mouse over a file with a .html, .htm, or .xml extension will cause a popup error message to appear. This is unbelievably frustrating if you do any kind of web development, but at least it is fairly simple to fix.
Just open Dolphin (click on the System menu next to the K menu and select any folder) and click on the shortcut on the left-hand side for “root”. Then go to /usr/share/apps/d3lphin/servicemenus and look for the file named “amarok_addaspodcast.desktop” (it will probably be the first file listed).
Right click on it and choose Actions -> “Edit as root” from the submenu. Find the line that says “Icon=amarok” and add the following line after it (without quotes):
“Exec=amarok -a %u”
Save the file and you’re all set!
If for some reason the option for “Edit as root” doesn’t appear under the Actions menu, you can go up one folder and right click on the servicemenus folder and choose Actions -> “Open as root”. Then you should be able to just open the file normally and still be able to make changes.
How to Install Firefox in Linux using Apt-Get
Installing Firefox using the Apt-Get Command
Hey all! Today we are going to cover another Linux article for beginners on how to install Firefox in Linux using the “Apt-Get” command.
When I first installed Kubuntu on my laptop I was using Konqueror to browse the net. It is a nice browser but it was giving me some trouble displaying certain menus in WordPress and on sites like Google video, etc.
I decided the best thing to do would be to install Firefox. I was familiar with Firefox from using it in Windows and I knew there was a version of Firefox for Linux. I checked on the Firefox website and there was a Linux version I could download but I didn’t know what to do with the file once I had downloaded it. We will cover that type of installation in another article.
What I ended up doing was using the “Apt-Get” command to install Firefox. I am not a big command line guy but this was actually much easier than I expected it to be.
Apt is “a Debian tool used to manage packages. When a user installs a package on a system, it also searches for and then installs or upgrades all the necessary dependant packages to make the package work. The actual command is apt-get.” -webopedia.com
This is great to know because it is saying that when you use the Apt-Get command it will also download any other files that are needed for the software to run properly.
So now that we understand what Apt-Get is and why it is useful let’s install Firefox.
The first thing you need to do is open a console window. This can be done by clicking on your K-menu:
K-Menu > System > Konsole – Terminal Program
Once the console opens you will need to type the folowing command:
sudo Apt-Get install Firefox
Once you have typed this hit “Enter” and Konsole will ask for your root password. Type in your password and hit “Enter”
You should now see some system messages in the Konsole window as the system downloads and installs Firefox onto your system. Once it is complete it will bring you back to the command line in Konsole.
Go ahead and close your Konsole window, and now you should be able to open Firefox on your system. Go to:
K-Menu > Internet > Firefox Web Browser
Congratulations. You just installed a program using the Apt-Get command.
As you can see this is a very useful command because of how easily it allows you to install applications on your system.
One thing I ran into when writing this article was that I already had Firefox installed. When I typed in:
sudo Apt-Get install Firefox
I got the error message:
sudo: Apt-Get: command not found
If you get this error message try using the following command:
sudo /usr/bin/apt-get install Firefox
I am not sure why I got the error because it originally allowed me to install Firefox using the standard Apt-Get command without the /usr/bin/.
This might be because you already have the program installed which I did in this case. If you would like to remove the program you can always type:
sudo /usr/bin/apt-get remove Firefox
This will uninstall the program you would like to remove from your system. This covers the basics of installing and removing programs using the Apt-Get command.
In future articles I will cover Apt-Get in more detail but for now this should give you enough to get started with it. If you would like to know more about Apt-Get and its usage type the following command into the Konsole:
man Apt-Get
I hope this article helped with the basics of using the Apt-Get command. In the case of the “Apt-Get: command not found” error, try the “/usr/bin/apt-get” command I listed above. This worked for me and resolved the error message.
Thanks for checking out Pseudorant. We appreciate the support!
How to Install Apache, MySQL, and PHP on your Linux Box
Putting the AMP in your LAMP server
Hello and welcome! This is my first article / guide, so let’s get right into it.
This is intended as a guide for web developers who are new to Linux (namely Kubuntu) and wish to setup a local LAMP server on their machine. For those of you who don’t know, LAMP stands for Linux, Apache, MySQL, and Perl / Python / PHP, although in this case the ‘P’ is for PHP only. When all four of these are installed on a machine, it is a full-blown web-server capable of running complex web applications.
In my case, I have installed Kubuntu 8.04 (Hardy Heron) on my machine using the standard desktop installation, which does not come with Apache, MySQL, or PHP. To be specific, we will be using the following applications:
* Apache2
* MySQL 5
* PHP 5
All of these applications are available through the Adept Package Manager,which is a fast and convenient way to install and uninstall applications in Debian-based Linux systems. Click on the link above for a guide on how this works.
For simplicity, I will assume you know how to operate Adept and have installed at least one package before. Click on the K-Menu, go to ‘System‘, and select ‘Adept Manager - Manage Packages‘ from the list. When prompted, enter your root password and you will see Adept’s package manager interface.
Now, in the search bar, type ‘apache‘. After a short moment, you should see a list of packages. The very first one should be ‘apache2‘. Click on the arrow next to it and select ‘Request Install‘. Now, type into the search bar ‘mysql‘ and this time you will need to scroll down a ways to find the package you are looking for: ‘mysql-server‘. Click on the arrow and select ‘Request Install‘ again. I would also recommend selecting the package ‘mysql-admin‘ for a convenient GUI for managing MySQL server, but that is purely optional. Finally, type ‘php‘ into the search bar and scroll a ways down to find ‘php5‘. Once again, click the arrow and choose ‘Request Install‘.
After selecting these 3-4 packages (depending on whether or not you installed the MySQL Admin GUI), select ‘Apply Changes‘ at the top of Adept to install the packages. This may take a while, so now is an excellent time to take a break and get a drink.
After the installation is complete there is a couple of very important steps to take in order to save yourself a lot of frustration. The first and foremost, is to clear your browser cache! I’m not entirely sure why this is so important, but trust me, it is. If you are running Mozilla Firefox, go to the ‘Tools‘ menu, select ‘Clear Private Data‘, and uncheck everything except for the ‘cache‘ checkbox. You can clear out other information as well, but make sure cache is selected.
The other important step to take is to make sure that php files are parsing correctly. Go to your System Menu (the one next to the K Menu) and select anything, for example, ‘Home‘. The root folder is not in this menu, so you will have to navigate to the right folder anyways. For simplicity, select the ‘Home‘ folder from this menu.
On the left-hand side you should have a column labeled Bookmarks, with an option for Root. Select that, then click on the folder for ‘etc‘. Right-click on the folder named ‘apache2‘ and select from the ‘Action’ menu ‘Open as root‘. Enter your password to continue.
In this folder, select the folder ‘mods-available‘ and look for the file named ‘php5.conf‘. Right-click on this file and select ‘Edit as root‘ and make sure the second line says something like
‘ AddType application/x-httpd-php .htm .html .php .phtml .php3‘
In my case, all I had to do here was add ‘.htm .html ‘ before the ‘.php’ section. This is so that if you have PHP code inside an htm or html file, it will be parsed instead of showing the raw code.
Save your changes, and depending on which editor you used, you might want to delete the temporary ‘~php5.conf‘ file that it creates as a backup. It should not hurt anything to leave it there, but I like to delete the extra backup files to prevent clutter.
In any case, make sure to restart your computer at this point to make sure that the apache web server picks up the configuration changes. You can probably accomplish the same effect by just restarting the apache service, however I haven’t done that yet and restarting the system seemed like a simpler approach.
Alright, now we’re getting to the fun part! Open your favorite web browser and type in the address bar ‘http://localhost‘ to see if apache is running properly. If it is not, you can blame me and probably find some help on the official Ubuntu/Kubuntu forums, however if it is running, it should show the words ‘It Works!‘ in your web browser. We’re almost done now…
All web files will be hosted from ‘/var/www‘. To make sure php is working properly, we will need to first navigate to that folder. Select ‘System Menu‘ -> ‘Home‘, and then select ‘Root‘ from the bookmarks section on the left. Click on the ‘var‘ folder to open it and then right click on ‘www‘ and choose ‘Action‘ -> ‘Open as root‘.
In here, right-click on ‘index.html‘ and choose ‘Action‘ -> ‘Edit as root‘. Add this line right before the closing tag for the body (body tag > added line of code | below):
![]()
![]()
Save your changes, and refresh your browser window. You may want to clear your browser cache again, just to be sure. You should see ‘It Works!‘ followed by a neatly formatted table showing all of the current settings for PHP. If it did not, right-click on the page from your browser and click ‘view source‘ or whatever the option is called for your browser to see the HTML code directly.
If the output from view source shows the “?PHP” part of the code, then something is wrong. PHP code should never be sent to the browser without being parsed. If you haven’t already, try restarting your PC again, otherwise you are on your own (along with the thousands of others with similar problems). Again, I recommend checking the official forums for Ubuntu / Kubuntu.
Hopefully, all went well and you saw the neatly formatted PHP text. To make sure that MySQL is working correctly, I will assume you have the GUI installed. I said it was optional, and it is, but it’s the easiest way I know of for verifying that everything installed correctly. Go to the K-Menu, select the ‘Development‘ menu and choose ‘MySQL Administrator‘.
For the server hostname, choose ‘localhost‘. The login name will be ‘root‘, and the password is the root password for your machine. If you can connect OK, then all is well. If not, fall back on the official forums or google to find a solution, but I suspect that this will work right off the bat.
That’s all I have for this guide for now. There is a mountain of information for all three applications mentioned here, and this guide barely scrapes the surface of any of them. Expect some guides in the future for configuring Apache, MySQL, or PHP.




