# pcmcia schemes not working

## cbueche

Hi all,

I run gentoo on a Dell laptop. As my pcmcia card is better supported by the standalone pcmcia package, I'm using it (hence not the kernel version).

This was working fine with Mandrake 8.2, before changing to gentoo.

With gentoo, when I do a "cardctl scheme name1", it says "changing scheme from name2 to name1", but nothing happen, my /etc/pcmcia/network.opts isn't used, eth0 is not getting reconfigured, neither is resolv.conf, nada.

At boot, I get the config from /etc/conf.d/net, which is static.

What am I doing wrong ???

Please help, I'm swapping networks 2-3 times a day.

Charles

----------

## chadh

Do you use dhcp on both interfaces?  if so, then just configure /etc/conf.d/net appropriately, and the scheme switching should work fine.  If you have more complicated network configurations for each scheme, then you will have to restore the old /etc/pcmcia/network script.  I have committed a copy to /usr/portage/sys-apps/pcmcia-cs/files/network.orig that should work for you.  Then your network.opts file will work as expected.

Gentoo doesn't fully support schemes yet, but that is coming.  The plan is to more generally support profiles that let you have different /etc/hosts, /etc/resolv.conf, etc. files for each profile.

----------

## cbueche

Hi again,

I don't use dhcp, only static settings.

I tried with the network.orig script and my network.opts, but it doesn't work better. "cardctl scheme xxx" says it changes the scheme, but the ip reconfig doesn't happen at all.

A strace shows the following things :

```
big files # strace cardctl scheme home

execve("/sbin/cardctl", ["cardctl", "scheme", "home"], [/* 27 vars */]) = 0

brk(0)                                  = 0x8050160

old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40016000

open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)

open("/etc/ld.so.cache", O_RDONLY)      = 3

fstat64(3, {st_mode=S_IFREG|0644, st_size=55955, ...}) = 0

old_mmap(NULL, 55955, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000

close(3)                                = 0

open("/lib/libc.so.6", O_RDONLY)        = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\250\224"..., 1024) = 1024

fstat64(3, {st_mode=S_IFREG|0755, st_size=1285220, ...}) = 0

old_mmap(NULL, 1242944, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40025000

mprotect(0x4014a000, 42816, PROT_NONE)  = 0

old_mmap(0x4014a000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x124000) = 0x4014a000

old_mmap(0x40151000, 14144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x

40151000

close(3)                                = 0

munmap(0x40017000, 55955)               = 0

getuid32()                              = 0

access("/var/lib/pcmcia", R_OK)         = -1 ENOENT (No such file or directory)

geteuid32()                             = 0

brk(0)                                  = 0x8050160

brk(0x80502e0)                          = 0x80502e0

brk(0x8051000)                          = 0x8051000

open("/proc/devices", O_RDONLY)         = 3

fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0

old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000

read(3, "Character devices:\n  1 mem\n  2 p"..., 4096) = 229

close(3)                                = 0

munmap(0x40017000, 4096)                = 0

getuid32()                              = 0

setuid32(0)                             = 0

open("/var/run/pcmcia-scheme", O_RDONLY) = 3

fstat64(3, {st_mode=S_IFREG|0644, st_size=5, ...}) = 0

old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000

read(3, "post\n", 4096)                 = 5

close(3)                                = 0

munmap(0x40017000, 4096)                = 0

getuid32()                              = 0

chdir("/etc/pcmcia")                    = 0

open("/var/run/stab", O_RDONLY)         = -1 ENOENT (No such file or directory)

fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0

old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000

write(1, "Changing scheme from \'post\' to \'"..., 41Changing scheme from 'post' to 'home'...

) = 41

umask(022)                              = 022

open("/var/run/pcmcia-scheme", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3

fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0

old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000

write(3, "home\n", 5)                   = 5

close(3)                                = 0

munmap(0x40018000, 4096)                = 0

munmap(0x40017000, 4096)                = 0

_exit(0)    
```

Hints welcomed. 

Chadh : we can as well continue this discussion off-list if you prefer. I can as well test your stuff. charles<at>bueche.ch

Something I remember : I don't have "pnp" in my USE. Is this mandatory ?

Charles

----------

## silverter

Hi!

Did u solve your problem with the pcmcia scheme and switching networks? If so please let me know about your solution, I'm in the same situation here. 

Thanks, 

regards

--

Silverter - A Profi was once a beginner

----------

## cbueche

Hi,

no, not yet solved. pcmcia-cs 3.1.34 will soon be out and possibly solve this. I'm not sure about it...

Charles

----------

## chadh

Well, there is a new version of pcmcia-cs (3.1.34), which you may want to try.  It is still masked, but feel free to try it

```
ebuild /usr/portage/sys-apps/pcmcia-cs/pcmcia-cs-3.1.34-r4.ebuild merge
```

Please e-mail chadh@gentoo.org with any problems.

----------

## disciphile

Sorry for such a simple question, but what does it mean for a package to be "Masked"

----------

## masseya

 *disciphile wrote:*   

> Sorry for such a simple question, but what does it mean for a package to be "Masked"

 

The file were things are masked is /usr/portage/profiles/package.mask.  You'll find it pretty simple to understand.  The "=" in front of some file names means that it only matches that version of the ebuild.  A ">=" means it matches anything that version or higher of an ebuild.  This would be a good way to make sure that you use a particular old ebuild.  If there is no "=" then all things matching that ebuild are "masked" and they won't be used.  There are comments (started with #) that explain why something is masked.

----------

## disciphile

Thanks for the explanation Tristam29.

----------

## Cardoe

Did the new ebuild fix the prob?

-Cardoe

----------

## watersb

 *Quote:*   

> Did the new ebuild fix the prob?

 

Schemes still do not work. I cannot use them.

I tried to manually hard-code the $SCHEME variable in the /etc/init.d/pcmcia script, but that does not work, either.

So for now I hard-code all values for pcmcia setup.

----------

## ronmon

Schemes work fine for me. Due to the age of this thread I am using a much later version of pcmcia-cs ,3.2.4, but mine has been set this way for a long time.

I always change the scheme before inserting the card, which might have something to do with it. Also, I have the config options set in network.opts and wireless.opts.

----------

## embobo

 *ronmon wrote:*   

> Schemes work fine for me. Due to the age of this thread I am using a much later version of pcmcia-cs ,3.2.4, but mine has been set this way for a long time.
> 
> I always change the scheme before inserting the card, which might have something to do with it. Also, I have the config options set in network.opts and wireless.opts.

 

That is surprising. I am using pcmcia-cs 3.2.4 and it seems network.opts is still ignored. In the unmodified pcmcia-cs network.opts is sourced in /etc/pcmcia/network. Gentoo has a completely different script that doesn't touch network.opts at all. Instead, it uses the same config files as non-pcmcia network cards, /etc/init.d/net.$DEVICE.

This has the unfortunate effect of breaking schemes. I wanted to use schemes but only modify configuration files so that my changes wouldn't be lost the next update. First, I added this line to /etc/pcmcia/network:

export ADDRESS

right under the line that sets it.

Then I modified /etc/conf.d/net. It now has access to $ADDRESS. So, following /etc/pcmcia/network.opts, I wrapped my scheme configs in a

case "$ADDRESS" in

foo,*,*,*)

;;

*,*,*,*)

;;

esac

This way the Gentoo network config is still done in /etc/conf.d.

Even if my suggestion is not used, I recommend changing /etc/pcmcia/network.opts to have a big note at the beginning:

*** THIS FILE IS NOT USED ***

Configuration is done in /etc/conf.d/net{.$DEVICE}

----------

## embobo

I should add: I've added this suggestion to the relevant bug:

https://bugs.gentoo.org/show_bug.cgi?id=1990

----------

