Category Archives: Hacks

Fix: Realtek SD card reader not working with Ubuntu

I have a RTS5209 Realtek SD card reader on my laptop, which was not reading any card inserted. The following instructions are likely to work for other versions like RTS5229 or RTS5289 as well.

Turns out I needed to install the driver.

Realtek offers drivers on its website for Ubuntu/Linux. Download the driver and unpack into a temporary directory.

Open a terminal and cd into the directory you unpacked the file.

Then enter one after the other:

make

sudo make install

sudo depmod

You will have to reboot your computer for the driver to load, or you can enter this command:
sudo modprobe rts_pstor

This is for RTS5209. I believe for RTS5229 it is (hint:read folder name):
sudo modprobe rts5229

However, this only works on older kernels and on 3.9+ you get errors like:

vidyut@vidyut-Compaq-435-Notebook-PC:~/tmp/rts_pstor$ make
sed "s/RTSX_MK_TIME/`date +%y.%m.%d.%H.%M`/" timestamp.in > timestamp.h
cp -f ./define.release ./define.h
make -C /lib/modules/3.8.0-26-generic/build/ SUBDIRS=/home/vidyut/tmp/rts_pstor modules
make[1]: Entering directory `/usr/src/linux-headers-3.8.0-26-generic'
CC [M] /home/vidyut/tmp/rts_pstor/rtsx.o
/home/vidyut/tmp/rts_pstor/rtsx.c:916:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rtsx_probe’
/home/vidyut/tmp/rts_pstor/rtsx.c:1080:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rtsx_remove’
/home/vidyut/tmp/rts_pstor/rtsx.c:1106:11: error: ‘rtsx_probe’ undeclared here (not in a function)
/home/vidyut/tmp/rts_pstor/rtsx.c:1107:2: error: implicit declaration of function ‘__devexit_p’ [-Werror=implicit-function-declaration]
/home/vidyut/tmp/rts_pstor/rtsx.c:1107:24: error: ‘rtsx_remove’ undeclared here (not in a function)
/home/vidyut/tmp/rts_pstor/rtsx.c:485:12: warning: ‘rtsx_control_thread’ defined but not used [-Wunused-function]
/home/vidyut/tmp/rts_pstor/rtsx.c:596:12: warning: ‘rtsx_polling_thread’ defined but not used [-Wunused-function]
/home/vidyut/tmp/rts_pstor/rtsx.c:745:13: warning: ‘quiesce_and_remove_host’ defined but not used [-Wunused-function]
/home/vidyut/tmp/rts_pstor/rtsx.c:780:13: warning: ‘release_everything’ defined but not used [-Wunused-function]
/home/vidyut/tmp/rts_pstor/rtsx.c:790:12: warning: ‘rtsx_scan_thread’ defined but not used [-Wunused-function]
/home/vidyut/tmp/rts_pstor/rtsx.c:816:13: warning: ‘rtsx_init_options’ defined but not used [-Wunused-function]
cc1: some warnings being treated as errors
make[2]: *** [/home/vidyut/tmp/rts_pstor/rtsx.o] Error 1
make[1]: *** [_module_/home/vidyut/tmp/rts_pstor] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-26-generic'
make: *** [default] Error 2
vidyut@vidyut-Compaq-435-Notebook-PC:~/tmp/rts_pstor$

The fix for this is to edit the file rtsx.c (that is throwing the errors) and remove “__devinit” “__devexit” and “__devexit_p” from it, leaving the rest of the code (and the rest of the line they occur in) in tact.

Like so:

static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)

Becomes:

static int rtsx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)

static void __devexit rtsx_remove(struct pci_dev *pci)

Becomes:
static void rtsx_remove(struct pci_dev *pci)

.remove = __devexit_p(rtsx_remove),

Becomes:
.remove = rtsx_remove,

Now, when you run make, the process should complete without errors.

If your SD card *still* doesn’t mount, check your dmesg like so:

sudo dmesg

If it shows something like:
[ 694.058432] systemd-hostnamed[2516]: Warning: nss-myhostname is not installed. Changing the local hostname might make it unresolveable. Please install nss-myhostname!

Try installing the library.
apt-get install libnss-myhostname

If it still doesn’t work, I don’t know what to do. This SHOULD work.

Chromium starts about:blank tabs on typing into dashboard in Ubuntu

This is a strange and inexplicable error. Typing into the Ubuntu dashboard spawns new tabs in Chromium. This happens even if Chromium is not running it simply launches and spawns one or more tabs.

Sometimes this also happened when software updater started.

I had Chromium as the default browser earlier and made Firefox the default to fix this problem. It did not work.

What worked was logging out and logging back into my Google chat account in Online Accounts.

No idea why this is so, but turns out that it is a Chromium bug and what I did intuitively (after trying many other things that didn’t work) was a fix.

How to retrieve your passwords saved in Google Chrome or Chromium on ubuntu linux

If you are like me, you have loads of passwords saved in the Chrome browser. And then you need them. Maybe you want to stop using Chrome, or you want them to enter into some applcation other than the browser… or perhaps you just want a list of all sites you have passwords for – curiosity… whatever the reason, it isn’t easy to discover how to do this.

This solution is based on one I found at The Big Browser with two very minor changes where that code didn’t work for me.

Before beginning, make sure you are signed in from your Google Chrome or Chromium browser and your passwords are synced and available.

Close the browser.

Next, open the browser from the command line, with a temporary profile that stores passwords without encryption. Like so (pick one of the lines depending on the browser you are using)

### Google Chrome
    google-chrome --user-data-dir=/tmp/chrome-tmp --password-store=basic

### Chromium
    chromium --user-data-dir=/tmp/chrome-tmp --password-store=basic

This did not work for me – I use Chromium. I had to use this:

### Chromium
    chromium-browser --user-data-dir=/tmp/chrome-tmp --password-store=basic

I have no idea what happens with Google Chrome, but if the given line doesn’t work, appending -browser to google-chrome is worth a try.

This will open a separate session. Sign in to the browser with your account and wait for a while till your passwords are synchronized. You can surf if you want. When your data is syncronized, your saved websites and bookmarks will be available. You can go to “Manage passwords” in settings and see that your passwords are loaded. If you don’t see them, wait some more time till you do.

Close the browser.

Note: the fastest way to get to the stored passwords page in settings is to type password in the Search box in the top right.

In the terminal, enter:

cd /tmp/chrome-tmp/Default

For the next step, you will need sqlite3 installed. If it isn’t installed, you can install it by entering:

sudo apt-get install sqlite3

Then enter:

sqlite3 'Login Data'

At the changed prompt, now enter the following lines one by one.

.mode csv               # other options are `html', `tabs', etc.
.headers on
.separator ","
.output chrome_passwords.csv
select * from logins;
.exit

This will give you a file called chrome_passwords.csv with your Chrome passwords.

To open it with LibreOffice, type:

libreoffice --calc chrome_passwords.csv

The passwords will open as a spreadsheet. You also will be able to import this spreadsheet into other keyword managers if you need to.