posted on 2014-10-21
For a little while, I've been wanting to write an introduction to Wine. Wine is not an emulator, so do not call it one. Or else, terrible things will happen. Wine is "a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, Mac OSX, & BSD". It isn't perfect but it works often. You might still have to boot under Windows from time to time but it will help to minimize these. Of course, Wine is free software (as in free speech). Let's see how to use it.
You'll need a few tools. Lets' start with wine.
You probably don't have a lot to do: your OS probably already integrate a package manager or port system that alreay includes wine. Just install it. ;)
Mac OSX doesn't come with a serious package manager or port system. However, third party software exist. You can either use Netbsd's pkgsrc, on which you can find OSX tutorials here, or Macports.
Why would you want to do that? Because Wine has a better compatibility list than any individual version of Windows.
Winetricks is a script that allows you to get Windows ressources such as libraries, runtimes, fonts, etc. It's very useful if not necessary.
Your package manager or port system might already have a package. If it doesn't you can simply download it here.
Those two are Wine's usual way of dealing with the need of Internet Explorer and .NET. Gecko is Mozilla's engine used in its software like Firefox; Mono is an open-source implementation of .NET. There are two wine packages that contain these and are included as packages or ports into distributions, generally with names such as "wine-gecko" and "wine-mono".
You do not need to download these per-se as Wine is able to download them but it's practical to already have them installed.
To launch windows binaries simply call it with wine like this:
wine mySyperSoftware.exe
That's about it. Of couse, things are always more complicated than they should be.
A lot of Windows software require specific libraries, specific registry keys, either the wine implementation of a library or its windows implementation. Often these pre-requisites will conflict, making you unable to use one piece of software once you've configured another. Thankfully, there's a solution.
Wine prefixes or bottles are basically your fake windows installation used by one. They contain your registry, your installed programs, your configuraiton files, etc. The default one is stored in ~/.wine
.
How to use another one? It's easy. You need to use the environment variable WINEPREFIX
.
Example : WINEPREFIX=/path/to/my/wine/prefix wine mySyperSoftware.exe
To just create a prefix, use the wineboot
command.
Example : WINEPREFIX=/path/to/my/wine/prefix wineboot -u
(-u is for --update)
You can of course, export this environment variable to make it permanent for the session.
export WINEPREFIX=/path/to/my/wine/prefix
I'd recommend to either store all your prefixes info a ~/.wine-prefixes
folder or to use a naming convention in your home. I usually create ~/.wine-softwareName
folders in my home as prefixes. Remember that you do not need to manually create the folders as Wine will create them for you.
For the rest of this article, I will use ~/.wine-example
as my example prefix.
If you are running a 64-bit system, it is likely that your wine installation has been compiled with 64-bit support. Unfortunately, it tends to not be appreciated by the Windows software you'll be using. You will need to you a second environment variable : WINEARCH=win32
. If you use prefixes, you just need to precise it at the prefix creation.
WINEPREFIX=~/.wine-example WINEARCH=win32 wineboot -u
will create a 32-bit prefix.
Also, make sure you have 32-bit versions of the libs that wine will need, like your graphic card drivers or your sound libraries for instance.
Inevitably, there will come a time, when you'll need to install some libraries. Some of them are harder to install than others. Thankfully, winetricks a a nice wrapper that will make everything easy. I will assume that winetricks is in your PATH, to make the example shorter and more readible. If it's not, just run the script with its path. It has a lot of parameters so take some time to play with it. Here are a few examples of useful commands :
winetricks --help
will display some help.
winetricks list-all
will display everything that you can install. Use grep to search through it.
For example: winetricks list-all | grep -i directx
will look for directx.
winetricks corefonts vcrun6
will install the corefonts and vcrun6 packages.
Of course, make sure that you have set your prefix via the environment variable or else, it will use the default prefix.
I like to be able to launch my wine programs with a simple command. That's why, I've added to my PATH a ~/.wine-scripts
where I keep launch scripts for my programs.
Here's my template:
~~~
export WINEPREFIX=/home/reihar/.wine-mySuperSoftware
cd "/home/reihar/.wine-thief/drive_c/Program Files/Steam/mySuperSoftware"
wine mySyperSoftware.exe ~~~
The Wine Application Database or Appdb, is a compatibility repository that contains test results and instructions on how to run software with Wine. It's community-driven so everyone can contribute.
Read test results, howtos, frequent isues and a few comments and you'll have a good idea on what to do.
I've briefly mentionned mono earlier. Although you can use mono in wine, you might want to try to run .NET applications using mono directly before using wine. It works pretty often.
I don't really have a conclusion. Try using wine. It's cool and relatively simple ;)
posted on 2014-04-07
Recently, I've been wanting to build package for my not very powerful eee-pc laptop. I just have one problem: all my computers except this one are use a 64bit architecture instead of a 32bit one. So I needed to make a chroot. So, instead of doing that I decided to play a little with systemd containers. Here is what I did.
I've decided to do that in my home folder. First, I made a copy of my /etc/pacman.conf
, called pacman-i686.conf
, in my home folder with the architecture explicitely stated as i686. So I've changed this line:
Architecture = i686
Then, I've installed the extra/arch-install-scripts
package.
After that, I created a folder and used pacstrap
to install a basic arch in it using my custom pacman-i686.conf
file. I use sudo because I'm lazy but you can do that using your root account, you just need to change your paths accordingly. Also, please disable the multilib repository, it won't work.
sudo pacstrap -C ~/pacman-i686.conf -c -i -d ~/i686 base
The first option, -C ~/pacman-i686.conf
will allow you to choose a pacman.conf
different than your host's /etc/pacman.conf
, the second one -c
uses the host's cache instead of the target's so that you can remove it more easily later and managing like the rest of your package cache. The -i
option will disable auto-confirmation of packages so that you can choose what you install. And last, the -d
option allows you to chose a non-mountpoint directory.
Simply use that command, the same thing about paths, sudo and root stays valid.
sudo systemd-nspawn -bD ~/i686
It is now working. Login as root, there is no password. You might now want to install stuff, build packages, etc.
For some weird reason, my guest pacman.conf
architecture was set on auto and it tried to install 64bit packages, probably due to my host, be sure to change it to i686. Make sure to synchronise your pacman databses with pacman -Syy
to make sure you don't have any x86_64 packages.
The first step we have to do is to symlink the container to /var/lib/container/. Again, paths, sudo, root.
sudo ln -s ~/.i686 /var/lib/container/i686
I had to create /var/lib/container
.
Now, you can see your container using machinectl list
. Don't mind my prompt.
``-> % machinectl list MACHINE CONTAINER SERVICE i686 container nspawn
1 machines listed.``
You can now do fun stuff. man machinectl
Remember that you need to launch the machine using systemd-nspawn. Like that in the case of our example :
sudo systemd-nspawn -bD ~/i686
You can also use systemctl to launch the machine. Just use sudo systemctl start systemd-nspawn@MyContainer.service
, in our case, the service is systemd-nspawn@i686.service
. It will start and be listed in machinectl's list. You can also enable the service to start it with your computer.
Mostly Arch's Wiki, pacstrap --help
, and man machinectl
posted on 2013-12-21
A few days ago, I was having trouble with some powerpoint documents I was given. I needed to read them on my netbook while traveling. The problem was that my netbook is a magnificent Asus eeePC 701 which, of course, isn't powerful enough to run libreoffice. So I had to convert them, but with what ? I didn't want to use Libreoffice to open each documents and export them to pdf : there was a dozen of them ! And then, I discovered libreoffice headless mode.
Documented almost nowhere and hidden inside the libreoffice man, there is this option : the headless (Without GUI) mode. So how do you use libreoffice headless mode ? It's pretty simple. Open and terminal and type :
libreoffice --headless anyParameterYouWant
File conversion ?
libreoffice --headless --convert-to DestinationFormat[:OutputFilterName] File…
So if you want to convert all your .ppt files in your lol folder into nice .pdf files, you just have to type :
libreoffice --headless --convert-to pdf lol/*.ppt
So, what is this OutputFilterName ? Well it's apparently the name of the dialog used for export. Normally, you shouldn't need it but just in case here is all the informations that I could find on it :
Libreoffice's documentation being what it is, I was unable to find anything in it. However, I found a list from Open Office 3.0's (So, before the fork) documentation.
May the Force be with you.
What can you convert to what ? Basically, you can import anything that libreoffice an import and export it to anything libreoffice can export.
Once again because of the magnificense of libreoffice's documentation, I invite you to read the list I previously gave.
May the Force be with you.
In order for your batch conversion to work, you need not to have a libreoffice instance already running. That's kind of bothersome, you know. What if you want to work on your thesis (although, you must be crazy to want to write a thesis using Libreoffice ( or Open Office, or Microsoft Office), you should use serious tools like LaTeX) and convert a batch of documents at the same time ? Well, if you don't know this trick, you are doomed.
In order to acomplish this, once again, poorly documented trick, you need to use a libreoffice environment variable to make libreoffice use another profile. You need to add the following command parameter into the mix
-env:UserInstallation="file://path/where/you/want/your/profile/to/be"
For example, this will create a hidden .libreoffice-alt folder in your home :
-env:UserInstallation="file://$HOME/.libreoffice-alt"
And then, the whole command :
libreoffice --headless -env:UserInstallation="file://$HOME/.libreoffice-alt" --convert-to pdf lol/*.ppt
Ok, I think it is time to make this easier to manage.
Now is the time when you start thinking I am mad. Maybe I am, however, if you continue reading a little while, you will understand why it is not such a terrible idea.
Libreoffice offers an API that allows to use UNO to connect and do certain tasks such as file conversions. So, to launch a listening instance of libreoffice you need to add this parameter :
--accept="socket,host=127.0.0.1,port=PORT;urp;StarOffice.Service"
Continuing the example :
~~~ libreoffice --headless -env:UserInstallation="file://$HOME/.libreoffice-alt" --accept="socket,host=127.0.0.1,port=8100;urp;StarOffice.Service --convert-to pdf lol/*.ppt ~~~
Notice the StarOffice.Service. I have absolutely no idea why.
So, let's make this into a proper service using, of course, systemd.
This is an dirty but working systemd unit file that is licensed under the WTFPL
You can place the unitfile into /etc/systemd/user/
or ~/.config/systemd/user/
. For the sake of my example, I will name it libreoffice.service
~~~ [Unit] Description=Libreoffice UNO acceptor
[Service] Type=simple ExecStart=/usr/bin/libreoffice --headless -env:UserInstallation="file://$HOME/.libreoffice-alt" --accept="socket,host=127.0.0.1,port=8\ 100;urp;StarOffice.Service"
[Install] WantedBy=default.target ~~~
Now, you need to connect to this UNO acceptor. I recommend you a program called Unoconv. Originally created for Open Office, it works perfectly fine with Libre Office. Normally, your UNO acceptor should be automatically recognized, if not use the -c "connectionString"
parameter.
In order to convert a document you need to use the following syntax :
unoconv -f FORMAT file…
Easier than that, don't you think ?
libreoffice --headless -env:UserInstallation="file://$HOME/.libreoffice-alt" --convert-to pdf lol/*.ppt
Libreoffice can convert documents using cli. You need to specify a custom environment to do so while using libreoffice to read or edit documents. You can even run a service that way, of course, with systemd too. Oh and Unoconv is a software with a clear syntax but it cannot run if you have another libreoffice instance so you need a service with a custom environment.
Oh and if you need to write serious documents, do yourself a favor and use LaTeX.
I had to do a lot of researches to write this article so here are the pages that were pertinent.
posted on 2013-09-21
EDIT 2014-08-25: I added a few links.
I love books. I love books a lot. I've loved them since I was a little kid. My parents read me books before I went to bed. They read books for pleasure. So naturally, as a kid I wanted to read books. I was really happy to learn to read. Because guess what, books are awesome. And with a few francs you could get a library card that would grant you an unlimited amount of stories, adventures and fun. Then I grew up and added blood, sex and philosophy into the mix and books were awesome and mature. So yeah, I love books, but how is that interesting?
Well, it's not. It's my personnal life and this is not some teenager's tumblr. I guess, I could make that interesting by writing book reviews, but not today. I however have relatively interesting things to say about the interaction between books and technology but before talking about that, I'm going to bore you a little more with my life.
I am a child of the Internet. At some point after my tenth birthday (I don't remember exactly, not that it's important), my family bought a computer and got an Internet Access. I ended up being its main user. As a result, I grew up with the Internet. It affected the way I perceive technology, art, and even life. It is part of who I am and it is the core of how I conceive and deal with Information. When I talk about art, until recently, there was one medium which was an exception : books. Movies, I could download. Series, I could download. Comics, I could download. But books ? I borrowed and bought books made of paper. Of course, I've always imagined that we would have some cool datapads in the future but I've never imagined that this future would be now.
Because, here we are, 2013 and accessible ereaders are a reality. It has been the case for a few years actually. For the price of 17 books, you can get an ereader which can store hundreds. So, everything is wonderful, right? No.
By the way, just because this article is pretty long and has a lot of headers, here is a table of contents :
First, let's talk about how ebooks are awesome, especially with an ereader (a non electronic paper ereader is not an ereader, it's a tablet). They are simple and structured. You never lose your page, since the bookmark is saved inside your ereader. No more bookmarks blown away by the wind ! And you get to play with your display. You can make words bigger and change the font. Plus, you can carry thousands of them in a device and sort them by author, genre, series, and etc. You can read any book of your entire library which you can easily organize using awesome software like Calibre. How could I not fall in love with ebooks?
I hope that you didn't think that anybody would come and spoil everyone's fun, right? No ? Good. Well, Adobe did(They're not the only ones, just the ones that are affecting an open standard in the most harmful way), producing a wonderful DRM, or as I like to call them digital handcuffs (Why).
I would just like to remind you that it is not Adobe's first time.
(Warning, I know I am referring to an apocryphal quote. Do not send me emails about that.)
So what about Amazon ? They surely didn't fail at noticing the importance of ebooks. They even were the first ones to become popular with their Kindle. Well, unfortunately, Amazon is not your friend. On their platform, they have so much power over the user that is would give Stalin wet dreams. Basically, they give themselves the right to collect data on the users as well as deleting content on their customers' devices. Of course, for maximal irony, it had to be George Orwell's books.
Would you trust Amazon ? I wouldn't.
Of course, blaming Adobe or Amazon for creating digital handcuffs would be like blaming Einstein for the creation on the first Atom Bomb : it would be stupid. They are just tools. Those who use them are responsible for the consequences of their use, not the makers of the tools.
Publishers are responsible for the use of DRMs. Sometimes authors too but most of the time they don't have any choice, or they are not aware of the consequences of selling a book with DRMs.
DRM are intrinsically bad. They are arbitrary limitations on files. Like on which devices you can use them. How many time you can read them ? How you can modify the file ? Who can read the file ?
When are you supposed to read a book ? Whenever the fuck you want ! How are you supposed to read a book ? However the fuck you want ! How many times are you supposed to read a book ? As much as you fucking want !
And about that last question : yes, books are meant to be shared. You can lend it to friends, family. You can, as you read it, hand it over to your friend and say, look at that paragraph, it's hilarious ! So why should you not be able to do that with ebooks ? Because they are files ? Because every time you give the file to someone it's actually an identical copy ? I call bullshit ! You cannot stop people from doing that or else they will just bypass it. Come on ! What's going to stop people from using a search engine, going in the first result and downloading some crappy freeware that will remove those DRMs ? Nothing !
Also, will these ability really kill books ? Or aren't just people going to continue to buy them, especially if they were as cheap as they would cost. Why not set the ebook price to the double of the authors' and publishers' margin ? It would be incredibly cheap. As well, isn't the satisfaction of knowing that the author you like will earn money and be able to write more books if you buy it a compelling enough reaon to buy a book ?
Anyway, I'm giving you a tl;dr for this part : DRMs are evil and pointless.
So, yeah, am I not an idealist by thinking that this situation could evolve positively ? Maybe. I hope that one day, publishers will realize how pointless it is to lock their contents. It might however be possible, by putting pressure on publishers, by sensibilizing writers to that question ; simply, by bringing light into darkness. It is unlikely yet still possible so I think it is worth trying.
Ok, now that I have been boring about the threat of DRMs, do I have any alternative to propose. As a matter of fact, I do.
First, do not underestimate the power of the Dar… I mean Public Domain. There are numerous project of digitalization of Public Domain work, here is a list :
Here is a list of public domain books in French language. It might be of limited usefulness but I'm posting everything I have here.
You can also find respectful publishers. Most of them are small companies but usually offers fair prices as well as DRM-free ebooks. This is not an exhaustive list, just a list of those I stumbled upon.
The FSF is also maintaining a list of DRM-free ebooks here : I strongly advise you to look into it. It is interesting.
So now that I've talked about files, I'm going to continue with the physical part : ereaders. Remember earlier when I told you about the deletion of George Orwell's books from amazon's devices ? Well, if you do not want that to happen to you, the devices that you use should matter to you. It is important; if there is a store on the device you plan to purchase, you must carefully read the terms of use. To be simple, don't buy Amazon's Kindles, Barnes and Nobles's Nook or the Kobo ereader. As for Sony, e-readers, I don't think it's the case, but my reading of their terms of use was quick.
However, there are brands that I am sure of the quality. Those are Pocketbook, Booken, and Onyx International. They offer good quality ereaders, for a decent price, with great features. They are pretty easy to find in Europe, however, if you live in North America, I wish you good luck. I could barely find some models from them. But you still should try if you're interested.
The ebook situation is mess, full of evil DRMs, thanks to evil publishers and evil platforms. Most ereaders are full of DRMs too and will delete your books if their overlords tell them to. However, there are some good publishers and good manufacturers of ereaders, and public domain. So not all hope is lost.
By the way, I'm joking with my overusing of the word evil. However, you might want to consider the position of the following action on your moral compass : sacrificing the interest of humanity for money.