Between Linux and Anime

Kind of like Schrodinger's Cat

Tag: Tech (Page 4 of 8)

Running Graphical/GUI programs from rooted terminal on Linux

Everywhere across the Internet you’ll find “answers” to this question that tell you to do gksudo and kdesu and if you’re like me you get by by working around your problem in some way that lets you gksudo or kdesu – until that one time when it just doesn’t cut no matter which way you slice it. That time is now for me, and what a surprise, it’s a damn pain in the neck to actually dig out a solution from amidst the mountain of “use gksudo/kdesu”s.

So here’s me penning this post to hopefully help combat the million other gksudo/kdesu posts out there – because sometimes, you need stuff run – graphically and as root – when you’re not around to type a password.

Solution is surprisingly simple. Your X display is normally loyal only to you (the user) and will not answer to any other user, not even root. If you tried to run a graphical application from a rooted terminal, it’ll say something like the following:

X11 error: Can’t open display :0

Which is your application’s plaintive cry at being shut out by X. So to get around this, you basically just need to tell X to stop doing that. Like so:

xhost +

Run it as your regular user (X normally ignores everyone else remember?). And that’s it! Try it. Open a terminal, su, and open firefox or something.

PS: yes I’m not dead yet, and yes I still haven’t finish that blasted Eva post I’ve been sitting on for ages ;_;

1149
Rate this post
Thanks!
An error occurred!

Fixing sound problems on “Ori, Ochi, Onoe” (and other old renpy games) on Linux

Well that was an unwieldy title, but I had been googling hard for this and have basically turned up blank. Now that I’ve worked out a solution, I’m gonna make it as discoverable as I can.

Problem: I was trying to play “Ori Ochi Onoe“, a 2006 short visual novel created with renpy that had some good word going around for it. I played through a good part of it (on my linuxbox of course) having the overarching impression that while the writing was not bad, something was off – it was dullish, not atmospheric enough. I later discovered the problem – sound, and thus BGM, wasn’t working!

Solution: I guessed that the game, being from 2006, probably used python libraries/bindings that are dated and that don’t play well with a modern linuxbox’s sound stack (the linux sound stack is a terrifying can of worms, what else is new). Thus I conjectured that if I were to replace the python binary and its libs with a newer version from a newer game (renpy games ship with all their libraries in the package), that might do the trick.

And it did!

What to do:

  • Find another renpy game, a recent one that works, for example the Katawa Shoujo demo.
  • Remove (or move) everything in o3-linux/py4renpy-2.3.5-5.5.4.

    cd o3-linux/
    mkdir backup
    mv py4renpy-2.3.5-5.5.4/* backup/

  • And copy the contents of the lib/ folder of the new, working renpy game into py4renpy-2.3.5-5.5.4.

    cp -r ../Katawa\ Shoujo\ Act\ 1\ v4-linux-x86/lib/* py4renpy-2.3.5-5.5.4/

  • Done! Run o3.sh and enjoy!

Renpy?
For the uninitiated, renpy is a free software Visual Novel engine. Games created with renpy can be targetted at Windows, Mac, Linux, and more recently Android. (There is some sketchy support on the N900 too). There are a pretty large amount of games out there and most of them are free. It’s pretty hard to find good ones though. If you’re interested, Ori, Ochi, Onoe and Katawa Shoujo (links above) could get you started.

Omake: I’ve been working to get renpy games to work in a satisfactory way on my tablet. It’s harder than one would expect – it’s linux and it runs, but full screen mode doesn’t seem to work properly with touch, and crashes Kwin every now and then. Plus my tablet only has 600px of vertical space, which is exactly equal to the vertical window size of most games, so I had to do some Kwin window rules and custom settings to get it to appear over the top panel and thus use the full vertical space. I think I’ve more or less nailed it though:

Ren’py atop Plasma Active!

Summary of what needed to be done: get rid of window decorations, set “Keep above others”, and position it so it covers the top panel. I made a set of Kwin window rules to automatically set all these parameters on startup.

1145
Rate this post
Thanks!
An error occurred!

I’m just gonna leave this here

Yes, that is Plasma Active, and yes I am the fresh owner of that tablet. Don’t ask about the hole in my pocket. It’s a Viewsonic Viewpad 10 that came with Android and Windows 7. Well, it runs Android and Plasma Active (on OpenSUSE) now ;)

Also I just enrolled for this AI class. Coolbeans.

A little swamped right now, and as is often the case during times when I am swamped, lots of interesting things are going on and I’m itching to write stuff. Time however, is scarce :( We’ll see what happens.

(Linux + Touch = <3 <3 <3)

1144
Rate this post
Thanks!
An error occurred!

Dealing with “cmake/modules/FindKDE4Internal.cmake not found”

Not the most intuitive error message ever:

CMake Error at /usr/share/cmake/Modules/FindKDE4.cmake:98 (MESSAGE):
ERROR: cmake/modules/FindKDE4Internal.cmake not found

and the exact problem wasn’t immediately obvious to me, even after having dabbled in CMake-ing and KDE-ing for some time. Anyway, problem is simple – you’re missing some KDE development stuff. For me (OpenSUSE) I had to install the kdebase-workspaces-devel package. Look for something similar in your repositories and install it, and you should be good.

1132
Rate this post
Thanks!
An error occurred!

“The host key for this server was not found, but another type of key exists.” When using sftp with dolphin/KIO

I’m halfway through my Cosfest X.1 event post, but I bumped into yet another funny issue while working today, so I’m gonna do another quick solve-it post here. If you ever had the following error message shown to you when attempting to access an sftp location via dolphin or KIO in general:

“The host key for this server was not found, but another type of key exists. An attacker might change the default server key to confuse your client into thinking the key does not exist. Please contact your system administrator.”

This might be for you. In particular if you have successfully ssh-ed into the target host before. Following the discussion here, it appears that the problem, in summary, is KIO not being able to recognize a particular (new?) format of specifying a host in the ssh known_hosts list (a bug which has been filed here). Fortunately there is a workaround – since KIO is unable to recognize the known_hosts entry that ssh produces, we simply need to get KIO to be the one to produce the entry.

Back up your ~/.ssh/known_hosts file, then open it with your favorite text editor. Find and remove the entries associated with the host you’re trying to sftp into. If you cannot find it you can just delete everything in the file – with the side effect that you will be prompted again to add the keys back the next time you ssh into a previously known location. When you’re done, open dolphin and attempt to sftp into your desired target location. It should prompt you to add the host’s key – just tell it yes and you should be able to log in successfully.

That’s it! From then on you should be able to direct ssh or sftp-via-KIO into the location whenever you want.

1117
Rate this post
Thanks!
An error occurred!

Smplayer UI hanging after update in OpenSUSE?

Just gonna pen a quick note. Smplayer, the pretty great Qt-based frontend for mplayer that I use, started behaving strangely after I performed a recent software update. Symptoms are – video plays, but does not respond to common keyboard commands like ‘f’ to full-screen and arrow keys to skip. Also, the GUI becomes unresponsive – you can’t click anything. I didn’t spend too much time looking up the source of the problem, but it may be related to this.

I’ve discovered you can workaround this annoying problem by installing mplayer2 and then configuring smplayer to use that instead of mplayer. Simply install mplayer2 via yast or via

sudo zypper install mplayer2

Then start smplayer (without arguments! If you load it with a video the UI will freeze!) and go to Options > Preferences > General > General and key in “mplayer2” for the field “Mplayer executable:

While there are some differences between mplayer2 and mplayer, everything appears to work fine using it with smplayer so far, so I’m pretty happy.

1116
Rate this post
Thanks!
An error occurred!

The nightmarish “Linux won’t boot, Not even the LiveCD”

Had the hands-down biggest computer scare today since switching to Linux several years ago. I remember boasting to my friend just weeks ago that Linux has never gone down randomly on me all these years, whereas random (and terrifying) system failures are something I wrestle with regularly during my old windows days. Of course I don’t mean Linux has never screwed up period don’t be daft – any self-respecting Linux geek must have wrecked their setup in one way or another before, but that’s different. That’s you, the geek, wrecking the box while feverishly working towards some geeky end or another. That’s not the same as random failures. That’s not the same as leaving the computer last night in a comfortable state and waking up today to find that the thing won’t boot. That’s never happened before with my Linuxbox.

Well, until this morning. 2 hours ago everything is fine. 2 hours later, hang during boot. And I haven’t done any kind of questionable hacking in days, and have no clue what might be wrong. Whats even more terrifying – I can’t even boot a live system – what?? Scared me shitless. I then tried booting into Windows (I dual-boot), and it apparently detected problems with the disk and automatically started a disk check. That’s even scarier, if the problem is with the disk my data could be screwed! My laptop isn’t even a year old too. It finished successfully though, apparently fixing records here and there, and then Windows booted okay. I tried Linux again – no go. Live Linux – no go. I tried doing failsafe boots and did some haphazard googling to no avail. Fast running out of ideas, I decided to boot back into Windows and try and look up whether or not Gparted (my most trusted partition utility) would run on Windows. Well, apparently not, you need to make a live image of it.

Despair!

And then!

I dejectedly restarted my computer….. and Linux booted. Just like that. I’m currently typing on the revived system, which is working, by all appearances, perfectly normally.

What have I learned from the episode? Nothing. Well, nearly nothing. I have next to no idea what went wrong, but next time my Linux and Live system won’t boot, I’ll just reboot windows multiple times then try again. I’m not even gonna put this post in the ‘howtos’ category, but I’ll leave this here and see if it might help the next guy to desperately google “Linux won’t boot, Not even the LiveCD”.

My speculation? Well, the only clue was that Window’s chkdsk fired and fixed some things, so presumable the NTFS partition got a little corrupted. Maybe Linux hung on trying to mount the corrupted partition. Maybe it takes two reboots into Windows before all the chkdsk fixes go in effect. Yes, I’m just gonna conveniently blame Windows and NTFS.

1110
Rate this post
Thanks!
An error occurred!

Custom Textures for the Kwin Snow Plugin – the Hacky way

Now I am and have always been a fan of the compiz snow plugin. I remember spending some of the earliest days of my Linux life haphazardly getting bombastic desktop effects running and joyfully ignoring how many of the plugins were in the “Bad” list. Those were the days. I sit on KDE’s elegant Plasma nowadays and although Kwin also sports a (not so “Bad”) snow plugin, it has never quite lived up to the compiz version that I knew and loved. Over the years it has matured and stabilized quite a bit, but the key feature that’s still missing for me is being able to swap snow out for autumn leaves and sakura petals – custom textures.

Not entirely sure why, but the other day it just suddenly hit me that hey, it shouldn’t be that hard. There’s a texture stored somewhere that Kwin uses – I just need to find and replace it right? Turns out that was precisely right. The snowflake texture used by the plugin is

/usr/share/kde4/apps/kwin/snowflake.png

So how do we use a custom one? Find a png image to use as custom texture, and simply rename it “snowflake.png” and copy it into /usr/share/kde4/apps/kwin/! Do backup the old one first though just in case. After you’ve done that, disable the plugin, click apply, reenable it, click apply, and when you toggle the snow it should descend with your custom texture.

Here’s a screenshot where I use this leaf to create lazily descending autumn foliage:

Photobucket

Next step would be to find time and see if I could write a patch to make a non-hacky way to do this :)

1109
Rate this post
Thanks!
An error occurred!

K4DirStat – KDirStat has a platform 4 port!

Interestingly enough, in the wake of the recent spark of talk on “missing” KDE 3 apps that never made it to platform 4, I’ve discovered that an app I had always assumed was “missing” (or at least late-to-the-party-and-we’re-still-waiting) is in fact, not. Well, not really.

KDirStat is this really great disk usage analyser that I’ve used all the way since I was on Gnome in my early Linux days. An extremely handy utility for figuring out what is using how much of your disk during hard disk spring cleaning operations, and one that is so good at its job that I haven’t been able to find a replacement. And it’s a KDE 3 app. One of those awesome KDE 3 apps (actually, by now, the only one remaining) that I use and still use even though I have never run KDE 3 (and even though KDE 3 apps look even worse than gtk apps on the Plasma Desktop these days). So imagine my surprise when I discovered that KDirStat, in spite of its “in progress” status in the KDE 3 Application Porting Status page, actually has a KDE platform 4 port called K4DirStat:

And indeed not one that is buried in the danger-fraught lands of developer previews, but one that has apparently been packaged and released by Fedora since Fedora 13, which likely means it does not in fact eat babies and is deemed suitable for general consumption.

The catch, of course, is that it is only currently packaged for Fedora, to the best of my knowledge.

A shame really! It’d be great to get this reviewed and eventually integrated into upstream KDE, since it doesn’t look like the original developers or anyone else is presently working on a port (are they?). This doesn’t look like it’s gonna happen anytime soon though, considering it hasn’t happened in the whole year since the port became available, and considering how the last post on the author’s blog is dated early August last year. I wonder how much of the KDE community is even aware that this port exists. That last at least should hopefully be fixed now :P

Well, some voices and hands will probably be needed to make things happen. Of course, those voices and hands could be mine, but I’m a little tied down at the moment. We’ll see =/

Oh, in the meantime interested users on non-Fedora platforms can just build it on your own. Quoting instructions from the author’s blog:

The source is being tracked with git. You can get an up-to-date copy with the command

git clone http://grumpypenguin.org/~josh/kdirstat.git

To install, simply run:

cd kdirstat
mkdir build
cd build
cmake ..
sudo make install

OpenSUSE users can also add this repo to install it via Yast.

1084
Rate this post
Thanks!
An error occurred!

Ubunchu 07 ~ Installfest!

Tada! Ubunchu as it turns out is still alive and kicking! Albeit in the same somewhat constipated way my own blog ekes its existence. It looks from the mailing list like the terrible beast called real life has also been wreaking havoc and slowing things down over there, and so in the long time that I had been too busy to check back, only one new chapter has been released. And it’s chapter 7 instead of 6 too! Apparently the author wanted to put some extra touches on 6, and so released 7, which was ready, first. Grab it here if you haven’t.

Nom nom nom

Anyway in this chapter our awkward trio of Sysadmin club members decided to hold an installfest, which as the name suggests is essentially an event where people get together to help each other (in particular new adopters) with setting up their Linux boxes.

Read More

1069
Rate this post
Thanks!
An error occurred!

Page 4 of 8

Powered by WordPress & Theme by Anders Norén