tag:blogger.com,1999:blog-11818376285168272352024-03-05T09:08:02.905+00:00*nix NotesMaking open source happen, with Linux et al.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.comBlogger52125tag:blogger.com,1999:blog-1181837628516827235.post-50334742922667353452015-07-25T19:49:00.000+01:002015-07-25T21:56:24.353+01:00Dropping unnamed foreign key constraints in MySQLIf you're simply amending a live database, this isn't a problem. However, when you need statically define operations with database change management tools like Liquibase or Flyway, using raw SQL change scripts, then it becomes more arduous.<br />
<br />
The problem resides around DDLs such as <span style="font-family: Courier New, Courier, monospace;">ALTER TABLE</span> requiring non-dynamic strings - you can't use subqueries or variables. This makes it difficult to use with fixed SQL files.<br />
<br />
I chose to introduce a Stored Proc to handle the task. This example is from Liquibase:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">--changeset x:1 dbms:mysql splitStatements:false</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">CREATE PROCEDURE drop_unnamed_fk_constraint</span><br />
<span style="font-family: Courier New, Courier, monospace;">(</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>IN tableName CHAR(100),</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>IN columnName CHAR(100),</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>IN refTableName CHAR(100)</span><br />
<span style="font-family: Courier New, Courier, monospace;">)</span><br />
<span style="font-family: Courier New, Courier, monospace;">BEGIN</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>SET @sql := (SELECT CONCAT('ALTER TABLE ', table_name, ' DROP FOREIGN KEY ', constraint_name)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>WHERE TABLE_NAME = tableName </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>AND COLUMN_NAME = columnName </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>AND REFERENCED_TABLE_NAME = refTableName);</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>PREPARE drop_unnamed_fk_constraint_stmt FROM @sql;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>EXECUTE drop_unnamed_fk_constraint_stmt;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>DEALLOCATE PREPARE drop_unnamed_fk_constraint_stmt;</span><br />
<span style="font-family: Courier New, Courier, monospace;">END </span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">--changeset x:2 dbms:mysql</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">CALL drop_unnamed_fk_constraint('Table', 'column', 'ReferencedTable');</span><br />
<br />
If you're also using H2 for testing, then you can emulate the Stored Procedure with a (less than delightful) <a href="http://www.h2database.com/html/features.html#user_defined_functions" target="_blank">user-defined function</a>:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">--changeset x:1 dbms:h2 splitStatements:false failOnError:false</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">CREATE ALIAS drop_unnamed_fk_constraint AS $$</span><br />
<span style="font-family: Courier New, Courier, monospace;">void dropConstraint(Connection conn, String tableName, String columnName, String refTableName) throws Exception {</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>ResultSet rs = conn.createStatement().executeQuery("SELECT CONCAT('ALTER TABLE " + tableName + " DROP FOREIGN KEY ', constraint_name) " +</span><br />
<span style="font-family: Courier New, Courier, monospace;"> "FROM information_schema.constraints " +</span><br />
<span style="font-family: Courier New, Courier, monospace;"> "WHERE table_name = '" + tableName.toUpperCase() + "' " +</span><br />
<span style="font-family: Courier New, Courier, monospace;"> "AND column_list = '" + columnName.toUpperCase() + "' " +</span><br />
<span style="font-family: Courier New, Courier, monospace;"> "AND constraint_type = 'REFERENTIAL' LIMIT 1");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> rs.next();</span><br />
<span style="font-family: Courier New, Courier, monospace;"> conn.createStatement().executeUpdate(rs.getString(1));</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;">$$;</span><br />
<br />
Note that <a href="http://www.h2database.com/html/grammar.html#information_schema" target="_blank">not all</a> <span style="font-family: Courier New, Courier, monospace;">information_schema</span> tables presently exist in H2, so I'm using <span style="font-family: Courier New, Courier, monospace;">constraints</span> instead.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-11678887443810015922015-07-25T13:14:00.004+01:002015-07-25T13:14:57.451+01:00Stuck control keys under UbuntuEncountering a "stuck key" condition - a key that's permanently active - can be highly frustrating. A control key permanently depressed can mean that mouse events behave improperly, such as the scrollwheel controlling zoom instead of page scroll, or left mouse clicks triggering right-click menus.<br />
<br />
I occasionally encounter this condition on an Ubuntu configuration, which I expect is an artefact of <a href="http://synergy-project.org/" target="_blank">Synergy</a> usage, but don't have the time to debug.<br />
<br />
To resolve this frustrating issue when it occurs, I use the following alias:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">alias fixkeydown='DISPLAY=:0; for i in `seq 1 256`; do xdotool keyup $i; done; echo Done'</span>Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-87554915140842975092014-01-31T01:13:00.000+00:002014-01-31T01:33:27.717+00:00Migrating from Rhythmbox to Clementine<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWQyOhI1ch7nogt5eniaw5i9XRTQhWrbFVlRttD10SBqNEUaTzp9Rr4TKZJzap0a0rjgM8PU9T9NoOP-SKh1_PmakhqSKGAgJ8asphvFz3URl_HyzwUnTE-vSywalIcfZSbCTpfYc1e5M/s1600/clemVsRhythm.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWQyOhI1ch7nogt5eniaw5i9XRTQhWrbFVlRttD10SBqNEUaTzp9Rr4TKZJzap0a0rjgM8PU9T9NoOP-SKh1_PmakhqSKGAgJ8asphvFz3URl_HyzwUnTE-vSywalIcfZSbCTpfYc1e5M/s1600/clemVsRhythm.png" height="200" width="181" /></a></div>
Some months back, an update rendered my main Rhythmbox installation largely unusable. Changing playlists would lock the application for about 60 seconds, and ultimately Rhythmbox would end up exhausting its stack and crashing. Not good.<br />
<br />
To save myself from having to trawl the codebase searching for the needle in a haystack, I figured I'd switch to something shiny and fresh. After some searching, I settled on <a href="http://www.clementine-player.org/" target="_blank">Clementine</a>; a featureful, cross-platform player, boasting an Android remote control application, integration with countless online services, good performance with large libraries, visualisations, and the like.<br />
<br />
<b>Porting Metadata</b><br />
<br />
In order to make the switch, I needed to migrate not only my songs, but also a few key pieces of metadata I decided I couldn't do without: rating, play count, and last played date.<br />
<br />
Rhythmbox stores its library in an xml file, and Clementine stores its library in a sqlite database, and no migration tool existed that I could see. Hence, I hacked up a quick and nasty python script to do the dirty work and enrich Clementine's database with my additional metadata.<br />
<br />
It relies on your having first imported your music into Clementine via the Clementine user interface.<br />
<br />
The script searches Clementine's library, correlates songs (by path) between Clementine and Rhythmbox, and where it finds matches, it enriches Clementine's metadata.<br />
<br />
The fact that it correlates songs by path location means that the location URIs in rhythmdb.xml must match the location URIs in Clementine's database; otherwise, the script won't be able to match them up.<br />
<br />
If you're in the same boat I was, you may find this script useful to use as-is, or as a base to build on.<br />
<br />
<b>Forewarning</b><br />
<br />
Caveat emptor: this script was tested <i>once</i>, using one library, on one system, with Rhythmbox 2.99.1, and Clementine 1.2.1. That is all. Be forewarned: expect to have to delve into the Python code to get it working, or to have to restore your Clementine configuration from backup, or for your computer to spontaneously explode in disgust, or goodness knows what else.<br />
<br />
This script was a quick hack for my one-time use, and is not something I've lovingly crafted and polished to make "production ready".<br />
<br />
<b>Method</b><br />
<br />
First, prepare your system:<br />
<ol>
<li>Import your music library into Clementine via the Clementine user interface.</li>
<li>If necessary, make a copy of your rhythmdb.xml library (by default, located at <span style="font-family: Courier New, Courier, monospace;">~/.local/share/rhythmbox/rhythmdb.xml)</span>and perform search and replace with the tool of your choice, to clean the <span style="font-family: Courier New, Courier, monospace;">location</span> URIs of any symlinks (e.g, <span style="font-family: Courier New, Courier, monospace;">file:///symlink/Bach/1.flac</span> should be resolved to <span style="font-family: Courier New, Courier, monospace;">file:///absolute/path/to/Bach/1.flac</span>). If you haven't used any symlinks in paths to your music files, then skip this step.</li>
<li>Take a backup of your Clementine configuration directory, just in case: <span style="font-family: Courier New, Courier, monospace;">cp -R ~/.config/Clementine ~/.config/Clementine-backup</span></li>
</ol>
<div>
<span style="font-family: inherit;">Then, download the script and run it in dry-run mode:</span><br />
<span style="font-family: inherit;"><br /></span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$ wget http://content.nixnotes.co.uk/rhythmbox2clementine/rhythmbox2clementine</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$ chmod +x rhythmbox2clementine</span></div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$ ./rhythmbox2clementine -d</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">If satisfied that things look sensible, run it in commit mode:</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">$ ./rhythmbox2clementine</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div>
If something went wrong and you need to restore your original Clementine configuration, simply restore the backup directory you made earlier:</div>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$ mv ~/.config/Clementine-backup ~/.config/Clementine</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: inherit;"><b>Usage</b></span></div>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">$ ./rhythmbox2clementine -h</span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">usage: rhythmbox2clementine [-h] [-d] [--rhythmdb RHYTHMDB]</span></div>
<div style="font-family: 'Courier New', Courier, monospace;">
[--clemdb CLEMDB]</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
<div style="font-family: 'Courier New', Courier, monospace;">
Enriches a Clementine library with ratings and play counts from Rhythmbox</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
<div style="font-family: 'Courier New', Courier, monospace;">
optional arguments:</div>
<div style="font-family: 'Courier New', Courier, monospace;">
-h, --help show this help message and exit</div>
<div style="font-family: 'Courier New', Courier, monospace;">
-d, --dryrun Don't actually commit any changes to the Clementine</div>
<div style="font-family: 'Courier New', Courier, monospace;">
database</div>
<div style="font-family: 'Courier New', Courier, monospace;">
--rhythmdb RHYTHMDB Override the default Rhythmbox library location</div>
<div style="font-family: 'Courier New', Courier, monospace;">
~/.local/share/rhythmbox/rhythmdb.xml</div>
<div style="font-family: 'Courier New', Courier, monospace;">
--clemdb CLEMDB Override the default Clementine sqlite DB location</div>
<div style="font-family: 'Courier New', Courier, monospace;">
~/.config/Clementine/clementine.db</div>
<div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
<span style="font-family: inherit;"><b>Sample output</b></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">$ ./rhythmbox2clementine -d</span><br />
<span style="font-family: Courier New, Courier, monospace;">Operating in DRY RUN mode</span><br />
<span style="font-family: Courier New, Courier, monospace;">Using Rhythmbox XML DB path: /home/[USER]/.local/share/rhythmbox/rhythmdb.xml</span><br />
<span style="font-family: Courier New, Courier, monospace;">Using Clementine sqlite DB path: /home/[USER]/.config/Clementine/clementine.db</span><br />
<span style="font-family: Courier New, Courier, monospace;">Rhythmbox library contains 50529 songs</span><br />
<span style="font-family: Courier New, Courier, monospace;">Clementine sqlite 3.7.17</span><br />
<span style="font-family: Courier New, Courier, monospace;">Clementine library contains 50782 songs</span><br />
<span style="font-family: Courier New, Courier, monospace;">DRY RUN: Not committing any changes to your Clementine library</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">8552 out of 50529 songs would have been enriched</span><br />
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-28142711754684486372013-10-27T23:58:00.002+00:002013-11-24T01:41:58.988+00:00Configuring Logcheck on Ubuntu<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6NoK6tgHUJRvl5fCi6pVtvDoe-hTxJT9IIrnNp6Gc8ovkKqRzXin9AOzsCnIRCgO-mZWz-g3EpwCAX73j-E629LuTd6fKQpU3xSf2o2rzGRoj3yoKeRxjnujreDuVbIUHrxJ-HEN0q9M/s1600/securityevent.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6NoK6tgHUJRvl5fCi6pVtvDoe-hTxJT9IIrnNp6Gc8ovkKqRzXin9AOzsCnIRCgO-mZWz-g3EpwCAX73j-E629LuTd6fKQpU3xSf2o2rzGRoj3yoKeRxjnujreDuVbIUHrxJ-HEN0q9M/s1600/securityevent.png" /></a></div>
System logs provide a wealth of important detail about activity on our systems; from incorrect configurations, to failing hardware, to remote attacks. If we don't check our logfiles, all this information goes to waste, and the only time we'll find out something is amiss is when scheduled events fail to run, or a drive fails, or the system is identified as part of a botnet...<br />
<br />
That said, most of us have better things to do than trawl our plethora of overly verbose logfiles every few minutes. One way of meeting our systems halfway is to receive summaries of uncommon and important log entries on a regular basis. In my case, I have these summaries sent to a dedicated mail account, which I check via my phone, at my leisure.<br />
<br />
This way, the most important information is collected and sent to me, for perusal when I have time. It's a win-win situation.<br />
<br />
For the task of logfile distillation and email preparation, I use a handy tool called <a href="http://logcheck.org/" target="_blank">logcheck</a>.<br />
It contains a large collection of rules which filter out "uninteresting" log entries, leaving just the tastier morsels for my daily commuting pleasure. It also contains a set of rules for "violations"; significant events, which logcheck separates into another email to highlight their occurrence.<br />
<br />
Over time, you'll find yourself tuning these rules to reduce your reading burden. With each rule being a simple regex string, this is no great ordeal.<br />
<br />
<b>Installing Logcheck</b><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install logcheck</span><br />
<br />
Now to configure it:<br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">sudo vim /etc/logcheck/logcheck.conf</span><br />
<br />
The one change you do need to make is to tell logcheck where to send its reports to:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">SENDMAILTO="recipient@domain.com"</span><br />
<br />
Aside from that, it's worth reading over this file to see what else you'd care to change. I like to set the following; shortening the subject line and the message:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">INTRO=0</span><br />
<span style="font-family: Courier New, Courier, monospace;">DATE="$(date +'%H:%M')"</span><br />
<span style="font-family: Courier New, Courier, monospace;">FQDN=0</span><br />
<span style="font-family: Courier New, Courier, monospace;">ATTACKSUBJECT="Security Alert"</span><br />
<span style="font-family: Courier New, Courier, monospace;">SECURITYSUBJECT="Security Event"</span><br />
<span style="font-family: Courier New, Courier, monospace;">EVENTSSUBJECT=</span><br />
<br />
Logcheck executes via cron, so there's no service to restart after updating the config file. By default, it runs 2 minutes past every hour.<br />
<br />
You can force a report to run by invoking logcheck manually. Try it out now:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo -u logcheck logcheck</span><br />
<br />
However, unless you're already running a mailserver, you're likely to find that nothing interesting happens at this stage. This is because logcheck expects to use the <a href="http://en.wikipedia.org/wiki/Sendmail" target="_blank">sendmail</a> command to send the email message; and this is where things get interesting.<br />
<br />
<b>Sendmail</b><br />
<br />
Sendmail has been in existence since the 1980s. It's a veritable swiss army knife of a mailserver. However, it's an interesting beast to try to configure.<br />
<br />
Most end users, like myself, will simply want logcheck to send their status emails via an external mailserver - say, a gmail server, or one provided by their hosting company. Well, it should be easy enough to configure a relay to an external mailserver with a powerful tool like sendmail. But that wasn't my experience. Between a mess of dnl terminators, FEATUREs, bizarre config parameter names and the magical world of sendmail's string quotes, I started losing the will to live.<br />
<br />
Switching from sendmail to postfix (a simpler, drop-in replacement) was a welcome improvement; but it was still too heavy a solution for a task as simple as this. Hash dbs, stunnel... it all involved an unnecessary number of moving parts. Ergo, for simple mail relay to an external mailserver, I sought an alternative.<br />
<br />
<b>Configuring Mail Relay with MSMTP</b><br />
<br />
First, I tried <a href="https://wiki.debian.org/sSMTP" target="_blank">ssmtp</a>, which had a good reputation for being a simple, lightweight, and reliable solution for mailserver relay. However, that coredumped straightaway on my x64 box, so I switched to <a href="http://msmtp.sourceforge.net/" target="_blank">msmtp</a>, which is very similar.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install msmtp</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo vim /etc/msmtprc</span><br />
<br />
A simple configuration looks like:<br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">defaults</span><br />
<span style="font-family: Courier New, Courier, monospace;">tls on</span><br />
<span style="font-family: Courier New, Courier, monospace;">tls_trust_file /etc/ssl/certs/ca-certificates.crt</span><br />
<span style="font-family: Courier New, Courier, monospace;">logfile /home/<b>USERNAME</b>/.msmtp.log</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"># Account fooBar</span><br />
<span style="font-family: Courier New, Courier, monospace;">account <b>fooBar</b></span><br />
<span style="font-family: Courier New, Courier, monospace;">host <b>smtp.foo.bar.com</b></span><br />
<span style="font-family: Courier New, Courier, monospace;">port <b>587</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"># Note that this is simply envelope-from, not the mail's "From" header</span><br />
<span style="font-family: Courier New, Courier, monospace;">from <b>me@foo.bar.com</b></span><br />
<span style="font-family: Courier New, Courier, monospace;">auth on</span><br />
<span style="font-family: Courier New, Courier, monospace;">user <b>me@foo.bar.com</b></span><br />
<span style="font-family: Courier New, Courier, monospace;">password <b>ySSwbUsnEz5M</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"># Use fooBar as the default account</span><br />
<span style="font-family: Courier New, Courier, monospace;">account default : <b>fooBar</b></span><br />
<br />
<blockquote class="tr_bq">
msmtp will use STARTTLS where possible to enter TLS mode, so that passwords are sent over an encrypted channel. The <a href="http://msmtp.sourceforge.net/doc/msmtp.html#Authentication" target="_blank">documentation</a> claims that it will not try to send the password in an insecure form over an insecure channel: "<i>If you really want to risk your authentication data, you have to force msmtp to do that by manually setting the authentication method while TLS is off.</i>" If you like, you can confirm this via Wireshark or tcpdump. </blockquote>
<blockquote class="tr_bq">
For simplicity here, I've hardcoded the password. Obviously, this is <b>not good</b>, and you'll want to take steps to remedy this once you have it working. A quick workaround involves limiting access to /etc/msmtprc to a particular group, e.g. "msmtp", and adding the logcheck user to that group. An arguably slightly more rugged approach involves using msmtp's <i>passwordeval</i> to invoke gpg (backed by gpg-agent to support non-interactivity) to decrypt a password file.</blockquote>
<blockquote class="tr_bq">
Either way, it's a very good idea to use a separate dedicated email account for logcheck notifications, as I have done; this way, there is much less to lose via password exposure (an attacker with local system access has the ability to view your logfiles anyway). </blockquote>
<br />
Now, verify you can send a mail with:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">echo "Test from msmtp" | msmtp recipient@domain.com</span><br />
<br />
If you received that mail, congratulations. You've configured a command-line mailer. Now you need to override lsb-invalid-mta and tell your system to use msmtp as its sendmail-compliant mailer:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s /usr/bin/msmtp /usr/local/sbin/sendmail</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo ln -s /usr/bin/msmtp /usr/local/bin/sendmail</span><br />
<br />
Test with:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">echo -e "Subject: I hope I receive this\nTest from sendmail" | sendmail </span><span style="font-family: 'Courier New', Courier, monospace;">recipient@domain.com</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span style="font-family: inherit;">If you want, you can also configure it as your system's "mail" command mailer too. (It's not necessary for logcheck, but you may find it useful for command line e-mailing)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span style="font-family: 'Courier New', Courier, monospace;">echo 'set sendmail="/usr/bin/msmtp"' | sudo tee -a /etc/.mailrc</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
Test with:<br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">echo "Test from mail" | mail -s "This too" </span><br />
<span style="font-family: Courier New, Courier, monospace;">recipient@domain.com</span><br />
<br />
So, in future, should you want to send mail from the command line, you can use either the "mail" or "sendmail" utilities.<br />
<br />
<b>Logcheck</b><br />
<b><br /></b>
With an external email relay configured, and the sendmail command working, logcheck should start sending its updates each hour. Try it out by creating a security event (try to sudo using an invalid password, for example).<br />
<br />
Logcheck does have its flaws. Ironically, it doesn't offer much by way of logging itself, and its verbose mode (-dd) could provide more detail. Additionally, I'd like to see more configuration options than are on offer at present.<br />
<br />
However, compared to letting your logfiles wrap around out-of-sight - and out-of-mind - this old tool still has much to offer for simple home system monitoring.<br />
<br />
Happy log scouring!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxS_kAuznSVKhDkrQ8INo-txogo_U01EuZryxu9R_VjRGt1_ljexbPgXSwCLn7mSvAaE1wjCcUdakSO7bulTcgAUjnk90Cnwjo7clZekePumdFdOcM7VqXNZ_72wel330BQREiZE_kLac/s1600/whoopsie.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxS_kAuznSVKhDkrQ8INo-txogo_U01EuZryxu9R_VjRGt1_ljexbPgXSwCLn7mSvAaE1wjCcUdakSO7bulTcgAUjnk90Cnwjo7clZekePumdFdOcM7VqXNZ_72wel330BQREiZE_kLac/s1600/whoopsie.png" /></a></div>
<br />Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-79078697598651678552013-06-16T15:21:00.004+01:002013-06-16T15:33:27.071+01:00Sane Window Placement in Unity<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha-idPYj4wETjaU-5LnV9a-JmMfOE7M-wyOZYsvJfU9ex7pyUGuKGqJmD5rvQiiR31bE-GmRcrEIIKYQOUpUh3zyoV8mynE1kODXSlgpxAjw8AVXuzm4LUywkfosuLmZL-kYVBISftSdM/s1600/movingWindow.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha-idPYj4wETjaU-5LnV9a-JmMfOE7M-wyOZYsvJfU9ex7pyUGuKGqJmD5rvQiiR31bE-GmRcrEIIKYQOUpUh3zyoV8mynE1kODXSlgpxAjw8AVXuzm4LUywkfosuLmZL-kYVBISftSdM/s1600/movingWindow.png" /></a></div>
I've never been terribly enamoured with Unity's window placement algorithm. Granted, it works reasonably well for single monitor configurations. However, once we start using larger multi-monitor configurations, windows all too often pop up on a monitor far away from the one presently in use. That's bad enough; but when we're talking about dialog windows too, it quickly becomes intolerable.<br />
<br />
The simple but effective algorithm of "place beneath the pointer" is a tried-and-tested golden oldie. It is often found on the older-style window managers, built for productivity and simplicity (think descendents of fvwm). It also happens to be ideal for large multi-monitor configurations, as new windows are spawned where your pointer (representing your present view point) is.<br />
<br />
Thankfully, switching to such a placement algorithm is made simple in Compiz.<br />
<br />
Start "ccsm" via the Unity dash, locate the "Window Management" section, click on "Place Windows", and make the following changes:<br />
<br />
Placement Mode -> Pointer<br />
Multi Output Mode -> Use output device with pointer<br />
Force Placement Windows -> enter the text "(type=Dialog) | type=Normal", without the quotes.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-59404152376014341472013-06-01T18:30:00.002+01:002013-10-05T17:53:32.412+01:00Installing Linux on Samsung Laptops<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb595li2ALffm1XJCEIWl-uhavDx9L_Gz4lwqq74sW24VO9dzgJDbvfuyTGq6XVAprqV1fCaeIzXZNCiZU1przw81m2XBquLEOba6p2D2b6pwVRR0b5q2kBbI7kZtKc-Go2jNtIxoQxfs/s1600/Tux_ticked.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb595li2ALffm1XJCEIWl-uhavDx9L_Gz4lwqq74sW24VO9dzgJDbvfuyTGq6XVAprqV1fCaeIzXZNCiZU1przw81m2XBquLEOba6p2D2b6pwVRR0b5q2kBbI7kZtKc-Go2jNtIxoQxfs/s200/Tux_ticked.jpg" width="200" /></a></div>
I'd had enough of waiting for Samsung to comment on their <a href="http://www.phoronix.com/scan.php?page=news_item&px=MTI4ODQ" target="_blank">laptop bricking</a> fiasco. As you may recall from my <a href="http://nixnote.blogspot.co.uk/2013/04/samsung-does-not-support-linux.html" target="_blank">earlier post</a>, Samsung support had set out to obtain some information with good intentions, but ultimately could tell me nothing other than what I interpreted as Samsung refusing to honour their own warranty terms. I wasn't impressed.<br />
<br />
Elsewhere in the ether of the Internet, I could see little sign of progress. In general, people are <a href="https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557/" target="_blank">still waiting</a> for Samsung to issue a statement. Perhaps one of their subsequent BIOS updates has already resolved the issue? They're not saying.<br />
<br />
Having owned this Samsung NP350V5C-A0EUK laptop for 6 months now, I feel as though I've waited long enough. Now's time to bite the bullet and install Linux, regardless of the risks.<br />
<br />
Needless to say, I can't be held responsible for any problems resulting from anyone choosing to follow the following instructions. <br />
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;"><span style="font-size: large;"><b>Due Diligence</b></span></span></b><br />
<br />
Torvalds did pull a <a href="http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=68d929862e29a8b52a7f2f2f86a0600423b093cd" target="_blank">patch</a> written by Matthew Garrett, which limits the amount of data written to UEFI storage, thus preventing (or at least reducing the likelihood) of the issue manifesting. To maximise my chances of success, I intended to install a distro of Linux which included this patch in its installation media.<br />
<br />
To this end, I sought a recently released distro. An obvious candidate was Ubuntu 13.04, having being released just a month or so ago. According to the <a href="https://wiki.ubuntu.com/RaringRingtail/ReleaseNotes#Linux_kernel_3.8.8" target="_blank">release notes</a>, the installation media comes with Ubuntu kernel 3.8.0-19.29 based on Linux 3.8.8 (I also confirmed this on this directly on the installation media ubuntu-13.04-desktop-amd64.iso).<br />
<br />
By comparing drivers/firmware/efivars.c in the <a href="https://launchpad.net/ubuntu/+archive/primary/+files/linux_3.8.0-19.29.diff.gz" target="_blank">diff </a>with that in Matthew's <a href="http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=68d929862e29a8b52a7f2f2f86a0600423b093cd" target="_blank">patch</a>, it was clear that the 13.04 installation media does indeed contain the patch - it's as safe as it's presently possible to get.<br />
<br />
The other obvious thing to check was that my laptop's BIOS was up-to-date with the included SW Update application. It was.<br />
<br />
<b><span style="font-size: large;">Preparation</span></b><br />
<span style="font-size: large;"><b></b></span><br />
Frankly, there isn't much else to check. Ubuntu provides some general UEFI <a href="https://help.ubuntu.com/community/UEFI" target="_blank">installation advice</a>, but there isn't much new there.<br />
<br />
I was going to leave things moreorless as they were out of the box - UEFI enabled, SecureBoot enabled - and set up a dual-boot with Windows 8. I would leave partitioning to be handled within Ubuntu's installer (you occasionally hear of concerns regarding shrinking Win 8 partitions using Linux tools without taking additional steps before the event - I didn't think such concerns were founded). <br />
<br />
<b><span style="font-size: large;">Installation</span></b><br />
<br />
I used Startup Disk Creator on Ubuntu to create a bootable USB drive from ubuntu-13.04-desktop-amd64.iso. Then I booted it via Samsung's BIOS (entered using F2) via the "Boot Override" section in its "Exit" tab.<br />
<br />
I chose to select "download updates whilst installing" to capture any further updates at the earliest opportunity which might possibly impact the stability of the UEFI (not that I thought there were any; but, caution never hurt). This had the effect of upgrading the kernel from 3.8.0-19 to 3.8.0-23 during the installation process.<br />
<br />
Since I was essentially testing a default installation on Samsung UEFI laptops, I refrained from my usual custom partitioning and chose "Install Ubuntu alongside Windows 8", which I would imagine is the more commonplace installation choice. That also had the added benefit of saving me from accustomizing myself with the nightmare that is an OEM's Win 8 default partitioning scheme. <br />
<br />
<b><span style="font-size: large;">Post-Installation</span></b><br />
<br />
Rebooting... worked. I was presented with a GRUB boot menu. Choosing Ubuntu booted into 13.04 successfully.<br />
<ul>
<li>Graphically, Unity was working perfectly with the Intel HD4000</li>
<li>Win 8 partitions could be accessed with one click</li>
<li>Wireless was up - the network password had been remembered from when I entered it during the installation process</li>
<li>The battery meter was fine</li>
<li>Bluetooth was working</li>
<li>Suspend on lid close/restore on lid open was fine</li>
</ul>
Next up, booting back into Win 8. Choosing Windows 8 (loader) from the GRUB menu resulted in:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">error: can't find command 'drivemap'.</span><br />
<span style="font-family: "Courier New",Courier,monospace;">error: invalid EFI file path.</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace;">Press any key to continue...</span><br />
<br />
Booting to "Windows Boot Manager" via the BIOS' Boot Override menu didn't work either - it presented a Windows "your system has encountered an error" screen briefly, before rebooting. This wasn't good.<br />
<br />
I continued booting to "Windows Boot Manager" via the BIOS. On the third attempt, Win 8's <a href="http://www.techrepublic.com/blog/window-on-windows/how-the-windows-8-automatic-repair-feature-works/7335" target="_blank">Automatic Repair</a> (quite a nice feature, Microsoft - well done) kicked in and automatically started the boot repair process. No user input was required. It spent about 60 seconds "repairing", after which it rebooted.<br />
<br />
"Windows Boot Manager" via the BIOS then succeeded - Win 8 was alive again. <br />
<br />
As for the Windows 8 (loader) entry in the GRUB menu; this is just going to need some tweaking of the GRUB menuentry (some ideas can be found <a href="https://wiki.archlinux.org/index.php/GRUB2#Chainload_Microsoft_Windows_x86_64_UEFI-GPT" target="_blank">here</a>). I did get it working directly via GRUB; I'll make the changes to the grub config later on.<br />
<br />
Update:<br />
<br />
Just comment out most of the grub menuentry for Windows 8; leave the second search line (<span style="font-family: "Courier New",Courier,monospace;">search --fs-uuid --no-floppy --set=root <the_ID></span><code></code><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: inherit;"><span style="font-size: small;">) and replace the chainloader line with</span></span> chainloader (${root})/EFI/Boot/bootx64.efi. </span>Hopefully GRUB will have this remedied soon.<br />
<br />
<b><span style="font-size: large;">Conclusion</span></b><br />
<br />
It worked close to flawlessly for me.<br />
<br />
Whether that's because Samsung has fixed the issue in a BIOS update, or because of Matthew's kernel patch, or perhaps my particular laptop's firmware isn't affected, or just down to luck (and it might fail later on), I'm not sure. I certainly can't say it will work for you. All I can say is that, so far, it's worked for me.<br />
<br />
If you do fancy installing Linux on your Samsung laptop, I'd advise a path similar to the one I've documented here. It's quick, easy, and intuitive - it is basically aligned with the <a href="https://help.ubuntu.com/community/UEFI#Case_when_Ubuntu_must_be_installed_in_EFI_mode" target="_blank">default installation recommendations for 13.04 on UEFI</a>.<br />
<br />
So, the situation is looking promising. The real travesty is Samsung's continued, and continuing, blithely indifferent attitude towards Linux users. This appears to be a critical firmware bug which results in complete hardware failure. Failing to provide a fix in a timely manner, failing to provide updates to end-users, and refusing to fix machines which fail under warranty; that is not a consumer-friendly approach. Given that Samsung is now king of kings among Android mobile device manufacturers, their attitude is hard to understand, and even harder to accept.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-37461264760990563392013-04-29T22:48:00.002+01:002013-05-02T21:24:02.043+01:00Samsung Laptops Still Can't Run Linux<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigDgHHI1bvMsUIsrymcI0HKlGr5hCB_AdBUrW9AJN2zGtGiJOtOx0QNlLCS9wlmJ_Fjr3jGHN4vafGqVvK08jMT6etryAwhmeatZXJcU45du-lkfxV7VMeX345QzD0WDihtQ1XZmB9vZE/s1600/Tux_wider.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="197" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigDgHHI1bvMsUIsrymcI0HKlGr5hCB_AdBUrW9AJN2zGtGiJOtOx0QNlLCS9wlmJ_Fjr3jGHN4vafGqVvK08jMT6etryAwhmeatZXJcU45du-lkfxV7VMeX345QzD0WDihtQ1XZmB9vZE/s200/Tux_wider.jpg" width="200" /></a></div>
<br />
Those keeping themselves apprised of Linux news will be aware of a particularly nasty issue that reared its head earlier this year. It was discovered that installing Linux could end up <a href="http://www.phoronix.com/scan.php?page=news_item&px=MTI4ODQ" target="_blank">bricking some Samsung laptops</a>.<br />
<br />
Subsequently, Matthew Garrett discovered that it wasn't just Linux; <a href="http://mjg59.dreamwidth.org/22855.html" target="_blank">Windows could also brick these laptops</a> (although it seemed not to do so naturally).<br />
<br />
So it came to be understood that the problem was a bug in Samsung's UEFI firmware, and might be something akin to a buffer overflow.<br />
<br />
Linus et al were <a href="http://www.h-online.com/open/news/item/Protection-against-Samsung-UEFI-bug-merged-into-Linux-kernel-1795332.html" target="_blank">quick off the mark</a>, removing the samsung-laptop kernel driver, which seemed most capable of triggering the bug. Of course, the new kernel version takes time to work its way into the distro's installation discs, but I would imagine it exists in Ubuntu 13.04 now.<br />
<br />
Whether this change removes all possible triggers is another question. Nobody seems to know for sure. There are rumours that bricked systems may be recoverable by clearing the CMOS. But who really wants to risk it?<br />
<br />
Like many people, I have a Samsung laptop on which I intend to install Linux, and had been following developments with interest. I kept expecting a BIOS update to emerge, yet nothing appeared forthcoming.<br />
<br />
The end user community was still waiting; the <a href="https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557/" target="_blank">Launchpad bug report</a> was still open, and Ask Ubuntu's <a href="http://askubuntu.com/questions/270036/is-it-safe-to-install-ubuntu-64-bit-12-10-in-efi-mode-on-samsung-series-7-window" target="_blank">various</a> <a href="http://askubuntu.com/questions/252653/samsung-uefi-brick" target="_blank">questions</a> were still open issues.<br />
<br />
So, last month, having waited quite some time already, I sent Samsung support an email requesting a status update. Their response noted:<br />
<br />
<blockquote class="tr_bq">
<i>A BIOS update has been released for most systems that are effected by
this problem. To see if there is a BIOS update this can be checked
automatically by a program called SW Updater available on the support
page (link below):
</i>
<i><br />http://www.samsung.com/uk/support/model/NP350V5C-A0EUK-downloads?downloadName=FM </i></blockquote>
<br />
At that time (25th March), there was no BIOS update available, but a couple of weeks later BIOS update P08ABE became available in SW updater.<br />
<br />
There was no description and no changelog. Furthermore, there was no information available about it anywhere online. Was this the update allured to in Samsung support's email?<br />
<br />
I upgraded anyway, but without any confirmation that this fixed the problem, I turned to support a second time, requesting some more information on P08ABE. Their response was courteously worded, but wasn't what many of us was hoping to hear:<br />
<blockquote class="tr_bq">
<i>I am sorry that this information is not more readily available. I understand this is frustrating if you have been waiting to add Linux to<br />your machine.</i><br />
<br />
<i>Technical Support are only here for hardware faults and as such we only have access to the same information as that which is released to the public. As such I have no further information for you at this time.</i><br />
<i><br />I have approached Samsung regarding the issues surrounding the loading of Linux and the official response received was that we do not support the operating system. </i><br />
<br />
<i>As such I am unable to help with the matter and can only advise that any problem caused by changes to the OEM operating system will not be repaired under warranty.<br /> </i><br />
<i>If there is anything else we can help with, please let us know.</i></blockquote>
I do appreciate support's frankness; when you're the bearer of bad news, it's often easier to try to gloss over things than it is to lay out the facts clearly and plainly.<br />
<br />
To summarise:<br />
<ul>
<li>No update for the public as of yet, and no timeframe at present</li>
<li>It's not yet known whether BIOS update P08ABE fixes the UEFI issue</li>
<li>Any problems caused by their serious firmware bug under Linux "<i>will not be repaired under warranty</i>" (although I'm not certain that's in keeping with their warranty policy)</li>
</ul>
Frankly, I did expect more from Samsung; I expected dev & test prioritisation, an unprompted flow of information to end users with an indication of a timescale, and an immediate acceptance that any firmware bugs would be covered by the warranty.<br />
<br />
However, at this stage, things are still in flux; we'll have to wait to see where the pieces come to rest. The hope is just that they do so sooner rather than later.<br />
<br />
<b>Update:</b> The support contact I'm in dialogue with (a most friendly and amiable chap) has offered to look into the P08ABE BIOS update. Hopefully I'll have some more information soon. I suspect that P08ABE won't be the fix we're waiting for, but it will be nice to have that clarity.<br />
<br />
<b>Update 2:</b> Support has informed me that they are unable to provide any information about P08ABE.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-24921322012958490792013-03-03T00:05:00.000+00:002013-03-03T00:18:39.001+00:00Truecrypt under FreeBSDTruecrypt does work under FreeBSD, but it's not always as smooth an experience as on Linux.<br />
<br />
A common problem is receiving an "Operation not permitted" error when trying to mount your volume. In my case, has almost always been attributable to an unclean filesystem.<br />
<br />
1. How to get access to your data.<br />
<br />
Mount the volume with read-only disabled, and with do-not-mount enabled. This gives you a decrypted virtual device under /dev. You can obtain the device path with:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># truecrypt -l</span><br />
<br />
You're now in a position to run a fsck:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># fsck -t <span style="color: #0b5394;"><filesystem></span> /dev/<span style="color: #0b5394;"><device></span> </span><br />
<br />
NB: If you can't remember the filesystem type, you may find<span style="font-family: "Courier New",Courier,monospace;"> testdisk</span>'s Analyze mode useful.<br />
<br />
Assuming that the fsck completes successfully (probably returning <span style="font-family: "Courier New",Courier,monospace;">***** FILE SYSTEM MARKED CLEAN *****</span>) you can remount normally:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># mount -t <span style="color: #0b5394;"><filesystem></span> -w /dev/<span style="color: #0b5394;"><device></span> /mnt</span><br />
<br />
2. How to prevent it reoccurring.<br />
<br />
Follow these three steps: <br />
<ul>
<li>Always unmount before rebooting/removing the media. </li>
<li>Ensure all unmounts are successful (e.g., they shouldn't fail with "Device busy").</li>
<li>If you have Gamin running, then use a mountpoint under /media or /mnt</li>
</ul>
The third point is important. gam_server has a tendency to set up a large number of directory and file watches with nautilus. If you're stuck with umount returning the "Device busy" error, check what's preventing umount:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># lsof +D </span><span style="font-family: "Courier New",Courier,monospace;"><span style="color: #0b5394;"><mountpoint></span></span><br />
<span style="font-family: "Courier New",Courier,monospace;">COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME</span><br />
<span style="font-family: "Courier New",Courier,monospace;">gam_serve 33424 ace 48r VDIR 0,176 1024 2 /export/d1</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;">gam_serve 33424 ace 49r VDIR 0,176 512 3 /</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;">export/d1</span>/.snap</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;">gam_serve 33424 ace 50r VDIR 0,176 512 </span></span></span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;">62507008 /</span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;">export/d1</span>/2011</span></span> </span> </span><br />
<br />
In such a case, Killing gam_server (Gamin) should work. The problem with this is that Gamin is restarted instantly once killed. And Gamin doesn't appear, at a glance, to be awfully configurable in terms of directory exclusions and suchlike.<br />
<br />
Your best bet is to try to get a umount in just after killing the process:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># kill 33424 && umount <span style="color: #0b5394;"><mountpoint></span></span><br />
<br />
That rarely works, since Gamin is restarted so quickly. But sometimes you can just beat it and get your umount in. Running a simple script, something like this (note that this hack only handles one PID), should manage to umount eventually. It's always worked in my case. It may take some time though - be prepared to let it run for a half hour or so before giving up.<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># false || while [[ $? -ne 0 ]] ; do kill -9 $(lsof +D <span style="color: #0b5394;"><mountpoint></span> 2>/dev/null | grep gam_serv | awk '{ print $2 }' | uniq) && umount <span style="color: #0b5394;"><mountpoint></span>; done</span><br />
<br />
So the moral of the story is, if you're running Gamin, mount to a mountpoint which is under one of Gamin's preconfigured exclude directories. And as far as I'm aware (without checking the source code), the only two preconfigured exclude directories are /media and /mnt.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-78960336334389888462013-02-23T20:45:00.003+00:002013-02-23T20:52:18.760+00:00The Best Mind Mapping Software on LinuxI generally dislike 'best of' posts, since it's rarely the case that the author has properly analyzed every alternative, or that a 'best' option can be determined objectively. <br />
<br />
It's hard to argue that this is an exception. I haven't even tried any of the Linux mind-mapping alternatives; I have no desire to now. I just ask you to <a href="http://www.xmind.net/download/linux/" target="_blank">try this application</a>. Try it. You'll see what I mean. It is just... superb. It is XMind.<br />
<br />
XMind is clearly heavily based on the Eclipse codebase (I will forever be grateful to the Eclipse Foundation for the supremely liberal Eclipse license). As such, the GUI is highly customisable to a degree that would satisfy even the most hardcore KDE advocate.<br />
<br />
In true Eclipse style, there is an outline pane, a properties pane, and the usual comprehensive key mapping configuration.<br />
<br />
The maps produced with the default settings are indisputably aesthetically pleasing. Unfortunately, the "markers" (clipart graphics for use in maps) included with the software aren't quite to my taste, but are perfectly adequate nonetheless. <br />
<br />
The real benefit comes when you really start using the software properly. You'll find that everything 'just works' in an intuitive manner. Dragging a subtopic away from a central topic 'breaks' the link and converts it into a floating topic. Add graphics to anything; attach files to anything. Need to break a subtopic out into more detail? Just hyperlink it to another sheet (or separate mindmap file, or anything else).<br />
<br />
Provide easy navigation between associated maps with hyperlinked 'floating topics'. Add custom graphics to the marker list (native is 32px and PNG is supported. You can find some to import in the <a href="http://openiconlibrary.sourceforge.net/gallery2/" target="_blank">Open Icon Library</a>). Import/export options are good, including support for other mind mapping software formats; so you can work with the output of popular Android applications, for example.<br />
<br />
The base application is FOSS; dual-licensed with EPL and LGPL. However, a few of the lesser-used and more advanced pieces of functionality are both highly expensive and proprietary. This mightn't be enough to satisfy staunch FSF supporters, but I see it as a perfectly reasonable trade-off that has resulted in a very high quality application. I'd be interested to hear your thoughts.<br />
<br />
For my personal mind-mapping requirements on the desktop, the free version of XMind is what I'll be using for the foreseeable future.<br />
<br />
In case this post is irreparably tarnishing my reputation in the FOSS world, let me reassure you; for my wider diagramming needs, I do, of course, exclusively use <a href="http://projects.gnome.org/dia/" target="_blank">Dia</a>!Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-15954507304881918142013-01-13T07:20:00.001+00:002013-05-14T01:07:44.179+01:00Quickly on Ubuntu: Making it Quicker with PyDevI was pleased to see that the team at Canonical have been <a href="http://developer.ubuntu.com/" target="_blank">making some progress</a> with their application development documentation and the Unity API<b>. </b><br />
<br />
There's clearly strong emphasis on helping beginners to programming get their hands dirty and hack some code. I think it's great to see - this is what *nix is all about.<br />
<br />
Looking over things, the <a href="http://developer.ubuntu.com/get-started/quickly-workflow/" target="_blank">toolstack</a> they're recommending contained no major surprises. Python is a popular scripting language with a solid range of libraries, which is nice and easy for beginners to pick up. And Canonical's made a tool called <a href="http://developer.ubuntu.com/get-started/" target="_blank">Quickly</a> to help budding devs hit the ground running, by creating some of the tedious boilerplate around persisting preferences, creating key GUI windows, logging, etc. Quickly also handles some of the packaging, and can upload to a PPA.<br />
<br />
I thought it would be fun to give the stack a test run.<br />
<br />
But, alas, I had somehow missed one of the items on that toolstack page. I must have <i>seen it</i>, I suppose... I must have mentally filtered it out. Because it didn't seem possible. But when you type <span style="font-family: "Courier New",Courier,monospace;">quickly edit</span> to bring up the code, there it is, in the digital flesh.<br />
<br />
The IDE Canonical is pushing, is... Gedit.<br />
<br />
<b>They can't be serious</b><br />
<br />
But they are. The biggest argument I have with Canonical over their default toolstack is unquestionably the decision to set <span style="font-family: "Courier New",Courier,monospace;">gedit</span> as the editor. It's just a basic text editor. For any primitive GUI-based text editing needs I have, I generally use Leafpad or Gvim, which can get the job done quicker.<br />
<br />
Gedit's biggest features are - get ready for them - tabs, syntax highlighting, find & replace (just about...), and plugins (of which there are some of note, but alas, too few). This may be enough to give Microsoft's good ol' Notepad application a good run for its money, but it falls short of what is expected in the 21st century for application development.<br />
<br />
Come on Canonical. You must be jesting, right?<br />
<br />
<b>An Ode to Power</b><br />
<br />
I'd personally be vastly more productive in vim than gedit, as would many experienced users. But the user base targeted by Quickly is unlikely to want to delve too deeply into <a href="http://www.vim.org/scripts/script.php?script_id=1658" target="_blank">NERD tree</a>, especially after grappling with one of the first textual mode-based interfaces they'll have seen in a while! Let's face it; on the Windows side, Notepad++ is so vastly superior to gedit that it almost doesn't bear comparison, and yet few Windows devs would deign to use that as an IDE. <br />
<br />
To make matters worse, <span style="font-family: "Courier New",Courier,monospace;">quickly edit</span> starts off by opening all the files in your project dir simultaneously. It doesn't take much coding before this becomes totally unwieldy. <br />
<br />
I stuck it out for a while, but I had to find something better. After trying numerous Python IDEs in the repos and finding each to come up short in one way or another, I came across PyDev - Python support for Eclipse.<br />
<br />
<b>Preparing PyDev</b><br />
<br />
+ Install Eclipse (I tend to grab the latest from <a href="http://www.eclipse.org/downloads/" target="_blank">Eclipse directly</a>, since the repo copy is typically out-of-date, and it comes with its own updating functionality anyway).<br />
+ Add PyDev's update site <a class="external-link" href="http://pydev.org/updates" rel="nofollow">http://pydev.org/updates</a> to Eclipse (Help -> Install New Software -> Add)<br />
+ Install PyDev<br />
<br />
<b>A Few Prerequisites </b><br />
<br />
It took me a good hour to get my project working properly with PyDev, so let me try to save you some of the hassle. <br />
<br />
1. Create a new project (PyDev -> PyDev Project)<br />
2. Provide the correct project name (with the same spelling and capitalization as your source dir. If you change anything about it, you may run into difficulty having it locate your source files)<br />
3. Configure your interpreter (autoconfigure should work ok)<br />
4. Allow it to create your project. If your source files don't appear, go back to step 2 and check that project name and path carefully.<br />
5. Go to project properties-> PyDev - PYTHONPATH -> External Libraries, and add the <projectname>_lib source folder<br />
6. Window -> Preferences -> PyDev -> Interpreter - Python<br />
a) Under Libraries, add the <projectname>_lib folder<br />
b) Under Libraries, add the <projectname> folder<br />
c) Under Libraries, add the <projectname>'s parent folder<br />
<br />
So, e.g. if your project is called foobar, you might have the following: /path/to/foobar/foorbar_lib, /path/to/foobar/foobar, /path/to/foobar. Without this seemingly excessive arrangement, PyDev won't be able to locate the nested imports under <projectname>_lib.__init__.py, and you'll see <i>unreferenced import</i> errors for the <projectname>_lib imports.<br />
<br />
7. Go to the next tab - <a href="http://pydev.org/manual_101_interpreter.html" target="_blank">Forced Builtins</a>. <br />
a) Add "gi". This is required for PyDev to resolve the dynamically created references to the various GTK3 imports under gi.repository.XXX, such as Gtk, Gdk, GObject and Gio. If you look at /usr/lib/python2.7/dist-packages/gi/repository/__init__.py, you'll see what I'm talking about.<br />
b) Add "<projectname>". This is required for PyDev to resolve imports internal to your project. Otherwise, you're likely to see "<span style="font-family: "Courier New",Courier,monospace;">from <projectname> import <projectname>Window</span>" give an <i>Unresolved import</i> error.<br />
c) Click Apply for PyDev to resolve those gi.repository imports.<br />
<br />
You should be set up.<br />
<br />
<b>A Stack of Improvements, Fit for a Toolstack</b> <br />
<br />
Now you have:<br />
<br />
+ inline errors and warnings <br />
+ auto-build<br />
+ auto-indentation <br />
+ true auto-complete (not just random-word-from-the-same-file suggestion)<br />
+ code formatting & import cleanup<br />
+ refactoring capabilities <br />
+ clickthrough to source<br />
+ testing framework<br />
+ a python console<br />
+ a file browser<br />
<br />
and all the other niceties of Eclipse. Isn't that better?<br />
<br />
Oh, yes... amidst all that, I forgot to mention. It also has tabs, syntax highlighting, find/replace and plugins. What a relief<b>!</b><br />
<br />
Now the toolstack consists of:<br />
<br />
+ Quickly - for boilerplate code to help get new projects started quickly, along with easy integration with Ubuntu's PPAs<br />
+ Glade - for the UI design<br />
+ Eclipse with PyDev - for coding<br />
<br />
This is a much more acceptable configuration in my eyes.<br />
<br />
I know Canonical is trying to keep it simple for those new to development, but I'm unconvinced that gedit alone is the solution. It can be quite hard to write <i>clean</i> code <i>quickly</i> without at least some of the functionality of an IDE.<br />
<br />
To give an example: when I imported the code I'd written in gedit into Eclipse, up popped a raft of warnings for unnecessary import declarations scattered throughout my classes. This might just be an example of my sheer incompetence, but I suspect I'm not the only one who refactors some classes, and omits to remove all the affected imports.<br />
<br />
I think, at the very least, the Quickly workflow needs a more featureful default editor, and some mention of the procedure to migrate to an IDE, such as Eclipse with PyDev, or even Vim. <br />
<br />
But, credit where credit's due... it does at least support easily switching to Vim, given that <span style="font-family: "Courier New",Courier,monospace;">quickly edit</span> respects the EDITOR and QUICKLY_EDITOR environment variables. That is one saving grace at least.<br />
<br />
</rant><p>Happy hacking!</p><br />
<br />
<b>Troubleshooting - Run/Debug doesn't work in PyDev</b><br />
<br />
Initially, you'll probably only see the following in the Eclipse Console:<br />
<br />
<span style="color: red;"><span style="font-family: "Courier New",Courier,monospace;">pydev debugger: starting<br />/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed<br /> import gobject._gobject</span></span><br />
<br />
This is easy to fix. Quickly invokes the main method explicitly from bin/<projectname> with:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">import <projectname></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><projectname>.main()</span><br />
<br />
Similarly, PyDev needs an invocation of main() - otherwise it's not going to do very much. Open __init__.py in your project and add this at the very end:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">if name == "__main__": </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> main()</span><br />
<br />
Now when you run/debug it, it should show signs of life before dying with the schema error (see below for background on it). This too is easy to fix - open the run or debug configuration window, and switch to the Environment tab. Add an XDG_DATA_DIRS variable with the value:<br />
<br />
/path/to/<projectname>/data:/usr/share<br />
<br />
For example, if the root of your project is at /home/bob/src/myproj, the value would be:<br />
<br />
/home/bob/src/myproj/data:/usr/share<br />
<br />
<b>Troubleshooting - Settings schema not installed</b><br />
<br />
You see the following error when running <span style="font-family: "Courier New",Courier,monospace;">quickly debug</span>, or <span style="font-family: "Courier New",Courier,monospace;">python bin/<projectname></span>, etc:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">GLib-GIO-ERROR **: Settings schema XXX is not installed.</span><br />
<br />
I <a href="http://askubuntu.com/a/239244/113457" target="_blank">posted a solution</a> to this on AU; in short, set <span style="font-family: "Courier New",Courier,monospace;">XDG_DATA_DIRS=$XDG_DATA_DIRS:data</span>, assuming you're in your project's root dir. For example:<br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace;">cd myproj</span><br />
<span style="font-family: "Courier New",Courier,monospace;">XDG_DATA_DIRS=$XDG_DATA_DIRS:data python bin/<projectname></span><br />
<br />
Note that you have to have used <span style="font-family: "Courier New",Courier,monospace;">quickly run</span> to generate the compiled pyc files, and the bin/<projectname> script, before you can do this!<br />
<br />
<b>Troubleshooting - Glade unable to configure label text for GtkComboButton</b><br />
<b><br /></b>
There are a couple such bugs in Glade, which I <i>believe</i> to be fixed already. The corresponding version may already be in the proposed repos, although I can't remember where I saw this.<br />
<br />
These are easy to work around by opening Glade's XML definition at data/ui/<projectname>Window.ui and removing/modifying the extraneous "checkbutton" text. Save your Glade work first, then open the XML file and make the necessary changes, and finally restart Glade.<br />
<br />
<b>Troubleshooting - Python memory leaks</b><br />
<b><br /></b>
I have a cairo DrawingArea which I'm using to display an updating line graph. When I left my app running overnight, I found that Rss (resident pages) had shot through the roof. A great tool to track down memory leaks in Python is <a href="http://guppy-pe.sourceforge.net/#Heapy" target="_blank">heapy</a>. It's not the most intuitive tool around, but it's not awfully difficult to use either.<br />
<br />
For a start, edit __init__.py in your project, and:<br />
<br />
+ add <span style="font-family: "Courier New",Courier,monospace;">import signal</span><br />
+ add <span style="font-family: "Courier New",Courier,monospace;">signal.signal(signal.SIGQUIT, start_pdb)</span> to the main method, before the call to <span style="font-family: "Courier New",Courier,monospace;">Gtk.main()</span><br />
+ add the method declaration:<br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace;">def start_pdb(signal, trace):<br /> import pdb<br /> pdb.set_trace()</span><br />
<br />
Start your application directly with <span style="font-family: "Courier New",Courier,monospace;">python</span> instead of <span style="font-family: "Courier New",Courier,monospace;">quickly</span>, as described earlier in this ridiculously long post. Then, from another terminal, send it the QUIT signal to drop to a debugging prompt<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">kill -QUIT $(ps aux | grep python | grep <projectname> | awk '{ print $2 }') </span><br />
<br />
From there, you can proceed to <a href="http://www.smira.ru/wp-content/uploads/2011/08/heapy.html" target="_blank">analyse the Python heap with heapy</a>. <br />
<br />
It was immediately apparent from heapy that my problem didn't lie in the Python heap. The Python heap was occupying just 18MB out of a total residency of over 1GB.<br />
<br />
Remember that Python sits atop C. So we have actually got 2 heaps here: the C heap, and the Python heap. <br />
<br />
To inspect the C heap, I fired up the old favourite <span style="font-family: "Courier New",Courier,monospace;">valgrind</span>. Whilst it didn't provide conclusive proof, it seemed to indicate that whilst the GTK3 libs weren't 100% watertight, the big problem was actually with pangocairo - the font library I'm using to draw nice, smooth, legible text.<br />
<br />
After I dramatically reduced the frequency of invoking key pangocairo methods, memory utilisation stabilised over prolonged periods. If I get time, I'll try to confirm the problem is indeed in pangocairo, and track where it's leaking. (Note that pangocairo is a very useful library, and I don't want to discourage you from using it by any means - just keep one eye on the system resources!)Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-37678494360426024302012-12-08T13:41:00.001+00:002013-08-08T00:10:44.219+01:00Pink 650D RAW images under Ubuntu<div style="text-align: right;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGDF6TBKHXJEPhawx8eyfPlx1RnDqekl99ITCg8hWhU6FLuaMuH6I5dQo_BamxAesiBm7PTF57R6bVwxlq3TWAFuG1jeqdLVNXSUSY33Yck9ZSVoiTw6j27uob4Qe4d1mj0xVWhG0RM4Q/s1600/IMG_1298.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGDF6TBKHXJEPhawx8eyfPlx1RnDqekl99ITCg8hWhU6FLuaMuH6I5dQo_BamxAesiBm7PTF57R6bVwxlq3TWAFuG1jeqdLVNXSUSY33Yck9ZSVoiTw6j27uob4Qe4d1mj0xVWhG0RM4Q/s200/IMG_1298.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Underwater photos are usually blue</td></tr>
</tbody></table>
<br />
The versions of libraw and dcraw currently in the Ubuntu repos have a slight problem. When accessing RAW files from Canon's latest 650D, they display them entirely in pink - which probably isn't what you want.<br />
<br />
The problem is simple enough: the versions of <a href="http://www.cybercom.net/~dcoffin/dcraw/" target="_blank">dcraw</a>/<a href="http://www.libraw.org/download" target="_blank">libraw</a> used by all the RAW processing apps in Ubuntu 12.10 (aside from <span style="font-family: "Courier New",Courier,monospace;">eog</span> - so Shotwell, UFRaw, RawTherapee, etc.) don't have the 650D listed yet, so the ICC profiles aren't getting properly interpreted.<br />
<br />
One solution is to rebuild your applications, <a href="http://yorba.org/shotwell/install" target="_blank">such as Shotwell</a>, with the appropriate versions of the underlying raw libraries. That can be a pain, so I took the easier option, and opted to convert the images to JPEG first, thereby circumventing the issue.<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">sudo apt-get install libjasper-dev libjpeg-dev liblcms1-dev graphicsmagick</span><br />
<span style="font-family: "Courier New",Courier,monospace;">wget http://www.cybercom.net/~dcoffin/dcraw/dcraw.c</span><br />
<span style="font-family: "Courier New",Courier,monospace;">gcc -o dcraw -O4 dcraw.c -lm -ljasper -ljpeg -llcms</span><br />
<span style="font-family: "Courier New",Courier,monospace;">sudo mv dcraw /usr/local/bin/dcraw</span><br />
<span style="font-family: "Courier New",Courier,monospace;">echo alias rawtojpg="\"find . -name '*.CR2' -print0 | xargs -0 -n 1 -P 8 -iIMG gm convert IMG -format jpg IMG.jpg\"" >> ~/.bashrc</span><br />
<span style="font-family: "Courier New",Courier,monospace;">source ~/.bashrc</span><br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoAJAvR_ClBdLA9d7QLWUEKCxiJ3_VHWCGoM-Q2RthO3ace3M1mPxdWhS3ieJqGZixlMutsvj3DPyRb4nR3hbb_DQcJsDkisZvGmDAM3QX9uH3zwrPpWspahQPVK9_KpfUovWZ80Ypq4M/s1600/IMG_1298_corrected.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoAJAvR_ClBdLA9d7QLWUEKCxiJ3_VHWCGoM-Q2RthO3ace3M1mPxdWhS3ieJqGZixlMutsvj3DPyRb4nR3hbb_DQcJsDkisZvGmDAM3QX9uH3zwrPpWspahQPVK9_KpfUovWZ80Ypq4M/s200/IMG_1298_corrected.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">At least it's better than pink</td></tr>
</tbody></table>
Thereafter, you should be able to use the primitive alias <span style="font-family: "Courier New",Courier,monospace;">rawtojpg</span> to convert all .CR2 files in the current directory to JPEGs (leaving the original CR2 files as-is). Note the -P 8 flag, which runs 8 conversion threads in parallel - adjust as appropriate. You can obviously change the alias to a proper function which takes some args too, but the above was sufficient for my purposes.<br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoBJcLWF75paElyU4JrLfW1Idn-LaGdZ17WZdHPu0pc1yr-yIBbbWFtiA7EfHQCwK1kK1sUSku32AEwQymuHMdkHDgzZDj47jYkYe3PeQo54hNk_Cw8EXqg4LZxOjX9tvk3UFgblxaa44/s1600/gimp-dcraw.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="198" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoBJcLWF75paElyU4JrLfW1Idn-LaGdZ17WZdHPu0pc1yr-yIBbbWFtiA7EfHQCwK1kK1sUSku32AEwQymuHMdkHDgzZDj47jYkYe3PeQo54hNk_Cw8EXqg4LZxOjX9tvk3UFgblxaa44/s200/gimp-dcraw.png" width="200" /></a><br />
<b>Update, 8th August 2013</b><br />
<br />
See my comment below for a complete solution to this problem.<br />
<br />
Assuming you've already followed the preceding instructions in this post, all you need to do is install gimp-dcraw; then you'll be able to open your 650D CR2s with GIMP:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">sudo apt-get install gimp-dcraw </span><br />
<br />Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-41971546552516820332012-12-08T01:51:00.000+00:002012-12-08T01:55:50.416+00:00Has the Apple bubble burst?This week, the Apple share price tanked. In one day alone, it lost market capitalization of some 35bn USD.<br />
<br />
Apple Inc. hit its all-time peak in September after stunning growth in the 1st quarter of 2012. Since then, it's just been sliding back downhill (barring a brief reversal in the last half of November, which has just been wiped off the board this week).<br />
<br />
I'll leave the detailed analysis for others, but there are a few drivers from the tech side that seem worthy of comment.<br />
<ul>
<li><b>The top of the hill:</b> With such a large percentage of mobile phone and tablet sales, and with an ever increasing number & quality of players in the market, it's hard to see how they could make significantly greater inroads here. It's now more about maintaining customers than onboarding new ones. What Apple needed was a new market; a new product, and I don't see one on their horizon at present.</li>
<li><b>Litigation:</b> Apple has been suing companies left, right and centre. These cases haven't been to uphold moral principles, or to protect complex designs from illegal duplication; they've simply been attempts at money-grabbing (from the largest US corporate by capitalization). Now the victims have started to fight back against their attacker, turning Apple's insatiable greed into unappetizing risk. Meanwhile, end users stuck in the middle are increasingly becoming disillusioned with Apple's aggressive tactics, and seeking alternative companies to support.</li>
<li><b>Google Maps:</b> If you're going to sue them, you'd better not be reliant on their services. By ditching Google Maps and running with their homegrown solution, Apple removed one risk from its risk register, but in doing so created a certainty: an immature product. No matter how much Apple may improve Siri, or how much polish they put on the icon set, it isn't going to make up for taking away from users what they already had.</li>
<li><b>Gradual improvement:</b> This sounds good; it's what we often see with each iteration of the Linux kernel: a number of small improvements, which may or may not impact users much, depending on their individual interests. The problem in terms of commercializing it is that few people need or want to upgrade for each and every small set of improvements. Yet, since Apple has reached near-saturation in the western markets, it is reliant on users upgrading frequently. It either has to persuade users that they <i>really do </i>need those extra pixels on the screen, or it has to continually innovate. This is where they've slowed down, and understandably so. How much more can and should be packed into devices in everybody's pockets?</li>
<li><b>Competition: </b>Apple led the way with the all-round quality of their first music players, smartphones and tablets. Competition existed, but it was either inferior or small-scale. Now, that simply isn't the case: competitors have caught up, and in some instances actually surpassed Apple. For example, when asked, I presently recommend the S3 for smartphones, and the Galaxy Tab for tablets. Again, it comes back to a lack of innovation on Apple's behalf. The phrase "sitting on one's laurels" comes to mind.</li>
<li><b>Remember from whence you came:</b> Before Apple's runaway success with the iPod and its succeeding foray into small form factor mobile devices, it was best known as a niche hardware/software provider. Its primary market was for digital design artists across audio and visual spaces. This was back in 2001. Roll forward eleven years to 2012, and the PC space has remained largely similar; Apple hasn't made any major inroads into mainstream computing (it has gained market share, as some buyers of Apple mobile devices buy into the Apple ecosystem, but the overall impact to the global PC market share is small - we're talking a few percentage points change). Without the success of the mobile device space, Apple is just a comparatively small, niche hardware/software provider. It is reliant on the mobile space's - and iOS's - continued growth. If, for example, desktop OSs were to become popular on mobile (Ubuntu with Unity springs to mind), would there still be room for iOS?</li>
</ul>
Does Apple still have some cards hidden up its sleeve, or is it floundering precariously on the proverbial ledge, mourning the loss of direction from its most inspirational and charismatic late leader?Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-56490177407268662072012-11-08T00:40:00.000+00:002012-11-08T00:52:25.782+00:00Linux Steam beta emerges It's been an important day for the Linux community at large as Valve's first limited external beta of Steam is released.<br />
<br />
Much to my disappointment, I didn't make the first cut for beta testing. The odds weren't great - 60,000 people vying for just 1,000 places - and with just a primitive entry form to go by, selection of candidates must have been nigh on impossible. For what it's worth, I expect expansion of the programme will be relatively swift. <br />
<br />
That aside, I did manage to get a copy of the beta anyway. Installation was obviously elementary, as one expects with superior package management systems. The Steam client itself runs smoothly (again, as one would expect), and looks very similar to Steam running under WINE. Sync with existing Steam accounts, push notifications, downloads, library, steam URIs - it all just works.<br />
<br />
Running the beta outside of the official beta program seems to pose a problem in terms of downloading Steam beta's poster child, TF2, through the client. Other purchased titles aren't a problem however.<br />
<br />
Some people have been impressively quick off-the-bat. <i>directhex</i> has composed an early attempt at a <a href="http://www.reddit.com/r/linux_gaming/comments/12qs6z/steam_for_linux_its_here_deb_in_the_link/" target="_blank">game compatibility list</a>, to which the addition of more testing experiences is clearly welcomed.<br />
<br />
To get my own testing ball rolling, I went ahead and purchased Amnesia: The Dark Descent.<br />
<br />
I'm unable to "get into the game" as of yet, since the inevitable resolution switch is proving <i>rather</i> messy (to say the least) on my multi-monitor setup with Catalyst 12.11 beta drivers & 12.10/Cinnamon. It's going to take a little work before I get things running acceptably - and that I'll have to leave for another day.<br />
<br />
From first impressions - it certainly starts quickly, and seems likely that it'll run smoothly once I've ironed out my resolution wrinkles.<br />
<br />
So far, things look rosy. More to come.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-26239147932487913202012-10-28T13:42:00.000+00:002012-10-28T13:53:52.666+00:00Signup for Linux Steam beta is live!<br />
Valve sidestepped me! There I was, diligently checking their <a href="http://blogs.valvesoftware.com/linux/" target="_blank">Linux blog</a> on an intraday basis, but no further details of the beta had been posted.<br />
<br />
It's lucky I'm a regular <a href="http://www.phoronix.com/" target="_blank">Phoronix</a> reader, as Michael <a href="http://www.phoronix.com/scan.php?page=news_item&px=MTIxNTk" target="_blank">posted a link</a> to the <a href="http://www.valvesoftware.com/linuxsurvey.php" target="_blank">signup page</a> on Friday.<br />
<br />
Instead of their blog, Valve sneakily announced the signup on their <a href="http://steamcommunity.com/games/221410" target="_blank">Linux beta community group</a> (worth subscribing to if you haven't already). From the number of members at present - almost 10,000 - it looks like competition for the beta will be fierce.<br />
<br />
Anyway, here we go... get your beta testing hats on!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMX84RxA7BpxQTGo-tUZruCxmUaSdBssrRCDXqZGirFdcp02ERwW9WLxGK0ZuEJFmUNoKFPbAHepXoygLNqqwfR7hXnlOfM55ya6Vhd542_o2EFVHLYvlbbjTqOZux7nu42X2QdcyJCp4/s1600/SteamBeta.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMX84RxA7BpxQTGo-tUZruCxmUaSdBssrRCDXqZGirFdcp02ERwW9WLxGK0ZuEJFmUNoKFPbAHepXoygLNqqwfR7hXnlOfM55ya6Vhd542_o2EFVHLYvlbbjTqOZux7nu42X2QdcyJCp4/s400/SteamBeta.png" width="400" /></a></div>
<br />
<span style="font-size: x-small;">To reiterate, this beta is intended for seasoned Linux users who aren't strangers to filing and fixing bugs. Please hold on for the stable release if you just want to enjoy the fruits of Valve's labour.</span>Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-43363982356102241632012-10-18T22:09:00.003+01:002012-10-18T22:09:38.245+01:00Xen VGA Passthrough: Have Your SayAs regular readers will know by now, I've been struggling with VGA passthrough for some time. And if the blog stats are anything to go by, I am far from alone.<br />
<br />
Are you still struggling with passthrough? If so, you may as well <a href="http://xenorg.uservoice.com/forums/172169-xen-development/suggestions/3094277-vga-gpu-passthru-support-for-amd-nvidia-gpus" target="_blank">let the Xen devs know</a> via their poll on Uservoice.com. While you're there, take a look over the <a href="http://xenorg.uservoice.com/forums/172169-xen-development" target="_blank">many other suggestions</a> and vote for what you require.<br />
<br />
The Xen development team have done a great job this year in interacting with their user base. First their request for comments around security vulnerability disclosure procedure, and now a fully open user poll on which aspects development should focus on.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-87716913861345262182012-10-16T01:24:00.002+01:002012-10-16T01:26:21.336+01:00Out with KDE, in with CinnamonI've been using KDE for the past couple of months. I've really enjoyed the experience; it certainly has a lot going for it. It's the oldest (widely used) Linux desktop environment, and it shows. KDE boasts an impressive featureset, polished animations, a consistent look and feel, well considered default settings, excellent customisability, and plenty more to boot.<br />
<br />
Everything "just works"; Dolphin remembers which tabs you had open in your previous session. Panels can be customised per-screen. Window behaviour per application. Just what can't KDE do?<br />
<br />
Yet; I've had enough, and thrown in the towel. There were just one too many bugs.<br />
<br />
The biggest problem was the notifications widget refusing to behave itself at all. Then there was the multiple-row panel debacle (I think the icon scaling algorithm needs some TLC). There's a frustrating WM bug which you can catch when dragging a window entry from a panel, which leaves the cursor in a seemingly unrecoverable state. The list goes on.<br />
<br />
There's also an eminently frustrating video overlay problem I'm battling with, which may or may not be KDE related, and an apparent Xorg heap leak - again, most likely unrelated, but to be sure I need to rule it out. <br />
<br />
So, my KDE experiment comes to a close. I will be back; I've discovered I rather like the KDE world, but for the time being I'm off searching for my next DE. Struggling with options, I find myself trying out Cinnamon, the desktop from Mint (which happens to be available in the Fedora repos).<br />
<br />
First impressions? It's sleek; relatively minimalist. Similar to Gnome 2 in style (as was its intention), yet still flaunting some of that Gnome Shell glitz and glamour. <br />
<br />
It looks quite nice. Win-key opens the main menu and sets focus to the search bar, which is a nice touch. The Gnome 2 window list brings with it a sense of nostalgia, and reminds one of home; or a loyal dog lazing beside an open fire; a grandmother peacefully knitting a tapestry in her rocking chair; but I digress.<br />
<br />
Notifications are well handled, menus carry a <i>reasonable</i> (albeit limited) selection of popular options, the main menu is acceptable. Quite nice in fact (it's growing on me).<br />
<br />
As one might expect for a relative newcomer, settings and configuration options are a little light on the ground. The basics are covered, but one must remember that this is no KDE; it's been built with a similar vision to Gnome and Unity: to provide simplicity above all else.<br />
<br />
Yet you can see that the devs have tried to go that extra mile without compromising on their underlying vision. It's things like the "Effects" settings menu, enabling configuration of the visual window effects; much more configurable than most, but still eminently usable, hiding all the complexities we may remember from the likes of CCSM.<br />
<br />
It still feels like a work in progress to some extent. Why don't I get a menu when I right click on the desktop? Why are the settings quite so barren? Where are the additional themes by default? Where is the option to move the panel to a different monitor? Yet it's pleasant; simple; bashful; Gnome 2-esque.<br />
<br />
All in all, a friendly and usable DE from the team at Mint. I'll keep it for the time being, until the next bandwagon rides by.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-26527129800340555922012-10-16T00:23:00.001+01:002012-10-16T00:23:17.830+01:00Fedora: Unknown user 'jetty'A minor irritation during Fedora startup cropped up recently - a failure in systemd-tmpfiles-setup.service.<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">[/etc/tmpfiles.d/jetty.conf:1] Unknown user 'jetty'.</span><br />
<br />
It's caused by a bug in the post install script for jetty, documented in bug <a href="https://bugzilla.redhat.com/show_bug.cgi?id=857708" target="_blank">857708</a>. Either reinstall Jetty; or, if you installed it using the default settings & would rather take the quicker route, just finish things off yourself:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># groupadd -r -g 110 jetty</span><br />
<span style="font-family: "Courier New",Courier,monospace;"># useradd -r -u 110 -g jetty -d /usr/share/jetty -M -s /sbin/nologin jetty</span>Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-54147975169744190162012-10-16T00:11:00.002+01:002012-10-20T14:19:45.397+01:00AMD Catalyst 12.9 Beta - Looking GoodI'm used to the inevitable sense of disappointment when trying new versions of AMD's proprietary Linux drivers.<br />
<br />
Let's face it: they boast a poor installer, a limited & buggy graphical configuration tool (amdcccle), irritating "AMD Testing use only" overlays with their beta drivers, terrible default underscan settings, and essential configuration options <i>hidden</i> in the completely undocumented Persistent Configuration Store.<br />
<br />
Oh, and painfully slow driver releases following kernel updates. Did I miss anything? (Probably plenty.)<br />
<br />
Hence, I didn't have high hopes for the next kernel upgrade. I'd even stuck with 12.6 until now.<br />
<br />
Moving to kernel 3.6.1, latest stable Catalyst (12.8) failed to build the kernel module. It actually gave the same error as 12.6 did under kernel 3.5.4. I wasn't surprised; just disappointed, as usual. <br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">firegl_public.c: In function 'KCL_MEM_AllocLinearAddrInterval':</span><br />
<span style="font-family: "Courier New",Courier,monospace;">firegl_public.c:2152:5: error: implicit declaration of function 'do_mmap'</span><br />
<br />
This time, however, AMD have listed their next beta driver prominently on the Linux driver download page. Kudos; I hated having to dig around their website for it. <br />
<br />
12.9 beta comes with a hefty 7% filesize increase over 12.8, and in my sceptical way, I was expecting a corresponding 7% increase in problems.<br />
<br />
Not so.<br />
<br />
The installer <i>feels</i> faster (but no, I didn't time it).<br />
<br />
By a stroke of luck, the kernel module actually built without a hitch.<br />
<br />
On reboot, it <i>worked</i> without further intervention.<br />
<br />
Now here's a simple but helpful one. Previously, to start amdcccle, one had to run <span style="font-family: "Courier New",Courier,monospace;">sudo amdcccle</span> - a dodgy workaround at best. Now, they've fixed amdxdg-su, so that the menu entries now work, along with the direct command:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">$ amdxdg-su -c amdcccle</span><br />
<br />
Then, amdcccle started without error, the monitor configuration screen worked without a single frustration (is it just me, or have they improved that drag and drop interface?), and the settings were duly instantiated following a reboot.<br />
<br />
The awful default underscan I'm used to on my plasma was no longer present (meaning I no longer have to interface directly with the undocumented PCS).<br />
<br />
And, the cherry on the cake - no more "AMD Testing use only" watermark plastered all over my monitors.<br />
<br />
Seriously?<br />
<br />
This just isn't fair - there's hardly anything left for me to complain about!<br />
<br />
For once; well done, AMD.<br />
<br />
<b>Update after the bedding-in period:</b><br />
<br />
Alas, all is not perfect. Vsync, which was working perfectly under 12.6, is now broken (making the watching of videos rather unpleasant).<br />
<br />
Additionally, I'm seeing screen corruption in a variety of cases during overlay transitions. Forcing a screen redraw clears it, but again, this is a frustrating problem which didn't exist before.<br />
<br />
All things considered, I'd rather have a variety of irritations during installation & initial configuration than I would persistent issues affecting day-to-day usage. Here's hoping they're fixed in 12.9 stable.<br />
<br />
One is left wondering just how comprehensive AMD's test packs, unit & integ tests are (this is presuming they do <i>actually</i> perform testing). Further, with the rumours of staff cuts at AMD, is the situation going to get better... or worse?Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-87934908882294995032012-10-14T21:55:00.001+01:002013-05-08T01:46:08.419+01:001and1 GIT Repositories Leave A Lot To Be Desired Every now and again we all come across things which appear too ridiculous to be true. As was the way with 1and1's GIT repos. Allow me to recant the tale.<br />
<br />
I was looking for a primary GIT repository to host a private project. This unfortunately ruled out Github, as their pricing model for private hosting was a little too steep.<br />
<br />
I would have been happy to host it locally, but with high availability as a requirement, and the fact that the best connection I can get in my area is a poor ADSL with speeds of < 3Mbit dl (let's not even talk about ul!), that didn't seem ideal.<br />
<br />
What I did have was a *nix hosting account with 1and1, and with shell access as standard, this seemed ideal. Digging around the 1and1 console, I even found a prominent section promoting the use of git, and with instructions for its use. Better still, git was already installed on the server; no need for the wget/make combo.<br />
<br />
Unfortunately, the only protocol configured for git was SSH; but, that didn't pose any immediate problem. In minutes, I had a git repo configured, had cloned it locally, and everything was good. <br />
<br />
Then came the obvious next move: securing the configuration by using an appropriately configured SSH account.<br />
<br />
This aligns with the first rule* of computer security: grant only those permissions which are absolutely necessary. Obviously, nobody would use a fully permissioned** SSH account for simple pushes to a repo, let alone disseminate it to others... would they?<br />
<br />
So I tried SSH-ing in with a secondary FTP account. This is what I saw:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">This account is restricted by rssh.<br />Allowed commands: sftp <br /><br />If you believe this is in error, please contact your system administrator.<br /><br />Connection to XXXXX.co.uk closed.</span></blockquote>
And therein lies the catch: <b>1and1 supports only 1 single SSH account, which has the same credentials as the master FTP account</b>.<br />
<br />
A lengthy call with technical support confirmed my bewildered suspicions.<br />
The reason given? "Security".<br />
<br />
Perhaps it's my own marbles rolling around on the floor, but this security policy seems to have been devised by the same people behind <a href="http://www.techweekeurope.co.uk/news/ieee-password-leak-94064" target="_blank">IEEE's webserver</a> permissioning strategy.<br />
<br />
At the very least, they should have a secondary ssh account restricted to a preset git repository directory and the git command. At most, they should allow proper ssh user account creation & permissioning. An alternative would be to configure the webserver for git over https; but they haven't done that either.<br />
<br />
It could be <i>marginally</i> acceptable if you only intend to pull patches from submitters and push them to the remote <i>yourself</i>, but it's still barely suitable for that use case. The only place I'd feel comfortable storing the key would be on my own boxes (not mobile devices), which would make for some rather inconvenient git practices.<br />
<br />
Another unrelated inconvenience with this route is 1and1's rather low configuration for the number of failed login attempts prior to temporary IP blocking. It's a good policy to have, but implemented in rather brutal fashion... no gradual backoffs, nothing. The block itself lasts quite a while, and their SLA upon calling and requesting an unblock is 4 hours.<br />
<br />
I finished my call to 1and1 with a request to revise their 1 login "security policy"... but until then, if you want a high availability GIT repo, look elsewhere.<br />
<br />
<b>Update 8th May 2013:</b><br />
<br />
A great alternative, if all you want is a private hosted service with a handful of users, is Atlassian's <a href="https://bitbucket.org/" target="_blank">Bitbucket</a>. It comes with a rather agreeable interface, >=5 users, unlimited repos, and as good as instant account setup, all for free. <br />
<span style="font-size: x-small;"><br /></span>
<span style="font-size: x-small;">* There are lots of "first" rules, depending upon what got the author's gander up at the time of writing.</span><br />
<br />
<span style="font-size: x-small;">** Got r00t? Nope... but as fully permissioned as it gets on 1and1, meaning access to the entire webspace.</span>Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com1tag:blogger.com,1999:blog-1181837628516827235.post-69944057960059192812012-08-27T22:47:00.000+01:002012-08-27T19:34:44.989+01:00Xen Part 13: VGA Passthrough: Another failed attemptPreamble: this post has been sitting around since 20th May, waiting for me to finally get things working. Yet, due to other commitments, I simply haven't found the time to invest in Xen. I'm posting this just in case it helps somebody out of a particular problem, given the level of interest I'm seeing in passthrough. Personally, I've now migrated back to a Fedora dom0 (which worked better for me OOTB), and am waiting for 4.2 to be released before trying again - hopefully with more success.<br />
<br />
<b>Warning: the following doesn't result in a working VGA passthrough setup.</b><br />
<br />
Setting up VGA passthrough as per the <a href="http://wiki.xen.org/xenwiki/XenVGAPassthrough" target="_blank">xen wiki</a> (detailed in my posts <a href="http://nixnote.blogspot.com/2012/03/xen-part-9-pci-passthrough.html" target="_blank">Part 9: PCI Passthrough</a> and <a href="http://nixnote.blogspot.com/2012/04/xen-part-11-ati-graphics-drivers-on.html" target="_blank">Part 11: ATi Graphics Drivers on the domU</a>) got me to the stage where I thought it should be working - but I simply didn't get any graphical output on the monitors when the time came.<br />
<br />
The only oddities I could see on the domU were in Xorg.0.log:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">[ 54.071] (EE) fglrx(0): V_BIOS address 0x0 out of range</span><br />
<div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">[ 54.071] (II) fglrx(0): Invalid ATI BIOS from int10, the adapter is not VGA-enabled</span></div>
</div>
<div>
<i>... a seemingly random period of time passes (seconds to minutes), then everything comes up roses...</i></div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">[ 57.325] (II) fglrx(0): ATI Video BIOS revision 9 or later detected</span><br />
<br />
This occurred both on Ubuntu 11.10 running the latest stable 3.2.13 kernel, and on Windows XP, both using latest AMD proprietary graphics drivers.<br />
<br />
I was therefore left with the inescapable conclusion that Xen 4.1.2 was to blame. Thankfully, I stumbled upon <a href="http://www.davidgis.fr/blog/index.php?2011/12/07/860-xen-42unstable-patches-for-vga-pass-through" target="_blank">Jean David Techer's instructions</a> for applying a collection of VGA passthrough patches to Xen unstable, which handle the provision of the VC BIOS and setting the BARs. Many thanks to Jean for posting the walkthrough, and also saving everybody the trouble of porting the VGA passthrough patches to the latest Xen revisions.<br />
<br />
<span class="Apple-style-span" style="font-size: large;"><b>Before We Begin</b></span><br />
<br />
Let's just make sure that your graphics card is detected and initialised correctly in the dom0. There's little point proceeding if it isn't.<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
1) A quick check to make sure you don't need Debian's firmware-linux-nonfree package:</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ dmesg | grep ni_cp | grep "Failed to load firmware" && echo "You need to install firmware-linux-nonfree" || echo "Looks OK, proceed to point 2"</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># apt-get install firmware-linux-nonfree </span></div>
<br />
2) You may need to setup some pci quirks for your card. This is a check for a problem I encountered with my HD6970:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ dmesg | grep "Driver tried to write to a read-only configuration space" && echo "You need to setup a PCI quirk" || echo "Looks OK, proceed to point 3"</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ dmesg | grep -A 2 "Driver tried to write to a read-only configuration space"</span><br />
<br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">[927513.834633] pciback 0000:01:00.0: Driver tried to write to a read-only configuration space field at <b>offset 0xa2, size 2</b>. This may be harmless, but if you have problems with your device:</span><br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">[927513.834635] 1) see permissive attribute in sysfs</span><br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">[927513.834636] 2) report problems to the xen-devel mailing list along with details of your device obtained from lspci.</span><br />
<div>
<br /></div>
<br />
To add a PCI quirk, you need the vendor and device ID for your device (it's the last entry on the line):<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ lspci -nn | grep VGA</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: #666666;">00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0102] (rev 09)</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: #666666;">01:00.0 VGA compatible controller [0300]: ATI Technologies Inc Cayman XT [Radeon HD 6970] [<b>1002:6718</b>]</span></span><br />
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># vim /etc/xen/xend-pci-quirks.sxp</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">(HD6970</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> (pci_ids</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ('1002:6718')</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> )</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> (pci_config_space_fields</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> ('000000a2:2:00000000')</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> )</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">)</span><br />
<div>
<br /></div>
<br />
Replace HD6970 with any name you like to identity your card, replace 1002:6718 with the vendor/device ID you retrieved from lspci, replace 000000a2 with the offset from dmesg, and replace 2 with the size from dmesg.<br />
<br />
3) Search dmesg for the logs pertaining to your graphics card. You'll have to amend the greps below to correctly identify your graphics card's PCI ID (I'm using the 6970 grep to find my HD6970).<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ dmesg | grep `lspci | grep VGA | grep 6970 | awk '{ print $1 }'`</span><br />
<br />
Look over these logs to identify any further problems, and correct any obvious faults before proceeding.<br />
<br />
4) Verify that running <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">lspci</span> on the domU returns your card. If not, check the output of <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">dmesg | grep -i pci</span> for clues.<br />
<br />
If you see:<br />
<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">XENBUS: Device with no driver: device/pci/0</span><br />
<div>
<br /></div>
<div>
verify that the domU's kernel has pcifront loaded.</div>
<br />
<br />
<span class="Apple-style-span" style="font-size: large;"><b>Extract the BIOS from the Graphics Card</b></span><br />
<br />
ATI cards are handled in this section, whilst NVIDIA card users should follow step 1 in <a href="http://www.davidgis.fr/blog/index.php?2011/12/07/860-xen-42unstable-patches-for-vga-pass-through" target="_blank">Jean's instructions</a>.<br />
<br />
Find out <a href="http://www.techpowerup.com/articles//overclocking/vidcard/154/3" target="_blank">how to extract your graphics card BIOS</a>. If you determine that ATIFlash is the way you want to go, then first obtain it (<a href="http://www.techpowerup.com/downloads/2099/ATIFlash%203.95.html" target="_blank">ATIFlash 3.95</a>) and find a USB drive without any important data on. Insert it, find out its /dev/XXX node and ensure it's unmounted before proceeding.<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># apt-get install unetbootin</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># mkdosfs -F32 /dev/XXX</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># mount /dev/XXX /mnt</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: inherit;">Run UNetbootin and install FreeDOS to the USB drive. Don't reboot when prompted.</span><br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ unzip atiflash_395.zip</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># cp atiflash.exe /mnt</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># umount /mnt</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span class="Apple-style-span" style="font-family: inherit;">Reboot to the USB drive</span><br />
<span class="Apple-style-span" style="font-family: inherit;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">> c:</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">> atiflash -i</span><br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">adapter bn dn dID asic flash romsize</span><br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">======= == == ==== ============== ============= =======</span><br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"> 0 01 00 6718 Cayman M25P10/c 20000 </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">> atiflash -s 0 bios0.rom</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span>
Reboot, copy bios0.rom onto a HDD and rename it to vgabios-pt.bin<br />
<br />
<span class="Apple-style-span" style="font-size: large;"><b>Obtain a Patchable Xen Unstable</b></span><br />
<br />
This is really just following steps 2-7 <a href="http://www.davidgis.fr/blog/index.php?2011/12/07/860-xen-42unstable-patches-for-vga-pass-through" target="_blank">at Jean's site</a>; I reproduce them below mostly for my own benefit for the specific case of a HD6970.<br />
<br />
Here I'm using Xen unstable revision 25099. This is, at time of writing, the most recent version explicitly supported by the VGA passthrough patches that Jean David Techer maintains. If you want to use a later revision, you would have to recreate the patch diffs accordingly, or wait for Jean to diligently provide a newer collection of patches. <br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># apt-get install mercurial libglib2.0-dev libyajl-dev</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ mkdir -p Downloads/xen-unstable</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ cd Downloads/xen-unstable</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ rev=25099;hg clone -r $rev http://xenbits.xensource.com/staging/xen-unstable.hg/ xen-unstable.hg-rev-${rev}</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ cd xen-unstable.hg-rev-25099</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ hg summary</span><br />
<div>
<div>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">parent: 25099:4bd752a4cdf3 tip</span></div>
<div>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"> x86_emulate: Do not push an error code onto a #UD exception stack</span></div>
<div>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">branch: default</span></div>
<div>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">commit: (clean)</span></div>
<div>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">update: (current)</span></div>
</div>
<div>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ ./configure</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span><br />
<div style="font-family: Sans;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ cd tools</span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: Sans;">Ensure you actually do run this command as a normal user - as indicated.</span></span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></span></div>
</div>
<div style="font-family: Sans;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ make</span></span></div>
</div>
<div style="font-family: Sans;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ make clean</span></span></div>
</div>
<div style="font-family: Sans;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ cd ..</span></span></div>
</div>
<div style="font-family: Sans;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ xenpatches=xen-4.2_rev24798_gfx-passthrough-patchs</span></span></div>
</div>
<div style="font-family: Sans;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ wget -q http://www.davidgis.fr/download/${xenpatches}.tar.bz2</span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ tar xjf ${xenpatches}.tar.bz2 </span></span></div>
</div>
</div>
<div>
<span class="Apple-style-span" style="font-family: monospace; font-size: 12px; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: inherit; font-size: large; white-space: pre;"><b>BAR Configuration</b></span><br />
<span class="Apple-style-span" style="font-family: inherit; font-size: 12px; white-space: pre;"><br /></span>
Now to set up the Base Address Registers (BARs) specific to your graphics card. <br />
<span class="Apple-style-span" style="font-family: monospace; font-size: 12px; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;">$ lspci | grep VGA</span><br />
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="white-space: pre;">00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
<b>01:00.0</b> VGA compatible controller: ATI Technologies Inc Cayman XT [Radeon HD 6970]</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="white-space: pre;"><br /></span></span>
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;">Locate the correct PCI ID from the above output, as usual...</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="white-space: pre;"><br /></span></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="white-space: pre;">$ </span><span class="Apple-style-span" style="white-space: pre;">dmesg | grep XX:XX.X | grep "mem 0x"</span></span></div>
<div>
<div>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">[ 4.120860] pci 0000:01:00.0: reg 10: [mem 0xc0000000-0xcfffffff 64bit pref]</span></div>
<div>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">[ 4.120878] pci 0000:01:00.0: reg 18: [mem 0xfbe20000-0xfbe3ffff 64bit]</span></div>
<div>
<span class="Apple-style-span" style="color: #666666; font-family: 'Courier New', Courier, monospace;">[ 4.120912] pci 0000:01:00.0: reg 30: [mem 0xfbe00000-0xfbe1ffff pref]</span></div>
</div>
<br />
<div>
In the above output, there are 3 memory ranges that Xen needs to know about. The start and end of each range is provided in hex (e.g. the first range starts at 0xc0000000 and ends at 0xcfffffff).<br />
<br />
As <a href="http://www.davidgis.fr/blog/index.php?2011/12/07/860-xen-42unstable-patches-for-vga-pass-through" target="_blank">Jean explains</a>, we also need to know the size of each range. Jean uses hex->dec and dec->hex conversion for the calculations, but I think figuring it out purely in hex is easier. Just remember your basic rules of hexadecimal, and you should find this calculation pretty simple. <span class="Apple-style-span" style="font-size: small; white-space: pre;"> </span><br />
<br />
<span class="Apple-style-span" style="font-size: small; white-space: pre;">If you got a bit lost here, use Jean's method instead.</span></div>
<div style="font-family: inherit;">
<span class="Apple-style-span" style="font-size: small; white-space: pre;"><br /></span>
To recap, In decimal we have a maximum number of 9 before we wrap around to 0 again. 0 to max (9) is a total of 10 values. In hex, the maximum number is 0xf (==15). 0x0 to max (0xf) is a total of 0x10 values. Switching back to memory ranges, this means that a range starting at 0xc0 and ending at 0xcf would have a size of 0x10.</div>
<div style="font-family: inherit;">
<span class="Apple-style-span" style="font-size: small; white-space: pre;"><span class="Apple-style-span"><br /></span></span>
Applying this to the first example above, the total size of memory range 0xc0000000 to 0xcfffffff would be 0x10000000 (the number of values in 0x0000000 -> 0xfffffff).</div>
<span class="Apple-style-span" style="font-family: monospace; font-size: 12px; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"><b>Start End Size</b></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;">0xC0000000 0xCFFFFFFF 0x10000000</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;">0xFBE20000 0xFBE3FFFF 0x00020000</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;">0xFBE00000 0xFBE1FFFF 0x00020000</span><br />
<span class="Apple-style-span" style="font-family: monospace; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;">Now let's change the relevant patch file to match these BARs.</span><br />
<span class="Apple-style-span" style="font-family: monospace; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;">$ vim ${xenpatches}/patch_dsdt.asl</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="white-space: pre;"><br /></span></span>
Modify the first three DWordMemory function calls, such that the second and third hex values are set to the start and end addresses, and the fifth (final) value is the size. For example,<br />
<span class="Apple-style-span" style="font-family: inherit; font-size: 12px; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; white-space: pre;"> DWordMemory(
ResourceProducer, PosDecode, MinFixed, MaxFixed,
Cacheable, ReadWrite,
0x00000000,
- 0xF0000000,
- 0xF4FFFFFF,
+ 0xF4000000,
+ 0xF5FFFFFF,
0x00000000,
- 0x05000000,
- ,, _Y01)
+ 0x02000000)</span><span class="Apple-style-span" style="font-family: inherit; font-size: 12px; white-space: pre;">
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;">would change to</span><br />
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"> DWordMemory(
ResourceProducer, PosDecode, MinFixed, MaxFixed,
Cacheable, ReadWrite,
0x00000000,
- 0xF0000000,
- 0xF4FFFFFF,
+ <span class="Apple-style-span" style="color: #38761d;">0xC0000000</span>,
+ <span class="Apple-style-span" style="color: #38761d;">0xCFFFFFFF</span>,
0x00000000,
- 0x05000000,
- ,, _Y01)
+ <span class="Apple-style-span" style="color: #38761d;">0x10000000</span>)</span></span><br />
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br /></span></span>
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;">and</span><br />
<span class="Apple-style-span" style="font-family: monospace; font-size: 12px; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ DWordMemory(
+ ResourceProducer, PosDecode, MinFixed, MaxFixed,
+ Cacheable, ReadWrite,
+ 0x00000000,
+ 0xF4000000,
+ 0xF5FFFFFF,
+ 0x00000000,
+ 0x02000000)</span></span><span class="Apple-style-span" style="font-family: monospace; font-size: 12px; white-space: pre;">
</span><br />
<div>
<span class="Apple-style-span" style="font-family: monospace; font-size: 12px; white-space: pre;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="font-family: inherit;">would change to</span></span></div>
<div>
<span class="Apple-style-span" style="font-family: monospace; font-size: 12px; white-space: pre;"><br /></span></div>
<span class="Apple-style-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ DWordMemory(
+ ResourceProducer, PosDecode, MinFixed, MaxFixed,
+ Cacheable, ReadWrite,
+ 0x00000000,
+ <span class="Apple-style-span" style="color: #38761d;">0xFBE20000</span>,
+ <span class="Apple-style-span" style="color: #38761d;">0xFBE3FFFF</span>,
+ 0x00000000,
</span></span><br />
<div>
<span class="Apple-style-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ <span class="Apple-style-span" style="color: #38761d;">0x00020000</span>)</span><span class="Apple-style-span" style="font-family: monospace;"> </span></span></div>
<div>
<span class="Apple-style-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="font-family: monospace;"><br /></span></span></div>
<div>
<span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: inherit;">The third follows the same pattern. Leave the final function call as-is.</span></span><br />
<span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: inherit;"><br /></span></span>
<span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: inherit; font-size: large;"><b>Reinstating PCI Passthrough Config via pciback</b></span></span><br />
<span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: inherit;"><br /></span></span>
Think back to <a href="http://nixnote.blogspot.com/2012/03/xen-part-9-pci-passthrough.html" target="_blank">Xen Part 9: PCI Passthrough</a>. Did you amend the /etc/init.d/xencommons script to enable passthrough for one or more PCI devices? If you did, heads up: reinstalling Xen is about to overwrite your code.<br />
<br />
If you used some custom code, just copy it into tools/hotplug/Linux/init.d/xencommons.<br />
<br />
If you used the bog standard code in the tutorial and just amended the BDF ID, then to make things simpler you may want to add <a href="http://content.nixnotes.co.uk/xen/vgapassthrough/25099/xencommons.patch" target="_blank">this xencommons patch</a> to your patch set (NB: this is built against revision 25099), and amend your BDF ID in it as before. That should make maintenance easier, and remind you to update that file if/when you build a newer version of Xen in the future.<br />
<br /></div>
<div>
<span class="Apple-style-span" style="font-size: large;"><b>Patch Xen Unstable</b></span></div>
<div>
<div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">$ <span class="Apple-style-span" style="white-space: pre;">for file in `ls ${xenpatches}/*`; do patch -N -p1 < $file; done</span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: 12px; white-space: pre;"><br /></span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Check that succeeded. Then copy the graphics card's BIOS, which you extracted earlier, to the vgabios folder:</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="white-space: pre;"><br /></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;">$ cp /home/ace/vgabios-pt.bin tools/firmware/vgabios/</span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="white-space: pre;"><br /></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-size: large; white-space: pre;"><b>Compile & Install</b></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="white-space: pre;"><br /></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;">$ make xen && make tools && make stubdom</span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;">Now time for installation.</span><br />
<span class="Apple-style-span" style="font-family: inherit; white-space: pre;"><br /></span>
<span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># make install-xen && make install-tools PYTHON_PREFIX_ARG= \</span></span><br />
<span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">&& make install-stubdom</span></span><br />
<span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># update-grub</span></span><br />
<span class="Apple-style-span" style="white-space: pre;"><br /></span>
<span class="Apple-style-span" style="white-space: pre;">Reboot</span><br />
<span class="Apple-style-span" style="white-space: pre;"><br /></span>
<span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"># shutdown -r now</span></span><br />
<span class="Apple-style-span" style="white-space: pre;"><br /></span>
<span class="Apple-style-span" style="font-family: "Courier New",Courier,monospace; white-space: pre;">root@ace2x1:~# dmesg | grep "mem 0x"
[ 0.669673] pci_bus 0000:00: root bus resource [mem 0x00000000-0xfffffffff]
[ 0.673606] pci 0000:00:00.0: reg 10: [mem 0xc0000000-0xcfffffff 64bit pref]
[ 0.673606] pci 0000:00:00.0: reg 18: [mem 0xfbe20000-0xfbe3ffff 64bit]
[ 0.673606] pci 0000:00:00.0: reg 30: [mem 0xfbe00000-<span class="Apple-style-span" style="color: red;">0xfbffffff</span> pref]
[ 0.732491] pci 0000:00:00.0: address space collision: [mem 0xfbe00000-0xfbffffff pref] conflicts with 0000:00:00.0 [mem 0xfbe20000-0xfbe3ffff 64bit]</span><span class="Apple-style-span" style="font-family: "Courier New",Courier,monospace; white-space: pre;">
</span><br />
<span class="Apple-style-span" style="white-space: pre;"><br /></span>
This is where it should be working. Instead of that, I see an erroneous BAR contrary to the ranges I provided, and I get no further.</div>
</div>
Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-56453548034576515422012-08-25T19:09:00.002+01:002012-09-23T14:40:18.814+01:00Apple vs Samsung: The FarceI've always been amazed this made it to trial. It seemed like an open and shut case; one that should have been thrown out long before a jury was convened and it made headline news. Apple claimed that Samsung's mobile devices violated 6 of its patents. Today, the jury sided with Apple on 5 out of 6 of these patents, and awarded it $1bn in damages. <br />
<br />
Has there ever been a clearer demonstration of the urgent need for patent reform? It's a system which, for hardware and software, offers little if any protection for true innovation, and has simply descended into a messy lawyer's dream of suits, counter-suits, gross monopolization, the growth of patent trolls, and the ousting of the "little guy". Which is moreorless the opposite of its claimed raison d'etre.<br />
<br />
Groklaw <a href="http://www.groklaw.net/article.php?story=20120824175815101" target="_blank">describes the verdict</a> as "preposterous"; a "farce". I describe it as a disgrace. <br />
<br />
Take, for example, Apple patent D677. It is a patent for the design of the iPhone. It describes the front as black; flat; rectangular; 4-cornered; round-edged; containing a screen; with thin side borders; larger top and bottom borders; a top speaker; button area beneath.<br />
<br />
Did Samsung use a similar design for some of their mobile devices? I believe so, yes. But, then again, so would almost any smartphone manufacturer. What D677 describes is a blueprint for what almost <i>has to be</i> to constitute a phone with a touchscreen.<br />
<br />
Think about it. To manufacture a smartphone (and remember that Apple was not the first), you need a <i>touchscreen</i> (which is <i>black, flat, </i>and<i> rectangular</i>). You need to house it in a container (which will obviously need <i>4 corners</i>, and unless you want your end-users to stab their hands every time they unpocket it, those corners will need to be <i>round-edged</i>).<br />
<br />
The <i>thin side borders</i> are a simple case of ergonomics. You need to hold the device, but need to be able to touch all areas of the screen. Wide borders would make it harder to reach all areas of the touchscreen. You can't sensibly add any other useful functionality (like buttons) on the sides, since you'd accidentally hit them when using the touchscreen. Finally, small bezels look better; monitor manufacturers have promoted this as a feature for years, as have TV manufacturers, laptop manufacturers, etc.<br />
<br />
The <i>larger top and bottom borders</i> are also required, because there's a lot that needs to fit into a smartphone "under the hood" - and if you make one dimension shorter, you need to make the other dimension longer, just to fit everything in.<br />
<br />
The <i>speaker</i> <i>at the top</i>; now, that's surely something that could have been placed elsewhere? That must have been copied.<br />
<br />
Not exactly. Remembering these are phones, consider: where is your ear in relation to your mouth? It's another case of basic human requirements.<br />
<br />
That leaves us with the <i>button area</i><b> </b><i>at the bottom</i>. Android (like iOS) requires some hard buttons, like the home button. They have to go somewhere. For the principal buttons, putting them on the side makes them awkward to use; on the top is too far to reach for most people's hands; and the sides we've ruled out already. Where else is left?<br />
<br />
D677 simply specifies what any smartphone manufacturer would be likely to work out for themselves within the first few days, or hours, of the design process. You need a touchscreen, buttons, speaker, mic, camera(s), battery, processor, memory, lights, connectors, etc. There are requirements posed by the OS. There are human factors to consider. Putting them all together for both Android and iOS, and with presently available hardware, you end up with something similar to D677.<br />
<br />
The same holds for many of the other patents Apple has used to secure this $1bn ruling. <br />
<br />
The long and short of it? Apple, somehow, holds some patents which describe <i>obvious </i>design points for the classes of devices called smartphones and tablet PCs. It's tantamount to a PC manufacturer waving a patent describing the design for a computer case, keyboard and monitor, and asking all the other PC manufacturers in the world to cough up royalties. Or, for a non-technological example, it's tantamount to a clothing manufacturer taking out a patent for a small handbag; tapered; with a latch in the top-centre; a long adjustable strap; and a reinforced bottom.<br />
<br />
This case considered the similarity of the <i>external aesthetics</i> of the hardware, of which manufacturers of smartphones have very few choices, as I've already described. The similarity is by necessity, much like the similarity in most QWERTY keyboard designs is by necessity. The case neglected to consider the extreme dissimilarity in every other aspect of the devices; from internal hardware, to the OSs, to the applications and services on top, to the UX, etcetera.<br />
<br />
This particular ruling seeks to ensure that Apple alone is allowed to manufacture and sell smartphones and tablets in the US.<br />
<br />
How? It forces other manufacturers to modify the external aesthetics of their devices to sub-standard designs, in order to differentiate them from Apple's "patents" sufficiently such that juries no longer complain. Indeed, Samsung has already started to do so, with its release of the Galaxy Tab 2 - moreorless identical to the Galaxy Tab, just with an uglier and less practical external design.<br />
<br />
I don't blame the jury. They simply affirmed that the Galaxy S3 has a speaker at the top, a screen in the middle, some buttons at the bottom, and non-lethal corners.<br />
<br />
It was the job of the patent examiners to ensure the validity of the patent claims at issuance; to properly inspect the claims for prior art and non-obviousness.<br />
<br />
It would have helped if the judge had permitted Samsung the right to demonstrate invalidity by displaying the prior art.<br />
<br />
The damage claims might have sounded less ridiculous if all the damages awarded related to the claimed violations (some figures, in the millions, were requested for Samsung devices deemed non-violating).<br />
<br />
Finally, the case might have been more believable if it had taken a length of time to deliberate which befitted the complexity of the case.<br />
<br />
Appeals will undoubtedly follow.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-87217072579401648802012-08-25T14:44:00.004+01:002013-01-20T00:40:04.236+00:00Ctrl+Space (Content Assist) doesn't work in EclipseNavigate to Window -> Preferences -> General -> Keys. Find Content Assist. Delete Ctrl+Space from the binding field, and hold down Ctrl and press space:<br />
<br />
<ul>
<li>If only Ctrl+ is displayed, then something is intercepting the Ctrl+Space key binding before it reaches Eclipse. For me, it was IBus (in XFCE, go to Settings -> Input Method Selector, Use IBus -> Preferences*, and check the Enable or disable keyboard shortcut. If it's set to Ctrl+Space, clear the field, click Apply, and restart Eclipse).</li>
</ul>
<ul>
<li>On the other hand, if Ctrl+Space is displayed, then Eclipse is able to receive the key combination. Go to Window -> Preferences -> Java -> Editor -> Content Assist -> Advanced and make sure all relevant proposals are enabled. Other than that, just ensure dodgy import statements aren't affecting content assist's ability to recommend completions.</li>
</ul>
* Update: under Xubuntu 12.10, this seems to be slightly different, and Preferences is no longer available in this dialog. No matter; fire up a terminal and start <span style="font-family: "Courier New",Courier,monospace;">ibus-setup</span>. Delete Ctrl+Space from the keyboard shortcuts. There was no need to restart Eclipse.<br />
<ul>
</ul>
Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-76945043657687466092012-07-28T17:01:00.002+01:002012-10-16T00:47:02.341+01:00Catalyst driver problems on FedoraBoth AMD and NVIDIA have a less-than-ideal graphics driver offering. Many of us are forced to use their proprietary binary drivers due to marked performance issues and feature limitations in alternative open-source offerings.<br />
<br />
With proprietary drivers comes pain, as driver release schedules don't necessarily match up with kernel or xserver release schedules, and module incompatibilities post-upgrade often cause post-reboot soft crashes, kernel panics and headaches in general.<br />
<br />
I've posted most of this before, but with further kernel updates causing problems for people, it seemed a good time to combine everything into one post.<br />
<b><br />I upgraded my kernel, and after rebooting my system hangs on a black screen</b><br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLk6ozBlBg4ojysGbIIIRQkFnAT3e3YBDqTxxmrSSjS_gBvrcTJk_rgY2s0KhVr4R9Q_lhg5sKlz01znmVY9n3GBdZEOoftZEMinw718Suuzn1jUb3eMkwaUMIsGGxtKR6zTVvAURJz7M/s1600/fglrxko.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="43" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLk6ozBlBg4ojysGbIIIRQkFnAT3e3YBDqTxxmrSSjS_gBvrcTJk_rgY2s0KhVr4R9Q_lhg5sKlz01znmVY9n3GBdZEOoftZEMinw718Suuzn1jUb3eMkwaUMIsGGxtKR6zTVvAURJz7M/s200/fglrxko.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">/var/log/Xorg.0.log</td></tr>
</tbody></table>
You need to install the latest Catalyst driver and/or recompile the fglrx module. Before you can do this, you first need to get to a shell; and, as usual, the following triage procedure for doing so applies. Keep going until you get a friendly login prompt. <br />
<br />
1. Try switching to another tty with Ctrl + Alt + F[1..12].<br />
<br />
2. Alt + PrintScrn + R, then retry the above.<br />
<br />
3. You'll need to reboot.<br />
i) Do so the soft way, waiting a couple of seconds in between each alpha key: Alt + PrintScrn + [R,E,I,S,U,B] <br />
ii) If that doesn't work, you'll have to do so the hard way - with the power button.<br />
<br />
4. At the GRUB prompt, press 'e' to enter edit mode. Locate the kernel line beginning with 'linux'*. If 'rhgb' is present, delete it (this will show the textual output of the boot process, and is useful for debugging). In its place, add 'single' (this boots to single user mode, i.e. a shell). When done, press F10. This should dump you at a shell.<br />
<br />
5. If even that has failed, your problems are likely more serious than an incompatible module. You're going to need an installation disc to boot into rescue mode, mount your drive, and continue your investigations there.<br />
<br />
Once you have a shell, you're in business. Check the /var/log/Xorg.0.log logfile to confirm there was a problem with your fglrx driver. Locate your fglrx installation file, which will be named something like 'amd-driver-installer-12-6-x86.x86_64.run'. Ideally, you will use the newest version available. Run it:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
# chmod +x amd-driver-installer-12-6-x86.x86_64.run</div>
<div style="font-family: "Courier New",Courier,monospace;">
# ./amd-driver-installer-12-6-x86.x86_64.run</div>
<br />
You may need to use the <span style="font-family: "Courier New",Courier,monospace;">--force</span> flag to overwrite the previous installation.<br />
<br />
Install as usual. If there are no errors, reboot. If there are, check the logfile at the location provided.<br />
<br />
<b>The fglrx installation error log contains</b><br />
<b>"error: ‘cpu_possible_map’ undeclared (first use in this function)"</b><br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqp3E8pvRXlbt81d5gQbe3z_zVI2aS1wnBKyXlhz5h0wYBCNkf-vtOaiB25WFYpRY0b_7BlsLRZGgiRFdt2KXlt6r1bhFik45ngfsSg29MfVaol_vEnH6b_plDiZPQHyVeDtlKenW2HQY/s1600/cpu_possible_map.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="35" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqp3E8pvRXlbt81d5gQbe3z_zVI2aS1wnBKyXlhz5h0wYBCNkf-vtOaiB25WFYpRY0b_7BlsLRZGgiRFdt2KXlt6r1bhFik45ngfsSg29MfVaol_vEnH6b_plDiZPQHyVeDtlKenW2HQY/s200/cpu_possible_map.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">/usr/share/ati/fglrx-install.log</td></tr>
</tbody></table>
This is a <a href="http://ati.cchtml.com/show_bug.cgi?id=495" target="_blank">known issue</a> which still isn't fixed. A <a href="http://cvs.rpmfusion.org/viewvc/rpms/catalyst-kmod/F-16/fglrx_kernel_3.4.0.patch?revision=1.3&root=nonfree&view=markup" target="_blank">patch</a> has been made available. If you're using the patch application, direct it towards /usr/lib/modules/fglrx/build_mod. If you don't have internet access on the box, the quickest solution IMHO is to literally apply the patch manually (given its small size).<br />
<br />
To do so, edit the /usr/lib/modules/fglrx/build_mod/firegl_public.c file. Search for the first instance of 'i387' and <i>add</i> this line beneath (line 190):<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
#include <asm/fpu-internal.h></div>
<br />
Search for the first instance of 'FN_FIREGL_KAS', and <i>replace</i> the line beneath with (line 4160):<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
for_each_possible_cpu(p)</div>
<br />
Edit the /usr/lib/modules/fglrx/build_mod/kcl_ioctl.c file. Search for the first instance of 'to allocated' and <i>add</i> this line beneath (line 220):<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
DEFINE_PER_CPU(unsigned long, old_rsp);</div>
<br />
After saving those files, rebuild and install the fglrx module:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
# cd /usr/lib/modules/fglrx/build_mod</div>
<div style="font-family: "Courier New",Courier,monospace;">
# ./make.sh</div>
<div style="font-family: "Courier New",Courier,monospace;">
# cd ..</div>
<div style="font-family: "Courier New",Courier,monospace;">
# ./make_install.sh </div>
<br />
Finally, test that you can load your fglrx module with<br />
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
# modprobe fglrx</div>
<div style="font-family: "Courier New",Courier,monospace;">
# lsmod | grep fglrx</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
Reboot. </div>
<br />
<div style="font-family: inherit;">
<b>I've rebooted back into Fedora, but my multi-monitor configuration is awry</b></div>
<br />
Use the AMD Catalyst Control Center (sic) in administrative mode.<br />
<br />
<b>"AMD Catalyst Control Center (Administrative)" fails to open</b> <br />
<br />
Run this instead**:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
$ sudo amdcccle</div>
<b><br /></b><br />
<b>My HDTV shows large black borders around the edges</b><br />
<br />
See my <a href="http://nixnote.blogspot.co.uk/2012/06/amd-catalyst-fixing-underscan.html" target="_blank">AMD Catalyst: Fixing Underscan</a> post for some background info, but you should just need to run this and reboot:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
$ sudo amdconfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0</div>
<br />
<b>There's an ugly "AMD Testing use only" watermark permanently placed on the bottom of each monitor</b><br />
<br />
You can upgrade/downgrade to the latest release (i.e. non-beta) driver, or run <a href="http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark" target="_blank">Kano's</a> script which I've reproduced below (and tweaked slightly for use on Fedora): <br />
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
#!/bin/sh<br />
DRIVER=/usr/lib64/xorg/modules/drivers/fglrx_drv.so</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
cp $DRIVER ${DRIVER}.original</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
for x in $(objdump -d $DRIVER|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br />
sed -i "s/$x/\x90\x90\x90\x90\x90/g" $DRIVER</div>
<br />
<span style="font-family: "Courier New",Courier,monospace;">done</span><br />
<br />
<br />
<br />
<span style="font-size: x-small;">* As you already know, Linux is just the kernel. Much of the rest of the OS is based on the recursively-named GNU utils. </span><br />
<br />
<span style="font-size: x-small;">** Unpolitically correct, I know, but it "just works" across all desktop environments and has never caused me a problem with amdcccle in particular. If anybody knows of a gksudo/gnomesu equivalent package <i>in the Fedora repos, </i>I'd be grateful to hear of it. The administrative menu entry for amdcccle calls <span style="font-family: "Courier New",Courier,monospace;">amdxdg-su -c amdcccle</span>, but this doesn't work for me (under xfce at least, it fails with "no graphical method available"). <a href="http://ati.cchtml.com/show_bug.cgi?format=multiple&id=367" target="_blank">ATI bug report</a>. <a href="https://bugs.launchpad.net/ubuntu/+source/fglrx-installer/+bug/1019023" target="_blank">Ubuntu bug report</a>.</span><br />
<br />Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0tag:blogger.com,1999:blog-1181837628516827235.post-7470767677918570922012-06-08T23:21:00.003+01:002013-11-24T01:38:52.440+00:00AMD Catalyst: Fixing UnderscanThe proprietary ATI Catalyst fglrx driver always tends to underscan on my 1080p Panasonic TV.<br />
<br />
Underscan is the condition of seeing a smaller image than should be the case: a "black border" around the edges. It is sometimes set by default to counteract <a href="http://hd.engadget.com/2010/05/27/hd-101-overscan-and-why-all-tvs-do-it/" target="_blank">overscan</a> (where the image is enlarged and cropped; a throwback from the old days of CRT monitors). <br />
<br />
The method for fixing it is non-obvious. One expects to be able to adjust the underscan/overscan settings via amdcccle - the AMD graphical configuration tool - but all too often amdcccle doesn't make this facility available for HDTVs.<br />
<br />
Let me briefly step you through the bizarre history of AMD's support for fixing underscan, before presenting the solution that works for today's drivers. If you can see any logic behind AMD's strange decision-making, I'd be intrigued to hear about it!<br />
<br />
The solution to this problem used to involve aticonfig's* <span style="font-family: "Courier New",Courier,monospace;">--set-dispattrib</span>
command. You had to establish which arbitrary display name (from a possible list of of
12 candidates) the driver was using to identify the monitor in question, then
identify the size/position settings for that display, and play around
with them until the output looked right.<br />
<br />
This used to be the procedure:<br />
<br />
1) One would
find the "display type" (here I'm outputting the horizontal offset in pixels
for each display, so of the display types that return values, I can
determine which display is the one I want, based on the horizontal
offset):<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$
for disptype in crt1 lvds tv cv tmds1 crt2 tmds2 tmds2i dfp3 dfp4 dfp5
dfp6 ; do amdconfig --query-dispattrib=${disptype},positionX; done</span><br />
<br />
2) Then one would find the relevant settings for the display identified as exhibiting underscan:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$
for dispattrib in positionX positionY sizeX sizeY overscan ; do
amdconfig --query-dispattrib=<display type>,${dispattrib} ; done</span><br />
<br />
3) Finally, one would check over these values and amend them as appropriate:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$ sudo amdconfig --set-dispattrib=<display type>,<display attrib to correct>:<correct value></span><br />
<br />
However, here's the problem with this method: if you're using RandR >= 1.2 (which you will be if you're running recent software), this procedure will fail with the following.<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$ amdconfig --query-monitor</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">Error: option --query-monitor is not supported when RandR 1.2 is enabled!</span><br />
<div>
<br /></div>
<div>
The next step was to work around this by disabling XRandR (by editing /etc/ati/amdpcsd
and adding <span style="font-family: "Courier New",Courier,monospace;">EnableRandR12=Sfalse</span> under <span style="font-family: "Courier New",Courier,monospace;">[AMDPCSROOT/SYSTEM/DDX]</span>, and by
adding <span style="font-family: "Courier New",Courier,monospace;">Option "EnableRandR12" "false"</span> under the Driver section of your
xorg.conf).<br />
<br />
Again, this has been superseded.<br />
<br />
The new solution, for cases where XRandR is >= 1.2, took me a while to figure out, and is surprisingly non-intuitive.</div>
<br />
There is a practically undocumented variable in AMD's Persistent
Configuration Store (PCS), used to store AMD specific driver settings.
It's called DigitalHDTVDefaultUnderscan, and if set to false, it
disables underscan completely.<br />
<br />
Following this procedure should remove the black border and restore your 1:1 pixel mapping:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$ sudo amdconfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">$ sudo reboot</span><br />
<br />
One
wonders what AMD was thinking, leaving such a common and important
task out of amdcccle, and without documentation. It's a serious oversight. <br />
<br />
As
for other secret PCS variables: you can find some in /etc/ati/amdpcsdb,
some in /etc/ati/amdpcsdb.default, and the rest are buried somewhere in
the output of <span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;">strings /usr/lib64/xorg/modules/drivers/fglrx_drv.so</span><br />
<br />
Not exactly what one could call intuitive. <br />
<br />
*Note that aticonfig is now called amdconfig.Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com2tag:blogger.com,1999:blog-1181837628516827235.post-85706525250274724282012-06-04T18:09:00.000+01:002012-06-04T18:09:01.417+01:00Raspberry Pi: Expanding the SD Card Partition<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCyM8eyUA8wf6Gjy40uoFI8zrdf2VBn-CW4FKdxPIuFL1GYnLHyWuIFfw93KMJH11p4hn8sR919EDXD8zpNKX-jOAEUYSq3elZr-REf6aA5-0tOD__zvaapatNscaXZ0wlM4E3gLpaDLU/s1600/RaspberryPiGrowImage.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="243" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCyM8eyUA8wf6Gjy40uoFI8zrdf2VBn-CW4FKdxPIuFL1GYnLHyWuIFfw93KMJH11p4hn8sR919EDXD8zpNKX-jOAEUYSq3elZr-REf6aA5-0tOD__zvaapatNscaXZ0wlM4E3gLpaDLU/s320/RaspberryPiGrowImage.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">32GB card with an expanded root partition and <br />an expanded swap partition</td></tr>
</tbody></table>
The Debian image for raspberry pi only totals 1.8GB; so, if your SD card is larger than 2GB, a lot of space will be going to waste.<br />
<br />
You can resize the partition directly via the Pi (the hard way), or you can take out the SD card and do it on another PC (the easy way). Let's do that.<br />
<br />
Insert the SD card into your other computer. Don't mount the SD card; or if it automounts, unmount it first. Install and open gparted (the friendly GUI for parted):<br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"># apt-get install gparted</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"># gparted</span><br />
<br />
find your SD card device using the dropdown menu in the top-right. It might be obvious which it is from the partition sizes, but if in doubt, check. You can refer to the system logs:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"># tail -n 1 /var/log/messages</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Jun 4 17:46:02 ace2 kernel: [321194.297736] sd 9:0:0:0: [<span style="color: red;">sde</span>] Attached SCSI removable disk</span><br />
<div>
<br /></div>
<div>
Once you've selected the device, you should see a fat32, and ext4, and a swap partition. </div>
<div>
<ul>
<li>the fat32 partition is the boot (/boot) partition</li>
<li>the ext4 partition is your root (/) partition</li>
<li>the swap partition is for swap space, but is by default unused by the Pi</li>
</ul>
<div>
You have various options here. To expand the root partition leaving other partitions untouched:</div>
</div>
<div>
<ul>
<li>select the swap partition, right-click and select Resize/Move. In the window that appears, drag the partition to the end of the available space, until "Free space following (MiB)" shows 0.</li>
<li>select the ext4 partition, right-click and select Resize/Move. In the window that appears, drag the arrow on the right of the partition to the end, until "Free space following (MiB)" shows 0.</li>
<li><i>ensure you have backed up any important data</i></li>
<li>click the tick to "Apply all operations". This may take a few minutes. </li>
</ul>
<div>
Now when you boot your Pi, your root partition should be considerably larger.</div>
<div>
<br /></div>
<div>
<b>Swap space</b></div>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-2o4Ya9GF6di69C71rIdSGJG1z2v-pSd7nemWBAGAWWzQqMRhQdFPh_Bt61ubcr-UNtQtv63HLT6VI8EYqJk2iMMBgZi5GpSL3SAaxt-xOIJ9m99TTVEGPfuBisPhBvgpBbby7apnSgE/s1600/RaspberryPiGrowImage2.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="243" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-2o4Ya9GF6di69C71rIdSGJG1z2v-pSd7nemWBAGAWWzQqMRhQdFPh_Bt61ubcr-UNtQtv63HLT6VI8EYqJk2iMMBgZi5GpSL3SAaxt-xOIJ9m99TTVEGPfuBisPhBvgpBbby7apnSgE/s320/RaspberryPiGrowImage2.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">4GB SD card with an expanded root partition and no swap</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
You are free to delete the swap partition instead of just moving it. By default, your Pi has swap space disabled, hence it is just wasted space anyway. </div>
<div>
<br /></div>
<div>
Alternatively, you can enable use of the swap space via the <span style="font-family: 'Courier New', Courier, monospace;">swapon</span> command or by editing /etc/fstab. I think the reason this isn't done by default is twofold:</div>
<div>
<ul>
<li>it will make heavy use of your SD card in terms of IOPs, thereby reducing its lifespan</li>
<li>random read/write performance is pretty poor for SD cards, hence this might slow you down considerably</li>
</ul>
<div>
I think it's best to leave swap disabled, and delete the partition if you see fit.</div>
</div>
</div>Anonymoushttp://www.blogger.com/profile/00094702734696077500noreply@blogger.com0