IBM / ibmichroot

A set of scripts to facilitate the use of chroot-based containers for IBM i
MIT License
21 stars 9 forks source link

yum, missing directories #41

Closed abmusse closed 8 years ago

abmusse commented 8 years ago

Original report by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


Finally got to test your yum work today. Very exciting.

I am following the yum/README.md and get the following when running setup_all.sh

(partial paste of larger output)

**********************
yum --version
**********************
PATH=/opt/freeware/bin:/QOpenSys/usr/bin:/QOpenSys/usr/sbin
LIBPATH=
3.4.3
Could not set cachedir: [Errno 2] No such file or directory: '/var/tmp/yum-aaron-gJ3BNs'
Traceback (most recent call last):
  File "/opt/freeware/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/opt/freeware/share/yum-cli/yummain.py", line 288, in user_main
    errcode = main(args)
  File "/opt/freeware/share/yum-cli/yummain.py", line 98, in main
    base.getOptionsConfig(args)
  File "/opt/freeware/share/yum-cli/cli.py", line 280, in getOptionsConfig
    for pkg in sorted(self.rpmdb.returnPackages(patterns=yum_progs)):
  File "/opt/freeware/lib/python2.7/site-packages/yum/rpmsack.py", line 618, in returnPackages
    self._makePackageObject(hdr, idx)
  File "/opt/freeware/lib/python2.7/site-packages/yum/rpmsack.py", line 1272, in _makePackageObject
    self._cached_rpmdb_mtime = os.path.getmtime(rpmdbfname)
  File "/opt/freeware/lib/python2.7/genericpath.py", line 62, in getmtime
    return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '//var/lib/rpm/Packages'

Some ls commands:

bash-4.3$ ls /var/tmp/yum-aaron-gJ3BNs
/var/tmp/yum-aaron-gJ3BNs not found
bash-4.3$ ls /var/tmp/
/var/tmp/ not found
bash-4.3$ ls /var/
cache  lib    opt    var
bash-4.3$ ls /var/var
lib  log  opt  tmp

Doing the following fixed the issues:

mkdir -p /var/lib/rpm/Packages
mkdir /var/tmp

I then had this error:

touch: /var/log/yum.log cannot create

And the following fixed that:

mkdir -p /var/log

I wasn't sure if a simple mkdir in the setup_xxxxx.sh scripts should be added or if there is a different issue. If it's just mkdir then I will fix.

abmusse commented 8 years ago

Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


Resolving issue with this commit.

abmusse commented 8 years ago

Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


I was about to make the change and then I saw line 29 from yum/setup_all.sh. . .

ln -sf /QOpenSys/var /var

The immediate previous mkdir commands should have resolved my issues. What I realized is the /var directory already exists and symbolic link creation, even with -f (force), doesn't overwrite the directory and instead silently fails. It was then I realized I was being naughty and not following your directions. I hate the default shell (no tab completion) so I first installed perzl's bash. Well, guess what directory that creates? Yes, /var. So if I make sure to do nothing else before installing/configuring yum I am fine.

So that begs the question: should we make chroot environments less fickle by adding the following to chroot_minimal.lst?

:mkdir 
/QOpenSys/var

:ln 
/QOpenSys/var /var

This takes it further than "minimal" and assumes usage of perzl or yum, which I think is fine.

I plan on making the above change to chroot_minimal.lst unless I hear otherwise.

abmusse commented 8 years ago

Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).


YES. Go ahead and add missing directory creates.