“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!
May Month in Review – Pseudorant Articles
Pseudorant Month in Review – Tutorials, Articles, and Rants!
Hey everyone! Welcome to the Pseudorant Month in Review. I am doing the Month in Review article because this is the first full month of articles Pseudorant has written on our domain.
A lot of interesting things have happened this month. We have learned a lot of new things about computers and linux. We acquired a new author for the blog. We got setup on numerous social networks, and setup our RSS feed on FeedBurner.
In fact so much has been going on that it seemed fitting to do a review post that links to all the articles we have published this month. If you have been checking out the blog regularly we appreciate the continued support. If you are new to the blog “Welcome!” and we hope you have found something of interest.
As we continue to build the blog and improve the site we would really appreciate feedback from our readers on any changes, improvements or additions they would like to see on the site. We are very interested to hear people’s thoughts so please do not hesitate to email, comment, or slide ransom notes under the door. (Although the last method is least preferred.)
I hope you continue to enjoy our Pseudorants. Joe and I will continue to do out best to provide interesting and worthwhile content. Thanks for checking us out!
May – Month in Review!
Blogs
05-05-2008 - What Makes Content Valuable or Interesting?
05-19-2008 - The Blogs First New Author!
05-26-2008 - Pseudorant on Twitter’s Micro-Blogging Social Network
05-30-2008 - Pseudorant on FeedBurner! - Help us Burn our RSS Feed!
Internet
05-02-2008 - Why Google Alerts are So Useful!
05-04-2008 - What is Web 2.0? Web 2.0 is coming!
05-13-2008 - Content Management Systems – Joomla
05-22-2008 - Remove the Welcome to the Frontpage in Joomla
Linux
05-08-2008 - What Version of Linux is Right for Me?
05-09-2008 - Kubuntu Linux Successfully Installed
05-11-2008 - Video Tutorial - Installing Kubuntu Linux on a Laptop
05-16-2008 - How to Install Windows on Linux
05-17-2008 - How to Install Programs in Kubuntu Linux
05-20-2008 - How to Install Apache, MySQL, and PHP on your Linux Box
05-21-2008 - How to Install Firefox in Linux using Apt-Get
05-29-2008 - AddAsPodcast Bug for Amarok on Kubuntu
Money
05-24-2008 - Practical Ways to Make Money Online by Selling on eBay
05-25-2008 - How to Make Money Online with FREE Gift Cards
Rants
05-03-2008 - Grand Theft Auto IV is the Root of All Evil!
05-07-2008 - Microsoft is the Debil! Linux Here I Come!
05-10-2008 - Windows Movie Maker Hates My Samsung SC-DX10
05-15-2008 - More Reasons Why I Hate Microsoft
05-28-2008 - Too Many Business Requirements from End Users
Video
05-01-2008 - The Count Censored – Sesame Street – Viral Video
05-06-2008 - Today’s Moment of Zen – The Hardest Level in Mario
05-12-2008 - Watch Family Guy Episodes Online
05-18-2008 - Watch Movies Online & Streaming TV Shows on Your PC
05-23-2008 - Disturbing Video of the Week – Schwar-chan
05-27-2008 - VLC Media Player – Play Videos without Codecs
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!




