[CentOS] Odd issue with custom udev rule at boot

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[CentOS] Odd issue with custom udev rule at boot

James A. Peltier
Hi All,

I've written a custom udev rule to change the permissions of /dev/ttyS* but it doesn't seem to be working at boot up.  If I run

  /sbin/udevcontrol reload_rules; udevtrigger

The rules are parsed, applied and the permissions are then correct but why is it not doing so at boot?  The file in questions I've called /etc/udev/rules.d/49-udev-override.rules and it contains

KERNEL=="tty[A-Z]*",            NAME="%k", GROUP="rcl", MODE="0660", OPTIONS="last_rule"

the default 50-udev.rules file has been left untouched.  SELinux is in permissive mode and so I can't find a reason why it is happening.  Anyone have any ideas?

--
James A. Peltier
IT Services - Research Computing Group
Simon Fraser University - Burnaby Campus
Phone   : 778-782-6573
Fax     : 778-782-3045
E-Mail  : [hidden email]
Website : http://www.sfu.ca/itservices
          http://blogs.sfu.ca/people/jpeltier


_______________________________________________
CentOS mailing list
[hidden email]
http://lists.centos.org/mailman/listinfo/centos
Reply | Threaded
Open this post in threaded view
|

Re: [CentOS] Odd issue with custom udev rule at boot

James Pearson
James A. Peltier wrote:

> Hi All,
>
> I've written a custom udev rule to change the permissions of /dev/ttyS* but it doesn't seem to be working at boot up.  If I run
>
>   /sbin/udevcontrol reload_rules; udevtrigger
>
> The rules are parsed, applied and the permissions are then correct but why is it not doing so at boot?  The file in questions I've called /etc/udev/rules.d/49-udev-override.rules and it contains
>
> KERNEL=="tty[A-Z]*",            NAME="%k", GROUP="rcl", MODE="0660", OPTIONS="last_rule"
>
> the default 50-udev.rules file has been left untouched.  SELinux is in permissive mode and so I can't find a reason why it is happening.  Anyone have any ideas?
>

The thread starting at:

<http://lists.centos.org/pipermail/centos/2009-July/079133.html>

may gives some clues

James Pearson
_______________________________________________
CentOS mailing list
[hidden email]
http://lists.centos.org/mailman/listinfo/centos
Reply | Threaded
Open this post in threaded view
|

Re: [CentOS] Odd issue with custom udev rule at boot

James A. Peltier
----- Original Message -----
| James A. Peltier wrote:
| > Hi All,
| >
| > I've written a custom udev rule to change the permissions of
| > /dev/ttyS* but it doesn't seem to be working at boot up. If I run
| >
| >   /sbin/udevcontrol reload_rules; udevtrigger
| >
| > The rules are parsed, applied and the permissions are then correct
| > but why is it not doing so at boot? The file in questions I've
| > called /etc/udev/rules.d/49-udev-override.rules and it contains
| >
| > KERNEL=="tty[A-Z]*", NAME="%k", GROUP="rcl", MODE="0660",
| > OPTIONS="last_rule"
| >
| > the default 50-udev.rules file has been left untouched. SELinux is
| > in permissive mode and so I can't find a reason why it is happening.
| > Anyone have any ideas?
| >
|
| The thread starting at:
|
| <http://lists.centos.org/pipermail/centos/2009-July/079133.html>
|
| may gives some clues
|
| James Pearson

I have already done this and it still does not work.  The only option that does work is to set the mode to 0666 which is *not* what I want.  I want the group to change to rcl so that I can maintain 0660.  If I set the mode to 0666 the mode does change but the group does not.

--
James A. Peltier
IT Services - Research Computing Group
Simon Fraser University - Burnaby Campus
Phone   : 778-782-6573
Fax     : 778-782-3045
E-Mail  : [hidden email]
Website : http://www.sfu.ca/itservices
          http://blogs.sfu.ca/people/jpeltier


_______________________________________________
CentOS mailing list
[hidden email]
http://lists.centos.org/mailman/listinfo/centos
Reply | Threaded
Open this post in threaded view
|

Re: [CentOS] Odd issue with custom udev rule at boot

Emmanuel Noobadmin
In reply to this post by James A. Peltier
On 6/14/11, James A. Peltier <[hidden email]> wrote:

> The rules are parsed, applied and the permissions are then correct but why
> is it not doing so at boot?  The file in questions I've called
> /etc/udev/rules.d/49-udev-override.rules and it contains
>
> KERNEL=="tty[A-Z]*",            NAME="%k", GROUP="rcl", MODE="0660",
> OPTIONS="last_rule"
>
> the default 50-udev.rules file has been left untouched.  SELinux is in
> permissive mode and so I can't find a reason why it is happening.  Anyone
> have any ideas?

I had similar problems with udev rules when adding a 2nd NIC and
needed to override the assignments which switched the original eth0 to
eth1.

For some reason, despite all the info that says the over-ride filename
should be alphanumerically "smaller", it only works if the file is
alphanumerically "larger". Which kind of make sense to me since a
later rule should override an earlier one.

So instead of 49-, try 51- instead :D
_______________________________________________
CentOS mailing list
[hidden email]
http://lists.centos.org/mailman/listinfo/centos
Reply | Threaded
Open this post in threaded view
|

Re: [CentOS] Odd issue with custom udev rule at boot

James A. Peltier
----- Original Message -----
| On 6/14/11, James A. Peltier <[hidden email]> wrote:
| > The rules are parsed, applied and the permissions are then correct
| > but why
| > is it not doing so at boot? The file in questions I've called
| > /etc/udev/rules.d/49-udev-override.rules and it contains
| >
| > KERNEL=="tty[A-Z]*", NAME="%k", GROUP="rcl", MODE="0660",
| > OPTIONS="last_rule"
| >
| > the default 50-udev.rules file has been left untouched. SELinux is
| > in
| > permissive mode and so I can't find a reason why it is happening.
| > Anyone
| > have any ideas?
|
| I had similar problems with udev rules when adding a 2nd NIC and
| needed to override the assignments which switched the original eth0 to
| eth1.
|
| For some reason, despite all the info that says the over-ride filename
| should be alphanumerically "smaller", it only works if the file is
| alphanumerically "larger". Which kind of make sense to me since a
| later rule should override an earlier one.
|
| So instead of 49-, try 51- instead :D


Didn't work either.  The MODE stuff works in either case, but the GROUP stuff does not.  I've just decided to use puppet to manage it instead for now and might revisit it in the future

--
James A. Peltier
IT Services - Research Computing Group
Simon Fraser University - Burnaby Campus
Phone   : 778-782-6573
Fax     : 778-782-3045
E-Mail  : [hidden email]
Website : http://www.sfu.ca/itservices
          http://blogs.sfu.ca/people/jpeltier


_______________________________________________
CentOS mailing list
[hidden email]
http://lists.centos.org/mailman/listinfo/centos
Reply | Threaded
Open this post in threaded view
|

Re: [CentOS] Odd issue with custom udev rule at boot

James A. Peltier
----- Original Message -----
| ----- Original Message -----
| | On 6/14/11, James A. Peltier <[hidden email]> wrote:
| | > The rules are parsed, applied and the permissions are then correct
| | > but why
| | > is it not doing so at boot? The file in questions I've called
| | > /etc/udev/rules.d/49-udev-override.rules and it contains
| | >
| | > KERNEL=="tty[A-Z]*", NAME="%k", GROUP="rcl", MODE="0660",
| | > OPTIONS="last_rule"
| | >
| | > the default 50-udev.rules file has been left untouched. SELinux is
| | > in
| | > permissive mode and so I can't find a reason why it is happening.
| | > Anyone
| | > have any ideas?
| |
| | I had similar problems with udev rules when adding a 2nd NIC and
| | needed to override the assignments which switched the original eth0
| | to
| | eth1.
| |
| | For some reason, despite all the info that says the over-ride
| | filename
| | should be alphanumerically "smaller", it only works if the file is
| | alphanumerically "larger". Which kind of make sense to me since a
| | later rule should override an earlier one.
| |
| | So instead of 49-, try 51- instead :D
|
|
| Didn't work either. The MODE stuff works in either case, but the GROUP
| stuff does not. I've just decided to use puppet to manage it instead
| for now and might revisit it in the future
|
| --
| James A. Peltier
| IT Services - Research Computing Group
| Simon Fraser University - Burnaby Campus
| Phone : 778-782-6573
| Fax : 778-782-3045
| E-Mail : [hidden email]
| Website : http://www.sfu.ca/itservices
| http://blogs.sfu.ca/people/jpeltier
|
|
| _______________________________________________
| CentOS mailing list
| [hidden email]
| http://lists.centos.org/mailman/listinfo/centos


BTW: Can anyone try this to see if it is in fact a bug or not?

Create a file called

/etc/udev/rules.d/99-udev-override.rules

that contains

KERNEL=="tty[A-Z]*", GROUP="some_other_group_than_uucp", MODE="0660", OPTIONS="last_rule"

with mode of 0644 reboot and confirm that the group permissions change or not.  If you change the mode however you will see that the mode *does* change.


--
James A. Peltier
IT Services - Research Computing Group
Simon Fraser University - Burnaby Campus
Phone   : 778-782-6573
Fax     : 778-782-3045
E-Mail  : [hidden email]
Website : http://www.sfu.ca/itservices
          http://blogs.sfu.ca/people/jpeltier


_______________________________________________
CentOS mailing list
[hidden email]
http://lists.centos.org/mailman/listinfo/centos
Reply | Threaded
Open this post in threaded view
|

Re: [CentOS] Odd issue with custom udev rule at boot

James Pearson
James A. Peltier wrote:

> BTW: Can anyone try this to see if it is in fact a bug or not?
>
> Create a file called
>
> /etc/udev/rules.d/99-udev-override.rules
>
> that contains
>
> KERNEL=="tty[A-Z]*", GROUP="some_other_group_than_uucp", MODE="0660", OPTIONS="last_rule"
>
> with mode of 0644 reboot and confirm that the group permissions
> change or not.  If you change the mode however you will see that the
> mode *does* change.

Works for me.

Before:

# ls -l /dev/ttyS*
crw-rw---- 1 root uucp 4, 64 Jun 15 16:16 /dev/ttyS0
crw-rw---- 1 root uucp 4, 65 Jun 15 16:16 /dev/ttyS1
crw-rw---- 1 root uucp 4, 66 Jun 15 16:16 /dev/ttyS2
crw-rw---- 1 root uucp 4, 67 Jun 15 16:16 /dev/ttyS3

Created /etc/udev/rules.d/99-udev-override.rules containing:

KERNEL=="tty[A-Z]*", GROUP="users", MODE="0660", OPTIONS="last_rule"

After reboot:

# ls -l /dev/ttyS*
crw-rw---- 1 root users 4, 64 Jun 16 10:45 /dev/ttyS0
crw-rw---- 1 root users 4, 65 Jun 16 10:45 /dev/ttyS1
crw-rw---- 1 root users 4, 66 Jun 16 10:45 /dev/ttyS2
crw-rw---- 1 root users 4, 67 Jun 16 10:45 /dev/ttyS3

However, if I use a group name that isn't in /etc/groups (but is defined
in say NIS), then the group is set to root after a reboot - but using
the GID of that group works.

James Pearson
_______________________________________________
CentOS mailing list
[hidden email]
http://lists.centos.org/mailman/listinfo/centos
Reply | Threaded
Open this post in threaded view
|

Re: [CentOS] Odd issue with custom udev rule at boot

James A. Peltier
----- Original Message -----
| James A. Peltier wrote:
|
| > BTW: Can anyone try this to see if it is in fact a bug or not?
| >
| > Create a file called
| >
| > /etc/udev/rules.d/99-udev-override.rules
| >
| > that contains
| >
| > KERNEL=="tty[A-Z]*", GROUP="some_other_group_than_uucp",
| > MODE="0660", OPTIONS="last_rule"
| >
| > with mode of 0644 reboot and confirm that the group permissions
| > change or not. If you change the mode however you will see that the
| > mode *does* change.
|
| Works for me.
|
| Before:
|
| # ls -l /dev/ttyS*
| crw-rw---- 1 root uucp 4, 64 Jun 15 16:16 /dev/ttyS0
| crw-rw---- 1 root uucp 4, 65 Jun 15 16:16 /dev/ttyS1
| crw-rw---- 1 root uucp 4, 66 Jun 15 16:16 /dev/ttyS2
| crw-rw---- 1 root uucp 4, 67 Jun 15 16:16 /dev/ttyS3
|
| Created /etc/udev/rules.d/99-udev-override.rules containing:
|
| KERNEL=="tty[A-Z]*", GROUP="users", MODE="0660", OPTIONS="last_rule"
|
| After reboot:
|
| # ls -l /dev/ttyS*
| crw-rw---- 1 root users 4, 64 Jun 16 10:45 /dev/ttyS0
| crw-rw---- 1 root users 4, 65 Jun 16 10:45 /dev/ttyS1
| crw-rw---- 1 root users 4, 66 Jun 16 10:45 /dev/ttyS2
| crw-rw---- 1 root users 4, 67 Jun 16 10:45 /dev/ttyS3
|
| However, if I use a group name that isn't in /etc/groups (but is
| defined
| in say NIS), then the group is set to root after a reboot - but using
| the GID of that group works.
|
| James Pearson

AHA!  We use NIS here and I didn't even think that it wouldn't set the GROUP properly if it couldn't resolve it properly.  James, you're brilliant! That fixed it.

:)


--
James A. Peltier
IT Services - Research Computing Group
Simon Fraser University - Burnaby Campus
Phone   : 778-782-6573
Fax     : 778-782-3045
E-Mail  : [hidden email]
Website : http://www.sfu.ca/itservices
          http://blogs.sfu.ca/people/jpeltier


_______________________________________________
CentOS mailing list
[hidden email]
http://lists.centos.org/mailman/listinfo/centos