# [SOLVED] cdemu: Error inserting cdemu Invalid module format

## buggybunny

Hey ho folks,

ich hab hier ein ziemliches Problem mit cdemu:

Da anscheinend der hier: https://bugs.gentoo.org/show_bug.cgi?id=187853

beschriebene Bug anscheinend noch nicht gefixt ist, bzw das Bugfix seinen Weg in Portage gefunden hat, bin ich nach diesem Thread: https://forums.gentoo.org/viewtopic-p-4408685.html?sid=6c1404b4d3a2cea0981e0f7956bffde8

(zweiter Post von oben) vorgegangen.

Das heißt:

```
ebuild /usr/portage/app-cdr/cdemu/cdemu-0.8.ebuild unpack
```

Output:

```

>>> Existing ${T}/environment for 'cdemu-0.8' will be sourced. Run 'clean'

>>> to start with a fresh environment.

 * cdemu-0.8.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...                                                                                                                                                [ ok ]

 * checking ebuild checksums ;-) ...                                                                                                                                                                [ ok ]

 * checking auxfile checksums ;-) ...                                                                                                                                                               [ ok ]

 * checking miscfile checksums ;-) ...                                                                                                                                                              [ ok ]

 * checking cdemu-0.8.tar.bz2 ;-) ...                                                                                                                                                               [ ok ]

>>> Checking cdemu-0.8.tar.bz2's mtime...

>>> WORKDIR is up-to-date, keeping...

```

Dann das Patchfile erstellt:

```
 cd /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8

nano patchcdemu
```

Gepatched:

```
 cat patchcdemu | patch -p1

patching file cdemu_core.c

patching file cdemu_mod.c

```

Kompiliert:

```
ebuild /usr/portage/app-cdr/cdemu/cdemu-0.8.ebuild compile
```

```
>>> Existing ${T}/environment for 'cdemu-0.8' will be sourced. Run 'clean'

>>> to start with a fresh environment.

 * cdemu-0.8.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...                                                                                                                                                [ ok ]

 * checking ebuild checksums ;-) ...                                                                                                                                                                [ ok ]

 * checking auxfile checksums ;-) ...                                                                                                                                                               [ ok ]

 * checking miscfile checksums ;-) ...                                                                                                                                                              [ ok ]

 * checking cdemu-0.8.tar.bz2 ;-) ...                                                                                                                                                               [ ok ]

>>> Checking cdemu-0.8.tar.bz2's mtime...

>>> WORKDIR is up-to-date, keeping...

>>> Compiling source in /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8 ...

 * Preparing cdemu module

rm -f .cdemu*.{ko,mod.o,o}.cmd cdemu*.{ko,o,mod.{c,o}} *.pyc core *~

rm -rf .tmp_versions Modules.symvers

rm -f docs/cdemu.{dvi,pdf}

make[1]: Entering directory `/usr/src/linux-2.6.22-gentoo-r2'

  CC [M]  /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8/cdemu_core.o

  CC [M]  /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8/cdemu_mod.o

  CC [M]  /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8/cdemu_proc.o

  LD [M]  /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8/cdemu.o

  Building modules, stage 2.

  MODPOST 1 modules

  CC      /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8/cdemu.mod.o

  LD [M]  /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8/cdemu.ko

make[1]: Leaving directory `/usr/src/linux-2.6.22-gentoo-r2'

>>> Source compiled.

```

Und abschließend installiert:

```
ebuild /usr/portage/app-cdr/cdemu/cdemu-0.8.ebuild merge
```

```
Disabling noauto in features... merge disables it. (qmerge doesn't)

 * cdemu-0.8.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...                                                                                                                                                [ ok ]

 * checking ebuild checksums ;-) ...                                                                                                                                                                [ ok ]

 * checking auxfile checksums ;-) ...                                                                                                                                                               [ ok ]

 * checking miscfile checksums ;-) ...                                                                                                                                                              [ ok ]

 * checking cdemu-0.8.tar.bz2 ;-) ...                                                                                                                                                               [ ok ]

>>> Checking cdemu-0.8.tar.bz2's mtime...

>>> WORKDIR is up-to-date, keeping...

>>> It appears that 'cdemu-0.8' is already compiled; skipping.

>>> Remove '/var/tmp/portage/app-cdr/cdemu-0.8/.compiled' to force compilation.

>>> Test phase [not enabled]: app-cdr/cdemu-0.8

>>> Install cdemu-0.8 into /var/tmp/portage/app-cdr/cdemu-0.8/image/ category app-cdr

**** Installing files ****

install -D -m 644 cdemu.ko /var/tmp/portage/app-cdr/cdemu-0.8/image//lib/modules/2.6.22-gentoo-r2/misc/cdemu.ko

install -D -m 644 libcdemu.py /var/tmp/portage/app-cdr/cdemu-0.8/image//usr/lib/python2.4/site-packages/libcdemu.py

install -D -m 755 cdemu /var/tmp/portage/app-cdr/cdemu-0.8/image//usr/bin/cdemu

install -D -m 755 create_cdemu_devs.sh /var/tmp/portage/app-cdr/cdemu-0.8/image//usr/bin/create_cdemu_devs.sh

**** Skipping depmod

sh create_cdemu_devs.sh

You have udev, nodes will be created automagically

>>> Completed installing cdemu-0.8 into /var/tmp/portage/app-cdr/cdemu-0.8/image/

strip: i686-pc-linux-gnu-strip --strip-unneeded -R .comment

   lib/modules/2.6.22-gentoo-r2/misc/cdemu.ko

 * QA Notice: Package has poor programming practices which may compile

 *            fine but exhibit random runtime failures.

 * /var/tmp/portage/app-cdr/cdemu-0.8/work/cdemu-0.8/cdemu_core.c:489: warning: implicit declaration of function ‘generic_file_read’

* checking 8 files for package collisions

>>> Merging app-cdr/cdemu-0.8 to /

--- /usr/

--- /usr/bin/

>>> /usr/bin/cdemu

>>> /usr/bin/create_cdemu_devs.sh

--- /usr/share/

--- /usr/share/doc/

--- /usr/share/doc/cdemu-0.8/

>>> /usr/share/doc/cdemu-0.8/README.bz2

>>> /usr/share/doc/cdemu-0.8/ChangeLog.bz2

>>> /usr/share/doc/cdemu-0.8/TODO.bz2

>>> /usr/share/doc/cdemu-0.8/AUTHORS.bz2

--- /usr/lib/

--- /usr/lib/python2.4/

--- /usr/lib/python2.4/site-packages/

>>> /usr/lib/python2.4/site-packages/libcdemu.py

--- /lib/

--- /lib/modules/

--- /lib/modules/2.6.22-gentoo-r2/

--- /lib/modules/2.6.22-gentoo-r2/misc/

>>> /lib/modules/2.6.22-gentoo-r2/misc/cdemu.ko

>>> Safely unmerging already-installed instance...

No package files given... Grabbing a set.

--- replaced obj /usr/share/doc/cdemu-0.8/TODO.bz2

--- replaced obj /usr/share/doc/cdemu-0.8/README.bz2

--- replaced obj /usr/share/doc/cdemu-0.8/ChangeLog.bz2

--- replaced obj /usr/share/doc/cdemu-0.8/AUTHORS.bz2

--- replaced dir /usr/share/doc/cdemu-0.8

--- replaced dir /usr/share/doc

--- replaced dir /usr/share

--- replaced obj /usr/lib/python2.4/site-packages/libcdemu.py

--- replaced dir /usr/lib/python2.4/site-packages

--- replaced dir /usr/lib/python2.4

--- replaced dir /usr/lib

--- replaced obj /usr/bin/create_cdemu_devs.sh

--- replaced obj /usr/bin/cdemu

--- replaced dir /usr/bin

--- replaced dir /usr

--- replaced obj /lib/modules/2.6.22-gentoo-r2/misc/cdemu.ko

--- replaced dir /lib/modules/2.6.22-gentoo-r2/misc

--- replaced dir /lib/modules/2.6.22-gentoo-r2

--- replaced dir /lib/modules

--- replaced dir /lib

 * Cleaning orphaned Python bytecode from /usr/lib/python2.4/site-packages ..

 * Removing app-cdr/cdemu-0.8 from moduledb.

>>> Original instance of package unmerged safely.

 * Updating module dependencies for 2.6.22-gentoo-r2 ...

 * 

 * /lib/modules/2.6.22-gentoo-r2/build/System.map not found.

 * You must manually update the kernel module dependencies using depmod.                                                                                                                            [ !! ]

 * 

 * Adding module to moduledb.

>>> app-cdr/cdemu-0.8 merged.

 * Messages for package app-cdr/cdemu-0.8:

 * 

 * /lib/modules/2.6.22-gentoo-r2/build/System.map not found.

 * You must manually update the kernel module dependencies using depmod.

```

Was mich allerdings hier schon stutzig gemacht hat war die Meldung:

```
 * /lib/modules/2.6.22-gentoo-r2/build/System.map not found.

 * You must manually update the kernel module dependencies using depmod.
```

Ok, also 

```
depmod -a
```

ausgeführt, das ist ohne Meldungen durchgelaufen.

Das cdemu-Modul ist auch am passenden Platz:

```
find /lib/modules/2.6.22-gentoo-r2/ | grep -i cdemu

/lib/modules/2.6.22-gentoo-r2/misc/cdemu.ko

```

Modulverzeichnis stimmt:

```
uname -r

2.6.22-gentoo-r2
```

Leider krieg ich nun wenn ich versuche das Modul zu laden folgende Fehlermeldung:

```
modprobe cdemu

FATAL: Error inserting cdemu (/lib/modules/2.6.22-gentoo-r2/misc/cdemu.ko): Invalid module format
```

modinfo sagt:

```
modinfo cdemu

filename:       /lib/modules/2.6.22-gentoo-r2/misc/cdemu.ko

license:        GPL

description:    CD Emulator for bin/cue images ver 0.8.0

author:         Robert Penz <robert.penz@outertech.com>, Mike Frysinger <vapier@gmail.com>

depends:        

vermagic:       2.6.22-new-non-genkernel SMP mod_unload 486 

parm:           cdemu_major:int

parm:           cdemu_count:Maximum number of virtual cdroms (1-255) (int)
```

Tante google liefert dazu viele Ubuntu-Links, dort kam das Problem allerdings daher, das die ungepatchte sourcen verwendet haben (zumindest in einigen Threads).

Tja, jetzt bin ich verwirrt....

Wie kann ich dem Problem auf die Spur kommen?

Ist das hier (s.o.):

```
 * /lib/modules/2.6.22-gentoo-r2/build/System.map not found.

 * You must manually update the kernel module dependencies using depmod.
```

das eigentliche Probleme?

Zusatzinfo:

1. 

In /usr/src/linux/Makefile steht folgendes als Modul-Verzeichnis:

```

EXTRAVERSION = -gentoo-r2

```

soweit korrekt? Ich hatte das mal zu Testzwecken für ein paar Tage auf ein anderes Verzeichnis gesetzt, aber vor der cdemu-Geschichte das wieder rückgängig gemacht.

2.

```
ls -al /usr/src/linux

lrwxrwxrwx 1 root root 22 2007-08-15 22:20 /usr/src/linux -> linux-2.6.22-gentoo-r2
```

Soweit also auch korrekt.....

Any ideas?

EDIT:

Ah, ich Dussel, ich glaube in der Ausgabe von modinfo steht das Problem:

 *Quote:*   

> vermagic:       2.6.22-new-non-genkernel SMP mod_unload 486 

 

Das war das Verzeichnis auf das ich in /usr/src/linux/Makefile :

```

EXTRAVERSION = -gentoo-r2

```

kurzfristig geändert hatte.

Nur warum wird mir das Modul immer noch mit Referenz auf das alte Verzeichnis erstellt?

Sollte ich nochmal ein:

```
make modules_install 
```

machen?

EDIT:

Ok, sogar mal selbst gelöst bekommen:

```
make clean && make && make modules_install
```

Dann cdemu nochmal neu gebaut.

Allerdings scheint cdemu selbst nicht so wirklich zu laufen:

Als root:

```
cdemu 1 /mnt/mein_iso.iso 

Traceback (most recent call last):

  File "/usr/bin/cdemu", line 132, in ?

    main()

  File "/usr/bin/cdemu", line 127, in main

    libcdemu.load_cd(device, args[-1],os.path.basename(args[-1]))

  File "/usr/lib/python2.4/site-packages/libcdemu.py", line 775, in load_cd

    bin_filename = find_bin(supposable_bin_filename, filename)

  File "/usr/lib/python2.4/site-packages/libcdemu.py", line 514, in find_bin

    bin_in_bin_path = os.path.abspath(bin_basename)

  File "/usr/lib/python2.4/posixpath.py", line 403, in abspath

    path = join(os.getcwd(), path)

OSError: [Errno 2] No such file or directory

```

Hmmpfff,

* google anwerf *

----------

## Max Steel

führe mal insmod /lib/modules/<kernel>/misc/cdemu.ko

----------

