Some linux FS management tips

A few days back, I decided to upgrade from Fedora 19, to 24, and decided to do so using a usb stick. I downloaded the installer, and copied into the usb stick using dd.

A couple of days later, when I wanted to use that usb stick, I found out I could do nothing with it since its file system was write-protected. Trying to format the device did not work for the same reason. Using the disks utility in Fedora 24 showed 3 partitions in the usb stick, but trying to delete them would result in an error related to block size. The driver reported one size, but linux reported another. After a bit of searching, I came to an ask ubuntu answer that recommended using mkfs.vfat to solve the problem.

  • You can use mkfs.vfat, or one of the other mkfs.* programs to format a stubborn drive, or any other drive for that matter.

Being able to fix this problem, I decided to try with an old usb stick I got at a meet up back when Barnes & Noble were preparing to launch their android-based reader NOOK. The usb stick has never worked. It doesn’t mount, and reviewing it, there is no partition in it, let along a file system. I tried making a partition using the disk utility, but failed. I decided to use parted in the command line, but no luck, the device was write-protected. After a bit of searching, I found out you can use hdparm on write-protected devices to make them writeable. This did not work on my usb stick, which leaves me thinking that the device is just damaged.

  • You can use parted to make partitions in a device
  • You can use hdparm to set various option on drives, like write-protection.

Speaking about partitions, having a usb stick with more than one partition in it can be quite useful, and cool. Just remember that dumb windows doesn’t mount all of them, only the first one.

Other tips:

  • Use mount to find out how a device is mounted.
  • Use dosfsck to check and repair DOS file systems

I hope these tips prove useful at some point in your life as they have done in mine. Thanks to all that share wisdom around the net, what would we do without them…


Quick Linux Notes

It’s been a while since I wrote anything here. Today I want to leave a few pieces of wisdom for those who like pocking around their computers; specifically linux systems.

Yesterday, after trying to change the applications menu in LXDE, I ended up learning a few things about linux. Just to be clear about my current setup, I am using Fedora 20, with LXDE. That should be all that matters here. If you are using anything else, you may want to see if these bits of knowledge apply for your system as well.

1) It is not that easy to edit the applications menu. By application menu, I mean the little menu with the fedora logo that by default shows on the left end of the panel in LXDE. I remember that in ubuntu, or more specifically in Gnome classic, you had Applications, System, and Places. You could right-click on Applications, and there would be an option there to edit the menu. In LXDE, that does not exist.

According to the Main Menu documentation in the LXDE website, since version 1.2.0 of PCManFM, you can use this file browser to edit the menu by editing the Applications folder. I tried it, all I got was a message saying the operation is not supported. It may be necessary to open it as admin, but I didn’t try.

Apparently, this menu is built from .desktop entries on certain locations.The previously mentioned documentation says that one of those places is ~/.local/share/applications, so I decided to create a new entry there. The same documentation says that you have to delete the .cache/menus/* files. It doesn’t really say it, but it gives you a script that does just that. After doing that, my menu just disappeared, and trying to access the Applications folder in PCManFM would give a menu cache error. I had to restart the computer so that the menu would show up again. After restarting the computer, my new entry was added to the menu. Odly enough, after I restarted the computer, the item I was trying to add was already there, and my entry was too, so the item was duplicated. I think it was there all along, I just didn’t see it…

If you want to understand exactly how the applications menu is built, you can try to take a look at the source code for the lxdepanel menu plugin.

You can also open ~/.config/lxpanel/LXDE/panels/panel. This is the config file for the panel, but it is recommended that you don’t edit that file directly. I did though, and nothing broke.

2) Restoring default Launchbar. A few days ago, I was playing with the settings on the lxdepanel. To open up these settings, just right-click on the panel, and select the Add/Remove Panel Items option. That time I removed the last application launcher, which has the logout button, and the lock screen button. In my opinion, without those two buttons, the panel looks “naked”. It bothered me at the beginning, but then I decided to just leave it like that after trying to find those buttons again without any luck. Yesterday, I stumbled upon the default menu settings. Just open /usr/share/lxpanel/profile/LXDE/panels/panel and you will see the default settings there. From that point, it was just a matter of copying and pasting the last item on to my profile’s panel config file.

3) Read some good python. If you go to /usr/lib/python2.7/ you can read the python library. I think it is nice to be able to just read and learn from the official library. In my computer there is also a python3.3 directory next to the puthon2.7 one.

4) Find your trash directory. A few years ago, digging around an old computer, I found the trash directory, but since then I’d forgotten its location. More recently, I had been wondering how the restore functionality works — If you open the Trash Can in PCManFM, and right-click on an element there, you will see an option that says Restore. I wanted to know how the computer knew where the item was taken from. Now I know.

If you go to ~/.local/share/Trash/ You will see 3 directories there. We are interested in two of them:

The files directory keeps the actual files that have been moved to the trash. When you right-click a file, and choose the Delete option, you are just basically moving the file to this directory.

The info directory keeps an info file for each file in the files directory. This info file has two pieces of information: the path where it came from, and the deletion date. It is that simple. When you restore an item, the system simply reads the info file, finds where it came from, and moves it back there again. Then it deletes its info file.

Never be afraid to dig around your computer. There are many goodies waiting to be discovered. Follow one simple rule, don’t modify anything that you don’t understand, and you should be OK. If you have a spare computer, you should install some linux disto and experiment there knowing that if you break it, nothing is lost.

Finally, here is a list of documents you may want to read (some of them are gnome related):

Scanning with Canon N1220U on Fedora 18

I needed to scan a document today. Scanning is something I do very rarely, so I don’t need to buy a fancy scanner. I have a Canon N1220U that I got from my father over 6 years ago. I don’t know how long he had it for before passing it on, but it works well. It has decent quality image, and it is not bulky, so I can easily put it away in a little box. I used it a few times back when I was using ubuntu on my Dell laptop. It just worked out of the box, or at least that is what I remember.

However, today, when I tried to used it it would not work. Fedora comes with simple scan, which is the same applications I used in Ubuntu, but simple scan was not detecting the device. I decided to open the console and fire up a search for scan utilities:

yum search scanner

I got back a bunch of results. The promising one was sane-backends-drivers-scanners.x86_64, so I did a sudo yum install, but that reported that the package was already installed, and up to date. There was nothing to do.

I decided to do a quick search, and I found this: but I didn’t think it would help so I skipped it and went back to the terminal. I decided to see what packages were available by the sane package, so I typed san and then hit tab twice. I got this list:

sanbox saned sane-find-scanner

I decided to give sane-find-scanner a try. sane was detecting the scanner, so the problem should be somewhere else. I decided to install another package from the list I got when I did the yum search.

sudo yum install xsane.x86_64

This installs the xsane package and the dependency xsane-common. I had tried xsane before, although at the moment I didn’t remember it. xsane is insane. It has lots of options, and getting the document to scan cleanly can be hard, you may need to play around with the contrast, and light settings. Heck, xsane even has histograms!

xsane is great if you are doing some high quality scanning, but if you just want to scan a document to email it, xsane is a bit of an overkill. I decided to give simple scan another try. I opened it again, hit scan, and it worked. Why? I don’t know. It thought maybe something to do with xsane, but it continued working even after xsane and its dependency were uninstalled, so I don’t know what made it work, but I’m glad that it works now.

A Word of Caution About PuTTY’s pscp

Today I was setting up a dev environment. I had to transfer some file from my windows workstation to my in-house linux server. I used PuTTY’s pscp to do it, but I got an unpleasant surprise. It turns put pscp will do different things depending on whether you use a backslash(\) or not. Consider this:

pscp.exe -r Path\to\Dir\ user@remote:/path/to/destination

What do you expect that to do? I would expect it to copy Dir and it’s contents over to the destination directory on the remote machine. This is what cp would do if you do this:

cp /some/local/dir/ /other/local/dir/

But that is not what pscp does. pscp copies the contents of Dir over to destination. This might not be what you want. What you usually want is a new dir, called Dir, be created on destination on the remote machine, and then copy the contents of the local Dir to the remote newly created Dir. Instead, pscp will not create a Dir on the remote computer, but put the contents of the local Dir on destination. This could end up making a real mess.

If you want pscp to create a Dir on the remore machine and then put the contents of the local Dir on the remote Dir, you would have to leave the last backslash out:

pscp.exe -r Path\to\Dir user@remote:/path/to/destination

This problem could be seen as both, a problem, or a feature, depending on what your point of view is. I don’t know if spc on linux behaves the same, but I know that cp on linux doesn’t.

If you have problem understanding the difference, imagine this:

Contents of local Dir: file1.txt file2.txt


Contents of remote destination: file.php file2.php


Results of pscp.exe -r Path\to\Dir\ user@remote:/path/to/destination:


Results of pscp.exe -r Path\to\Dir user@remote:/path/to/destination:


Ultimately, using the backslash at the end should be advised against. After all, it is easier to take the contents of the new Dir up to destination than it is looking for all the contents of Dir scattered all over destination to place them inside the new Dir.

What do you think?

Importing CDs as MP3 With Banshee

Yesterday, when I was getting ready for my trip I decided to add the new Selah Sue CD to my mp3 player. When I tried, I couldn’t do it. It was strange because I could add some other songs, but not those. After checking I found out that the songs were in ogg format rather than mp3. That was strange. I had Banshee set to transfer files as mp3, and not ogg. I know, ogg is better, but those stupid mp3 players don’t play ogg.

I tried to import the CD again but as mp3 but I couldn’t. At some point, with some update I lost that ability. I don’t quite remember what plugin I added last time, so I did a quick search. A post suggested installation of the gstreamer0.10-lame plugin, so I tried that:

sudo apt-get install gstreamer0.10-lame

but the computer said that there was no candidate release for that plugin, and that it had been replaced by gstreamer0.10-plugins-ugly so that is what I installed:

sudo apt-get install gstreamer0.10-plugins-ugly

Now importing as mp3 works.

As a side note, personally I like the way they named the plugin (ugly) since mp3 is an ugly format.

The post I read is located at:

There is a Zombie on My Server

About two weeks ago I noticed that the top command, which is running most of the time on the in-house server just to keep the screen busy, was showing a zombie process. I didn’t care much about it. A few days later, someone pointed that out to me. This person, who has little knowledge about computers, thought it was kind of funny that I had a zombie on my computer. I, on the other hand, didn’t think it was that funny. I thought it was logic that the zombie process I had seen before was still there since the computer had not been restarted, but I decided to look into it. I opened another terminal window, so I could have top running and work at the same time. What was my surprise that all the sudden I saw not one but two zombie processes. So freaked out (not really). If the number of zombie processes starts rising up on your machine, there is something wrong going on.

The reason I didn’t freak out was because I knew that the only thing that hand changed was the fact that I had opened another terminal window. So I closed it, and the number of zombie processes came back down to one. I SSHed into the server from my workstation, run top, and closed the terminal window that was running top on the server. The number of zombie processes went down to zero.

So, that was it. My terminal emulator (terminator) becomes a zombie process when running. I still don’t know why. At first I thought it might be standard behavior for terminal emulators, but when I run the default terminal emulator on ubuntu, it did not increase the number of zombie processes. To be fair, I wasn’t really convinced that it was terminator that was on zombie mode, so I searched how to spot zombie processes. I got with this nice blog post:

I followed the instruction and found out that in fact, it is terminator that is running as zombie. Now the question is why? If you have any idea of why this happens, feel free to share it in the comments section.