Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 637040

Summary: sys-apps/portage-2.3.8 postsync hook failes
Product: Gentoo Linux Reporter: Marcin Szamotulski <profunctor>
Component: Current packagesAssignee: Portage team <dev-portage>
Status: RESOLVED INVALID    
Severity: normal CC: floppym
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info output

Description Marcin Szamotulski 2017-11-10 10:14:06 UTC
Created attachment 503406 [details]
emerge --info output

After successful `emerge --sync` I always get an error (dumped below).  My I have one script in `/etc/portage/postsync.d/post-sync.sh` which calls `layman -S; eix-update`.


```
sent 60.72K bytes  received 9.45M bytes  333.70K bytes/sec
total size is 248.03M  speedup is 26.08
=== Sync completed for gentoo
q: Updating ebuild cache in /usr/portage ... 
q: Finished 38640 entries in 0.135363 seconds
[Errno 8] Exec format error: b'/etc/portage/postsync.d/eix-update.sh':
   /etc/portage/postsync.d/eix-update.sh
Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/portage/process.py", line 321, in spawn
    unshare_net, unshare_ipc, cgroup)
  File "/usr/lib64/python3.4/site-packages/portage/process.py", line 519, in _exec
    os.execve(binary, myargs, env)
  File "/usr/lib64/python3.4/site-packages/portage/__init__.py", line 250, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
OSError: [Errno 8] Exec format error: b'/etc/portage/postsync.d/eix-update.sh'
 * Spawn failed for: eix-update.sh, /etc/portage/postsync.d/eix-update.sh
[Errno 8] Exec format error: b'/etc/portage/postsync.d/layman.sh':
   /etc/portage/postsync.d/layman.sh
Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/portage/process.py", line 321, in spawn
    unshare_net, unshare_ipc, cgroup)
  File "/usr/lib64/python3.4/site-packages/portage/process.py", line 519, in _exec
    os.execve(binary, myargs, env)
  File "/usr/lib64/python3.4/site-packages/portage/__init__.py", line 250, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
OSError: [Errno 8] Exec format error: b'/etc/portage/postsync.d/layman.sh'
 * Spawn failed for: layman.sh, /etc/portage/postsync.d/layman.sh
```
Comment 1 Mike Gilbert gentoo-dev 2017-11-10 18:50:30 UTC
Have you disabled CONFIG_BINFMT_SCRIPT in your Linux kernel?
Comment 2 Marcin Szamotulski 2017-11-10 18:53:15 UTC
No, it's there:
```
zcat /proc/config.gz | grep CONFIG_BINFMT_SCRIPT
CONFIG_BINFMT_SCRIPT=y
```
Comment 3 Mike Gilbert gentoo-dev 2017-11-10 19:12:41 UTC
Do /etc/portage/postsync.d/eix-update.sh and /etc/portage/postsync.d/layman.sh exist?

If so, what are their contents?
Comment 4 Marcin Szamotulski 2017-11-10 19:19:34 UTC
both are one liners calling `layman -S` and `eix-update`, which I put after a two linear with both commands started to break with the same error:
```
=== Sync completed for gentoo
q: Updating ebuild cache in /usr/portage ... 
q: Finished 38645 entries in 0.138505 seconds
[Errno 8] Exec format error: b'/etc/portage/postsync.d/post-sync.sh':
   /etc/portage/postsync.d/post-sync.sh
Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/portage/process.py", line 321, in spawn
    unshare_net, unshare_ipc, cgroup)
  File "/usr/lib64/python3.4/site-packages/portage/process.py", line 519, in _exec
    os.execve(binary, myargs, env)
  File "/usr/lib64/python3.4/site-packages/portage/__init__.py", line 250, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
OSError: [Errno 8] Exec format error: b'/etc/portage/postsync.d/post-sync.sh'
 * Spawn failed for: post-sync.sh, /etc/portage/postsync.d/post-sync.sh
```
Comment 5 Zac Medico gentoo-dev 2017-11-10 19:23:10 UTC
This is normal behavior if the script does not have a shebang on the first line like this:

#!/bin/bash
Comment 6 Marcin Szamotulski 2017-11-10 19:23:33 UTC
ok,I know what's the error.  Missing shebang.  Something must have changed, since I used the script for a very long time.  Maybe when I switched from python2 to python3.
Comment 7 Marcin Szamotulski 2017-11-10 19:23:57 UTC
Indeed, thanks for your help.