[pacman-dev] dangerous symlink handling with --root option

Xavier shiningxc at gmail.com
Tue Aug 21 03:44:55 EDT 2007


On Mon, Aug 20, 2007 at 10:38:26PM -0400, Mister Dobalina wrote:
> Hi again,
> 
> (and sorry again for any split lines)
> 
> Okay, so I was fooling around with the --root option
> again, and after I realized from one of Xavier's posts
> that pre/post install scriptlets won't be run at all
> until /bin/sh (from bash) is installed, I figured I
> should install the packages twice. This led to two
> issues. I have a bash script (attached) that basically
> does:
>

I'm missing some basic *nix knowledge here :)
When I saw this problem, I added /bin/sh and /bin/bash
to my empty chroot, but it still didn't work.

Now, I just made an installation of filesystem and all its dependencies,
and it seemed to work.
The filesystem scriptlet complained though because grep was missing, but at
least it was run.


> pkglist=( ... bunch o' base packages ... )
> mkdir /tmp/pacman.test
> pacman -U --root /tmp/pacman.test ${pkglist[*]}
> pacman -U --root /tmp/pacman.test ${pkglist[*]}
> 
> The second install of coreutils causes:
> 
> error: cannot remove file
> '/tmp/pacman.test/usr/bin/sleep': Read-only file
> system
> error: failed to commit transaction (transaction
> aborted)
> error: failed to release transaction (could not commit
> transaction)
> 
> First Issue: CPU usage then goes to 100%, so I assume
> that pacman has gone into an infinite loop somewhere. 
> 

I think this is the same issue as described there (in the quoted mails) :
http://www.archlinux.org/pipermail/pacman-dev/2007-August/009084.html

ie, when a -U operation failed, pacman always looped when trying to
unregister the databases.
My fix has just recently been pushed to git.

> Second Issue: the real concern is the "Read-only file
> system" error, since /tmp is on a tmpfs and is
> definitely not read-only. My / partition is read-only
> though, and
> 
> # ls -l /tmp/pacman.test/usr/bin/sleep
> 
> lrwxrwxrwx 1 root root 10 2007-08-16 16:13
> /tmp/pacman.test/usr/bin/sleep -> /bin/sleep
> 
> So pacman was following the absolute symlink *out* of
> the --root and trying to remove /bin/sleep from my
> main arch install ??
>

Hmm, the question I would rather ask is wtf is that symlink in the first
place ?
sleep isn't a symlink here, it's a regular file.
But even then, all other symlinks I've in the --root are correct, they don't
point to somewhere outside it.

$ ls -l foo/bin/sh
lrwxrwxrwx 1 root root 4 mai 15 21:14 foo/bin/sh -> bash*
$ ls -l foo/bin/sleep
-rwxr-xr-x 1 root root 14380 aoû 16 22:13 foo/bin/sleep*

But I'm also curious about your question.. Looks strange that pacman follows
that symlink.




More information about the pacman-dev mailing list