[Mageia-dev] ANNOUNCE: The /usr move cometh! <---- Instructions

Colin Guthrie mageia at colin.guthr.ie
Tue Sep 25 15:19:07 CEST 2012

'Twas brillig, and Thierry Vignaud at 25/09/12 11:07 did gyre and gimble:
> On 9 September 2012 20:42, Colin Guthrie <mageia at colin.guthr.ie> wrote:
>>> Those cannot be done anymore.
>>> Now updating rpm in order to be able to sole the unifiedsystemdir depends
>>> pulls filesystem...
>>> Classic egg & chicken issue...
>> Yes, this has been a problem for a while now in Cauldron. But not many
>> users are asking this question these days, so the likely path now is
>> from mga2 -> cauldron which is probably where the effort should be focused.
> BTW I tested live upgrade from FC17 to FC18.
> It works smoothly if you don't have third party packages.
> in FC there's no need for a special boot, everything is hanled by filesystem
> package's pre/post scripts:
> $ rpm -q --scripts filesystem -v
> pretrans scriptlet (using <lua>):
> --#
> --# If we are running in pretrans in a fresh root, there is no /usr
> and symlinks.
> --# We cannot be sure, to be the very first rpm in the transaction list,
> --# so, let's create the toplevel symlinks here and the directories
> they point to.
> --# When our rpm is unpacked by cpio, it will set all permissions and
> modes later.
> --#
> if posix.stat("/usr") == nil then
>     posix.mkdir("/usr")
> end
> for i,dir in ipairs({"/lib", "/lib64", "/sbin", "/bin"}) do
>     if posix.stat("/usr"..dir) == nil then
>         posix.mkdir("/usr"..dir)
>         if posix.stat(dir, "mode") == nil then
>             posix.symlink("usr"..dir, dir)
>         end
>     end
> end
> return 0
> postinstall scriptlet (using <lua>):
> posix.symlink("../run", "/var/run")
> posix.symlink("../run/lock", "/var/lock")

We have pretty much the same script in our package if you look, but this
does not process the move transition itself (i.e. there is nothing to
move content from /bin to /usr/bin before rmdir'ing the dir and
replacing it with a symlink).

What this script achieves is to ensure that the filesystem layout is
correct when installing the very first packages e.g. in a chroot. This
is needed because some packages (not filesystem.rpm) may package a file
/bin/foo. rpm does not guarentee ordering of the package installation
transaction so if we install the foo package (which will trigger the
installation of filesystem) we cannot guarentee that filesystem will be
installed before foo and thus we need to prevent the creation of the
/bin dir that would happen if foo was installed first.

The comments in the script explain this pretty clearly.

Regarding what does the actual move of files, I cannot say but if it
happens automatically on a yum upgrade I'd certainly be interested to
know how it's done without breaking things... Also I'm surprised that
rpm let you do the upgrade as fedora have the same checks on their
filesystem rpm as we do (i.e. it refuses to install if the /bin +
friends are NOT symlinks)... so I'd be interested to know how this is



Colin Guthrie

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

More information about the Mageia-dev mailing list