Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.


I'm trying to convert a .deb package to .rpm using alien, I use this command:

$ alien -r foo.deb

but it complains thusly:

> Warning: alien is not running as root!
> Warning: Ownerships of files in the generated packages will probably be wrong.

I think all alien needs root for is to guarantee that it has permission to create foo.deb's root-owned files for the foo.rpm output, but I'm not sure.


  1. Do packages always need some root-owned files?
  2. Why do they need root-owned files at all?
  3. If I'm wrong, why does alien need root?
share|improve this question
I didn't know fakeroot existed until you mentioned it. It works! –  kdbanman Jun 28 '14 at 20:44
See my expanded answer below. Note you can accept a question by clicking the arrow by the side of the answer. –  Faheem Mitha Jun 28 '14 at 20:51
In rpm this does not matter. You do not need to be root to create a rpm. –  Nils Jun 28 '14 at 21:01

3 Answers 3

up vote 1 down vote accepted

Rpm and deb packages contain archives of the files to install (cpio archives in the case of rpm, tar in the case of deb). These archives contain metadata about each file, including its name, modification date, owning user and group, and permissions. When a package is installed, each file ends up having the ownership described in the archive (unless a post-installation script modifies it).

Most files installed by packages are owned by root, because no user is authorized to modify them.

Alien converts packages by unpacking the archive and repacking it (as well as other things like converting pre/post-installation scripts). For example, to convert an rpm into a deb, alien calls cpio to extract the archive to a temporary location, then tar to build a new archive. If the unpacking is not done with root permissions, then all the temporary files will be owned by the user who is doing the unpacking, so when the files are packed into the new archive, they will end up being owned by that user.

Alien doesn't actually need to run as root since it doesn't need to modify anything in the system. Fakeroot runs alien (or any other command) in an environment where that command receives fake information about filesystem operations, pretending that operations that normally require root (such as changing file ownership) have succeeded. This way, the unpacking is done as root and sets correct file owernship (as far as alien and its subprocesses are concerned) and thus the repacking creates the intended archive.

share|improve this answer
Thanks for the detailed response!! You seem to know your stuff, so if I may... If I wget some foo.rpm as a non-root user, then isn't that package completely owned by that user? I assumed that ownership was assigned per-file by the package manager during extract/install as per the rpm spec file with directives like this: %attr(755, root, -) foo.bar. Because of this assumption, I thought that the only "permissions problem" that alien must solve is just translation of deb's spec format to rpm's, because the package manager doesn't care about archive ownership. Where am I wrong? –  kdbanman Jun 29 '14 at 3:19
@kdbanman alien translates by extracting the deb archive (which assigns per-file ownership) and then creating an rpm archive (using the per-file ownership). Why is it implemented this way? Probably because it was convenient, and good enough. Many things are good enough to solve the problem and no better, just because there was no need to spend more development time. –  immibis Jun 29 '14 at 5:17
@kdbanman The ownership of files contained in the package are recorded inside the archive (cpio or tar). For rpm, the %attr directives in the spec file determine what ownership and permissions the cpio archive will contain. The ownership of the package file (foo.rpm or foo.deb) doesn't matter. Translation of deb into rpm is precisely the problem that alien can't solve without running as root (given the method that it uses: it could use another method, but that would be harder to implement). –  Gilles Jun 29 '14 at 13:52
Interesting. I didn't know permissions were preserved by archives like cpio or tar. I guess I was assuming even more than I thought! Thanks so much guys/gals –  kdbanman Jun 29 '14 at 18:10

Use fakeroot. alien does not need root to manipulate some bits. The one-line description in the fakeroot man page adequately summarizes it:

run a command in an environment faking root privileges for file manipulation

So, fakeroot is a program that convinces the command in question that it is running as root, well enough that the file permissions are set as root where they should be. For more information see man fakeroot.

The error message you got there is unfortunately misleading.

In a nutshell, do

fakeroot alien ...

Here is a bug report where the author of alien, Joey Hess, discusses the need to use fakeroot. Probably not the best link. If I find something better, I'll post it.


share|improve this answer

Because to change ownership of a file requires 'root' privileges; not because the files necessarily need to be owned by 'root' - although many are.

Create a file in your home directory and try to change it's owner:-

touch test.txt
ls -l test.txt
-rw-rw-r--. 1 gareth gareth 0 Jun 28 21:24 test.txt
chown nobody. test.txt
chown: changing ownership of ‘test.txt’: Operation not permitted

Although I owned the file and have rw permissions, I can't change the owner.

sudo chown nobody. test.txt
ls -l test.txt
-rw-rw-r--. 1 nobody gareth 0 Jun 28 21:24 test.txt

But running it as root using sudo works.

As the warning says; ownership will be wrong. From that, we can assume that alien changes the ownership of some files.

System files are generally owned by 'root' with restrictive privileges so that mere users like you and I don't change or delete them.

There are also other users and groups on a system, but unlike 'root' they are not the same across distros. For example, under Fedora (and RedHat and CentOS) the Apache webserver runs as apache and the data files are owned by that user. On the other hand, I believe that Apache runs as www-data on Debian/Ubuntu systems and consequently, data files are owned by that user. This means that alien needs to change the owner of files when converting and to do this, as you can see in the example above, it needs to be running as 'root'.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.