Smokes your problems, coughs fresh air.

Category: Technology (Page 41 of 47)

Creating a custom device node for specific hardware with udev

Sometimes you want specific hardware to get a specific device name in /dev. For example, I want my backup hard disk to have the same device name. I can’t automate anything if sometimes the device is sdc and other times it’s sdd.

To do that, you need to create a specific udev rule. I put this one in 10-local for my backup hard disk:

BUS=="scsi", KERNEL=="sd*", SYSFS{vendor}=="ST325062", NAME="usbhd%n"

Everything with dual equal sign it uses as match, and I assign a different name at the end with a single equals sign.

You can look up the specific attributes to match in “/sys/bus/scsi/devices/[devicenumber]/”. The file “vendor” contains the “ST325062” I match for. My internal drives have vendor ATA (for whatever reason), so there will never be a conflict.

After having made the rule, you can use “udevstart”, “udevtrigger”, “udevadm trigger” or whatever your distro uses to test it.

Edit, this has been deprecated. Now it’s:

SUBSYSTEM=="scsi", KERNEL=="sd*", ATTR{vendor}=="ST325062", NAME="usbhd%n"

Clonezilla as disk imager

I was always using partimage to make backups of the hard disks of workstations. When trying to restore one the other day, it just started giving CRC errors. After recreating the image and running a simulated restore, it gave CRC errors again. So, apparently, it’s not incidental. It must be due to the experimental NTFS support. So, I set out to find a new tool. And that’s how I found Clonezilla, which gives me a very good first impression.

Clonezilla is a wizard-style live CD. It uses several tools, including partimage. However, it prefers ntfsclone over partimage at it’s default settings. Besides its handy interface, it has some very cool features: It doesn’t only create the image, but also some other useful files, such as the MBR (first 512 bytes of a disk), the data between the MBR and the first partition, an sfdisk dump of the partition table and some files with info about the PCI devices and other hardware. All this ensures you can properly restore the image.

Also, it has support for leaving out the page- and hybernation files on Windows systems, which can save you several gigabytes of space. And, to top it off, it calls “sync” when everything is done. They must have read my backup article :).

And the last major thing: it allows you to remove the CD when rebooting or halting. It is so incredibly annoying when live CD’s don’t do that…

A must have live CD for any sysadmin, I would say.

Gentoo update: Portage configuration confusion

During the first gentoo update session for this machine, I didn’t get very far. I already mentioned the problem I had with e2fsprogs, but this was not the first or the last problem that I had.

Until a few moments ago, I actually thought I made a bit of a fuck-up. I was meaning to make regular snapshots of /etc/portage files for a while now, because I was always just an echo something >> /etc/portage/package.keywords with one >-symbol too few away from destroying my configuration. Despite this fear, I thought I had already started deleting entries from /etc/portage/package.keywords and /etc/portage/package.unmask without backing up first.

Luckily, it turns out that I did make a dated copy of /etc/portage/package.keywords before starting on my modifications. I didn’t do so for /etc/portage/package.unmask, but I recovered a recent enough version from a recent full system rsync backup. So, everything is good. Still, I’m glad that I now use Git to track all changes in /etc/. All this goes to show that my methods are sometimes a bit more organized than my mind, which, I suppose, is a good thing. ๐Ÿ˜•

The point of this post—yes, there is a point—the point is that once you start mixing stable and unstable stuff, your system becomes, ehm, unstable. I have this huge amount of crap already in /etc/portage to cater to my wish to run stuff that I know to be quite stable but that isn’t yet marked as such in the Gentoo porttree. Now, after many months, I want to remove everything from package.keywords and package.unmask that is no longer necessary.

I was going to write about all the complicated upgrades, downgrades and conflicts suggested by Portage (mostly related to me removing KDE 4 stuff from package.keywords and package.unmask), because I was confused about what changes I had made. With the relevant backups readily available for comparison, I am no longer in a hurry to untangle my thoughts and I’ve moved the preliminary notes to a new draft for when I’ll actually update KDE 4.

Actual justification for this post

I’m trying to get into a blogging style were I post a lot more rubbish like this that can’t possibly be of any use to anybody except myself. I have plenty of reasons/excuses for this (about which I’ll likely post in the future), but I shouldn’t actually need any. That Ryan wanker who thinks I publish this blog for him should really shut the fuck up. Sure enough, he isn’t talking about this blog but I still think he’s a big-time asshole. Fuck you, Ryan!

Tracking /etc/ updates with Git

During my recent Gentoo update session, I was once again confronted with the inconvenience of not having my /etc/ directory under version management. This time, I thought I had the ideal SCM for this job: Git.

I found a blog post of a chap who has done the same. It includes a few notes I might not have thought about on my own and also a few very cool Debian tricks.

One of the steps that I might have overlooked myself is that it’s essential to make the .git directory group/world inaccessible with chmod go-rwx. If I would have forgotten this, a smart attacker might use my Git repo to access forbidden file contents.

The author also describes a cool Post-Invoke for Debian’s dpkg that will automatically stage and commit configuration changes made by apt/dpkg (although, later, he mentions that Debian has gotten a package could etckeeper that does this automatically.

Now I would like to learn how I can let Gentoo’s etc-update do as much. In its /etc/dispatch-conf.conf I can only find the option to use (of all things) RCS to track replaced configuration files in a special directory (/etc/config-archive/ by default). Hopefully, there is some drop-in replacement for etc-update which does this and which can rid me of etc-update’s awkward interface at once.

Lost my Sysop rights in the 15Monkeys wikis

I am constantly bugged by spammers in my 15 Monkeys wiki farm[1, 2], but I wasn’t allowed to protect the victim pages anymore. So, I wondered where my Sysop rights had gone.

Turned out they weren’t gone:

SELECT user_id, user_name, CONCAT( '"', ug_group, '"' ) AS ug_group_quoted
FROM mw_nl_user_groups
INNER JOIN mw_nl_user ON ( ug_user = user_id )
user_iduser_nameug_group_quoted
1BigSmoke"bureaucrat "
1BigSmoke"sysop "

They were just padded a bit. I have had a similar problem with MediaWiki before, so I remembered where to look within the hour this time. ๐Ÿ˜‰ I tried a quick fix:

UPDATE mw_nl_user_groups SET ug_group = rtrim(ug_group);

I was surprised to see in phpMyAdmin that the values where now no longer padded with spaces, but with null-bytes (“\0“) instead. I tried to fix this untill I found out that this is the normal behaviour in MySQL 5.0.15. The MySQL documentation also mentions that, before 5.0.15, VARBINARY values were padded with spaces instead. Apparently, my mystery problems with padding were never caused by MediaWiki but by MySQL itself… PostgreSQL, where are you when I need you?

My advice: don’t run your own database-backed CMS if you don’t have at least rudimentary DBA skills.

The suckiness is: this time, the problem isn’t solved by just converting the padding. ๐Ÿ™ I’ll have to look into it some further.

ImageMagick can convert PDF to anything

I encountered one of those scans which was shared as a single-page PDF. I don’t want it that way, because I want to include it in a web page. I want a simple bitmap image. ImageMagick comes to the rescue:

convert scan.pdf scan.jpg

If the resolution this produces is too low for you, try telling Ghostscript (which ImageMagick uses internally) that you want a different density:

convert -density 300 scan.pdf scan.jpg

Attribution

Googling linux pdf to jpg produced two useful results:

  1. Batch converting PDF to JPG/JPEG using free software
  2. Converting PDF to PNG/JPG using ImageMagick in Linux

smbmnt user needs to own the mountpoint if you want to mount rw

I just found out that it’s impossible on my system to mount /mnt/smb-docs as user bigsmoke, even with the following fstab:

//server/shared\040documents       /mnt/smb-docs smbfs   noauto,user,uid=bigsmoke,username=secret,password=alsosecret  0 0

I tried to chmod 775 /mnt/smb-docs; chgrp bigsmoke /mnt/smb-docs, but no luck. I had to actually chown bigsmoke /mnt/smb-docs. Does someone understand why? I noticed that I’m not the only one who noticed this.

Google AdSense + Postbank’s name registration rules = $0.0

In November I had expected my second AdSense payment. Simply, because they told me I would get it. But, I didn’t.

The reason was not very specifically given. The electronic fund transfer failed: “EFT not successful”. That was it. The help wasn’t very useful either: I could find only one somewhat relevant entry.

My guess was that it had something to do with the name associated with my bank account in my AdSense account, because my particular bank, the Postbank is known to be very picky when it comes to accepting names. I’m not the first AdSense publisher to suffer this kind of problem.

The name I had used in my AdSense profile was Rowan Rodrik van der Molen. When I log into my bank’s online banking service, I see R.R. vd Molen very big on top of the screen. However, nowhere it mentions if this is indeed the name I should use to receive an electronic fund transfer. I want to find out for sure and I can’t find this information anywhere on the bank’s website. So I grab the telephone and I call their customer support service. I have four questions, only two of which were provided with a somewhat clear answer:

  • Question one is: do you indeed not accept transfers where the name does not match the name you have on file, or rather the string that you derived from the name details that I supplied when opening an account?
  • Question two: how do you derive that string? How can I know for sure what the proper name is to give out to people?
  • Question three: have your rules gotten more stringent recently? (Seems logical to me because a. I did receive my first payment (and the verification transfer); and b. I heard from my uncle that he also had increasing difficulties in transferring money to Postbank account holders.)
  • Question four: do I need to include the placename in the account name and how?

Question one was answered in a pretty ignorant manner: Of course the name needs to be correct. How could you think otherwise? This was pretty annoying because I did fill the name in correctly, so this automatically led to question two to which the support dude answered that the name I see when I login is indeed the name I should use. However I don’t consider the answer answered properly because I couldn’t get an answer to question four. Question 3 was vehemently denied to my surprise.

Before calling I had already tried to find out more with the help of Wiebe, who is also a Postbank account holder. When from their on-line banking interface, you try to transfer something to another Postbank account holder, you’re prompted to verify the name you entered with the correct name they have associated with that account. If he tries to make an amount to me, he gets to pick the name R R vd Molen GRONINGEN (note the difference in punctuation). So, does the placename (Groningen) needs to be part of the name. Sadly, the grumpy telephone support person couldn’t clarify this. All he could say was that the transfer needs to mention a place name while I want to know specifically if it needs to be in the name field. Fuckers! (Actually I don’t want to know. After this episode, I just want to know how to rid myself of this bank as easily as possible.)

I was somewhat resolved to change the name associated with my bank account number in AdSense to R.R. vd Molen although I had no way of being sure that it didn’t have to be R R vd Molen or R.R. vd Molen GRONINGEN. But, I had already noticed that this wasn’t possible; there was no way to add a new bank account nr with the correct name because the old account nr was blocked (and could not be deleted by me), while the name associated with a bank account nr could only be changed while adding a new account. The impossibility of making any useful change myself was what had prompted me to contact the Postbank’s customer support in the first place, because I had no way to experiment with different settings. And if I was going to ask the AdSense support staff to make the changes for me, I better ask them for the right changes at once.

I needed help, from a person. I was somewhat glad that, when I followed the link to “Contacting support” in the AdSense help, I found that they did have limited email support. After struggling through another form, I could actually type a request for help. They replied:

Hello,

Thanks for your email regarding AdSense EFT payments. Due to the high volume of emails we receive, we’re unable to individually respond to your inquiry. However, we’ve provided some information below which we hope will address your question. If you still have unresolved issues, we encourage you to visit the AdSense Help Center at http://www.google.com/adsense/support or post your question on the AdSense Help Forum at http://groups.google.com/group/adsense-help.

– Is EFT available to me?

Currently, EFT is available for publishers located in the countries listed at http://www.google.com/adsense/support/bin/answer.py?answer=15827 . For tax and security purposes, publishers may only submit bank information that corresponds to the country of residence which appears in their payment address. We’re currently working on expanding our payment options to additional publishers, and we appreciate your patience.

– When was my test deposit sent? Why haven’t I received it yet?

To find out the date we attempted to make the deposit, please select the ‘My Account’ tab and click the ‘Verify this account’ link in the ‘Payment Details’ section. You should see your test deposit appear in your bank account within 4-10 days of the date listed in your account. If it has been more than 10 days since the listed date, please follow the instructions at http://www.google.com/adsense/support/bin/answer.py?answer=41237 .

– I’ve just received my test deposit. Why can’t I enter it into my account?

Depending upon how quickly your bank credits your account, you may receive your test deposit before our system has been updated. Once we receive confirmation from the bank that the test deposit has been successful, the date of the deposit will appear on the ‘Verify Your Bank Account’ page. You’ll then be able to enter the amount of the deposit in your AdSense account by following the instructions at http://www.google.com/adsense/support/bin/answer.py?answer=15920 .

– I’ve selected EFT as my form of payment – when will I be paid?

When your total unpaid balance reaches US $100 in any month, we will send you a payment at the end of the following month, unless a payment hold exists. For example, if your earnings reached $100 this month, you’ll be paid at the end of next month. If your account balance has not yet reached US $100, your earnings will carry over to the following month and continue to accrue. You may also find the information at http://www.google.com/adsense/support/bin/answer.py?answer=9905 helpful.

– How can I edit my bank account information within my AdSense account?

We can’t access or edit your bank account information, so you will need to re-enter it. Please follow the steps listed at http://www.google.com/adsense/support/bin/answer.py?answer=15920 .

– How do I remove incorrect or unverified bank account information from my AdSense account?

Unfortunately, incorrect or unverified bank account information cannot be removed from your account at this time. However, please be assured that to protect the privacy and security of your banking information, we do not have access to the information you have entered. The information will also not affect your future payments.

Additionally, you might find the information at http://www.google.com/adsense/support/bin/topic.py?topic=8453 helpful.

Sincerely,

The Google AdSense Team

Original Message Follows:
————————
From: bigsmoke@gmail.com
Subject: Electronic Funds Transfer (EFT)
Date: Thu, 15 Jan 2009 16:17:22 +0000

The EFT payment that was issued to me in November was unsuccessful. A previous payment _was_ successful, but now I’m stuck with a blocked account and the inability to receice payments.

I’ve requested (and received) instructions from my bank about _exactly_ which notation to use for my name. The proper notation is “R.R. vd Molen”, but I can’t change this myself in the AdSense interface unless when I’m entering a new bank account and I can’t enter a new bank account because the account number has already been flagged as non-working in your interface.

My request to you is to either change the account holder name for my bank account number ending in 51 or to enable me somehow to correctly readd the account myself. The name should be changed from “Rowan Rodrik van der Molen” to “R.R. vd Molen”. Yes, we really _are_ stuck in the stone age here in The Netherlands.

Thanks for your time,
Rowan

So basically, what their mail is saying is that I either have to forget about getting any money from Google or I should switch banks. Admittedly, this doesn’t look to bad to me now because my annoyance level with the Postbank has really gone through the roof lately. Google, you suck! Postbank, you suck even worse!

Thank you Wiebe for letting me use your bank account to receive the payments while I deliberate switching banks.

Untangling WordPress’ core files from your local customizations

Since version 2.6, WordPress can be installed in its own directory, separate from your customizations and everthing. Needless to say, this makes upgrading a whole lot easier.

If, in the pre-2.6 days, you wanted to fetch your WordPress updates through SVN, the docs would advice you to do an svn checkout from the official WP SVN repo in your working dir and then do an svn update whenever you want to update WordPress. This works because svn update leaves local modifcations alone. However, this means that you’ll be unable to commit your local changes (configuration, themes, plugins, etc.) if you choose this route.

I used my own subversion repository for my blogs and thus had to upgrade the old fashioned way with each release (although I prefer diff/patch over rm/cp). (I could have used vendor branches, but, clearly, I hadn’t thought about that at the time.) This was pretty much a royal pain in the ass, so I was glad when I could move WordPress into a separate directory with its 2.6 release.

This process consisted of removing everything except wp-content/, wp-config.php, .htaccess. (I also kept robots.txt, favicon.ico and some other personal files.) Then, I added the current WordPress release as an svn:external.

svn propset svn:externals 'wp-factory http://svn.automattic.com/wordpress/tags/2.6.1' .

.htaccess changes

In the WordPress codex, it is then suggested to copy index.php to the root dir and to change it to require wp-factory/wp-blog-header.php instead of ./wp-blog-header.php. I preferred adding some mod_rewrite voodoo of my own to .htaccess, so I did:

<IfModule mod_rewrite.c>
# This way I don't need directory indices
RewriteRule ^$ /wp-factory/index.php [L]
 
# This way WordPress can manage its own block without doing any harm
RewriteRule ^index.php /wp-factory/index.php [L]
 
# Allow easier access to /wp-factory/wp-admin/
RewriteRule ^wp-admin http://%{HTTP_HOST}/wp-factory/wp-admin/ [L,R=301]
</IfModule>

The middle rule performs most of the magic. It redirects all the requests to /index.php to the factory default index.php. This means that I can let WordPress pretend that index.php does live in the root, so I don’t have to modify the rewrite rules that are managed by WordPress itself:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress 

wp-config.php changes

In Giving WordPress Its Own Directory in the WordPress Codex, it is suggested to change the “siteurl” and “home” options through the administration panel. In my case they would have to be changed to “http://blog.bigsmoke.us/wp-factory/” and http://blog.bigsmoke.us“. I couldn’t do this because I override these with WP_SITEURL and WP_HOME in my wp-config.php. This is because I configured WordPress to support a development environment separate from the live production environment.

Ignoring the customizations for my development environment, these are the relevant settings in wp-config.php:

define('WP_HOME', 'http://blog.bigsmoke.us');
define('WP_SITEURL', WP_HOME . '/wp-factory');
 
define('WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content');
define('WP_CONTENT_URL', WP_HOME . '/wp-content');

BTW: I really like it how WordPress disables the form controls for siteurl and home when you override these settings in wp-config.php. Kudos for that, devs!

Next time: git

In the end, this is all quite a bit of pain to compensate for what is essentially a version management problem. That’s why, on my newer projects, I’m now using git which makes forking and tracking an upstream repo absolutely trivial. ๐Ÿ™‚

A few references

Gentoo update: e2fsprogs blocks e2fsprogs

Yesterday evening, I dropped by at Wiebe‘s with my laptop to start updating our Gentoo systems together. I hadn’t updated this machine since first installing it in spring last year, so I expected quite a few problems. The first blockage that we both had to solve was caused by e2fsprogs.

Wiebe searched the forums for help and found an unfortunate abundance of it. Eventually, I decided to give one of the many contradictory tips a try, although it seemed risky.

$ emerge --unmerge --ask --verbose e2fsprogs

Until you reinstall e2fsprogs, you won’t have any of the ext2/3 utilities such as e2fsck. So, reinstall immediately:

$ emerge --oneshot --ask --verbose e2fsprogs

This will remove libcom_err and libss, and replace them with e2fsprogs-libs, thus solving the blockages.

Wiebe tried an alternative route by first unmerging com_err and ss, and then replacing e2fsprogs. This didn’t work as expected, probably because he had kerberos in his use flags. libkerberos used libcom_err, which broke wget. Scp’ing the distfiles to him didn’t work either (OpenSSH also has kerberos support). Neither did mounting an USB stick with the files. Luckily, Thunderbird still worked, so I emailed the distfiles and the problem was solved. We found it amusing to have to use e-mail while being in the same room. ๐Ÿ˜‰

The reason why this blockage occurred is not entirely clear to me. What I do understand is that com_err and ss were both provided by the e2fsprogs project and are now deprecated in favor of e2fsprogs-libs. Also, it’s clear that the new libraries are binary compatible with the old libraries or his system would have remained unusable, even after merging e2fsprogs-libs.

Before we tackled this problem, I had only updated portage and net-print/foomatic-db-ppds (also a blocking situation). Afterwards, I had just some motivation left to update krb5. Which leaves another 282 packages for the next get-together.

« Older posts Newer posts »

© 2024 BigSmoke

Theme by Anders NorenUp ↑