Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » allegro_init() fails on a SuSE 9.1 headless machine

This thread is locked; no one can reply to it. rss feed Print
allegro_init() fails on a SuSE 9.1 headless machine
Jörg Rüppel
Member #35
April 2000

I'm trying to make the dedicated server of Gusanos (gusanos.sf.net) run on a SuSE 9.1 root server. While doing that I found out, that Allegro can't initialize the system driver, for whatever reason. I then tried running some of the test applications in the Allegro dir, and they all fail, too.

I tried stepping through allegro_init() with GDB but using a debugger on command line is pain in the a** ;D

This is what allegro_error holds after allegro_init():

VT_GETSTATE: Invalid argument

This is the end of the strace output:

1close(4) = 0
2fstat64(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
3stat64("/dev/tty1", {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 1), ...}) = 0
4stat64("/dev/tty2", {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 2), ...}) = 0
5stat64("/dev/tty3", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 3), ...}) = 0
6stat64("/dev/tty4", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 4), ...}) = 0
7stat64("/dev/tty5", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 5), ...}) = 0
8stat64("/dev/tty6", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 6), ...}) = 0
9stat64("/dev/tty7", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 7), ...}) = 0
10stat64("/dev/tty8", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 8), ...}) = 0
11stat64("/dev/tty9", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 9), ...}) = 0
12stat64("/dev/tty10", {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 10), ...}) = 0
13stat64("/dev/tty11", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 11), ...}) = 0
14stat64("/dev/tty12", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 12), ...}) = 0
15stat64("/dev/tty13", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 13), ...}) = 0
16stat64("/dev/tty14", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 14), ...}) = 0
17stat64("/dev/tty15", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 15), ...}) = 0
18stat64("/dev/tty16", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 16), ...}) = 0
19stat64("/dev/tty17", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 17), ...}) = 0
20stat64("/dev/tty18", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 18), ...}) = 0
21stat64("/dev/tty19", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 19), ...}) = 0
22stat64("/dev/tty20", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 20), ...}) = 0
23stat64("/dev/tty21", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 21), ...}) = 0
24stat64("/dev/tty22", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 22), ...}) = 0
25stat64("/dev/tty23", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 23), ...}) = 0
26stat64("/dev/tty24", 0xbfffefac) = -1 ENOENT (No such file or directory)
27open("/dev/console", O_WRONLY) = 4
28ioctl(4, VT_GETSTATE, 0xbffff1b6) = -1 EINVAL (Invalid argument)
29close(4) = 0
30fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
31mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4056a000
32write(1, "VT_GETSTATE: Invalid argument\n", 30VT_GETSTATE: Invalid argument
33) = 30
34munmap(0x4056a000, 4096) = 0
35exit_group(0) = ?
36Process 20117 detached

Allegro was compiled with "--without-x" so it should only use the Linux console driver. Can anyone intimate enough with the Linux port tell me what is causing the trouble here?

Homepage [www.sharky-x.de] | Zoidcom [www.zoidcom.com]

Milan Mimica
Member #3,877
September 2003
avatar

Of course.
There are two ways to run allegro compiled without X support under X:
1. init allegro using install_allegro(SYSTEM_NONE, &errno, atexit)
- you will not be able to use any system dependent allegro API: timers, rest(), keyboard, mouse ..., only memory bitmaps and config file routines (maybe even something else)

2. grab the latest SVN version and allegro will init fine.
- when you try to init something that requires a linux console (GFX, keyboard) it will fail because you need to be root for that from X. Timer, sound and mouse will work fine.

The third way is to run your allegro program as root.

Jörg Rüppel
Member #35
April 2000

I was root. I'll try the SVN version.

Edit: Ok. 4.2 branch does this:

1stat64("/dev/tty19", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 19), ...}) = 0
2stat64("/dev/tty20", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 20), ...}) = 0
3stat64("/dev/tty21", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 21), ...}) = 0
4stat64("/dev/tty22", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 22), ...}) = 0
5stat64("/dev/tty23", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 23), ...}) = 0
6stat64("/dev/tty24", 0xbffff21c) = -1 ENOENT (No such file or directory)
7open("/dev/console", O_WRONLY) = 7
8ioctl(7, 0x5603, 0xbffff456) = -1 EINVAL (Invalid argument)
9close(7) = 0
10rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
11write(5, "@\332\4@\0\0\0\0\0\0\0\0p\t\f\10\0\0\0\0\0\0\0\200\0\0"..., 148) = 148
12rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
13rt_sigsuspend([] <unfinished ...>
14--- SIGRTMIN (Unknown signal 32) @ 0 (0) ---
15<... rt_sigsuspend resumed> ) = -1 EINTR (Interrupted system call)
16sigreturn() = ? (mask now [RTMIN])
17ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
18ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
19ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
20ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
21ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
22ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
23ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
24ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
25ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
26ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
27ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
28ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
29ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
30ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
31ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
32ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
33ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
34ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
35ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
36ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
37ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
38ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
39ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
40ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
41ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
42ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
43ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
44ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
45ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
46ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
47ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
48ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
49ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
50ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
51ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
52ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
53ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
54ioctl(-1, 0x5607, 0) = -1 EBADF (Bad file descriptor)
55... <- infinite loop

Result from 4.3 branch:

1stat64("/dev/tty18", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 18), ...}) = 0
2stat64("/dev/tty19", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 19), ...}) = 0
3stat64("/dev/tty20", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 20), ...}) = 0
4stat64("/dev/tty21", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 21), ...}) = 0
5stat64("/dev/tty22", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 22), ...}) = 0
6stat64("/dev/tty23", {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 23), ...}) = 0
7stat64("/dev/tty24", 0xbffff20c) = -1 ENOENT (No such file or directory)
8open("/dev/console", O_WRONLY) = 5
9ioctl(5, VT_GETSTATE, 0xbffff406) = -1 EINVAL (Invalid argument)
10close(5) = 0
11mmap2(NULL, 2101248, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40386000
12mprotect(0x40386000, 4096, PROT_NONE) = 0
13clone(child_stack=0x40586504, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEART
14ID, parent_tidptr=0x40586bf8, {entry_number:6, base_addr:0x40586bb0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_prese
15nt:0, useable:1}, child_tidptr=0x40586bf8) = 31671
16mmap2(NULL, 2101248, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40587000
17mprotect(0x40587000, 4096, PROT_NONE) = 0
18clone(child_stack=0x40787504, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEART
19ID, parent_tidptr=0x40787bf8, {entry_number:6, base_addr:0x40787bb0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_prese
20nt:0, useable:1}, child_tidptr=0x40787bf8) = 31672
21ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
22ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
23ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
24ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
25ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
26ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
27ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
28ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
29ioctl(-1, VIDIOC_S_COMP or VT_WAITACTIVE, 0) = -1 EBADF (Bad file descriptor)
30...

Homepage [www.sharky-x.de] | Zoidcom [www.zoidcom.com]

BAF
Member #2,981
December 2002
avatar

Why does your server program need Allegro?

BAF.zone [baf.zone] | SantaHack! [www.santahack.net]

GullRaDriel
Member #3,861
September 2003
avatar

IMHO, the question is not really why do he needs it, but why it crash.
And I'm sorry to tell you that I don't see why.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Jörg Rüppel
Member #35
April 2000

Allegro is needed for the timers and of course image loading/manipulation. I see that latter is possible with SYSTEM_NONE, but former is not.

Also I'd like to mention that it is not MY server, I'm just trying to make it run. Gusanos is opensource and I am trying to set up a dedicated server for it.

Homepage [www.sharky-x.de] | Zoidcom [www.zoidcom.com]

Milan Mimica
Member #3,877
September 2003
avatar

Let's focus on 4.2 SVN version.

First, your program tries to init a console. It means it is trying to init keyboard, graphics or something else that requires a linux console. You cannot expect it to work without root permisions from X. I don't know why it doesn't work as root. Even if it would work (and in fact, it should) you would be switched to a console. You wouldn't like it I guess.

Check if it even runs from a real linux console. Are you using a framebuffer device?

Anyway, if you need allegro for your server, do you need graphics and keyboard? I guess you don't. If you don't need even timer functions you can use install_allegro(SYSTEM_NONE, &errno, atexit) instead.

Jörg Rüppel
Member #35
April 2000

For the record, this is a rented, dedicated root server without X, without monitor, just remote access through SSH. There is no framebuffer device either.

And I do need timers.

Homepage [www.sharky-x.de] | Zoidcom [www.zoidcom.com]

Milan Mimica
Member #3,877
September 2003
avatar

Oh, I see. I made some wrong assumptions.
That's strange. Allegro is not supposed to open console in allegro_init. I don't find strace output very descriptive. Does the strace output of 4.2 SVN belong to allegro_init? If I read it well, it doesn't return but it's stuck.

[edit]
It dawned on me: when running from a ssh console the same restrictions apply as running form X. But again, 4.2 SVN shouldn't try to init console in allegro_init().

BAF
Member #2,981
December 2002
avatar

You could use Linux timers (the way Allegro does) and ditch allegro.... Allegro really isn't meant nor needed for dedicated server programs - all they should do is process, not do that much graphics manip.

BAF.zone [baf.zone] | SantaHack! [www.santahack.net]

Milan Mimica
Member #3,877
September 2003
avatar

There are some features that can be handy on dedicated servers: timers, config file routines, maybe fixed point number routines... Even bitmap handling functions of the games uses pixel based collision detection etc.

Jörg Rüppel
Member #35
April 2000

Exactly. And as I said two times now, it is not my game, and I have no intention to change anything larger than one or two lines in the code. The game has a dedicated server, and it uses Allegro. So it is either going to work with Allegro, or not at all.

All strace output is from allegro_init(), and you saw that correctly, it gets stuck somewhere during allegro_init() and never returns from that function (with 4.2 branch)

Edit: Oh forget what I said, I assumed allegro's mathtest program wasn't using graphics at all. As it turns out, the endless loop occurs when trying to set a gfx mode or something. Gusanos dedicated starts fine with Allegro SVN 4.2

Homepage [www.sharky-x.de] | Zoidcom [www.zoidcom.com]

GullRaDriel
Member #3,861
September 2003
avatar

Hmm...

Have you tried using install_allegro instead ?

EDIT:
I think this passage of the manual sounds good for you:

manual said:

The available system ID codes will vary from one platform to another, but you will almost always want to pass SYSTEM_AUTODETECT. Alternatively, SYSTEM_NONE installs a stripped down version of Allegro that won't even try to touch your hardware or do anything platform specific: this can be useful for situations where you only want to manipulate memory bitmaps, such as the text mode datafile tools or the Windows GDI interfacing functions.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Milan Mimica
Member #3,877
September 2003
avatar

GullRaDriel: he needs timers

Jörg Rüppel: Hurray! However, set_gfx_mode should be fixed to return -1.

Go to: