Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Questions about static /dev.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
unknown_person
n00b
n00b


Joined: 08 Apr 2020
Posts: 46

PostPosted: Wed Nov 04, 2020 9:46 pm    Post subject: [Solved] Questions about static /dev. Reply with quote

Hello, I decided to create a static /dev following the instructions from wiki.gentoo.org and using MAKEDEV, I did almost everything that is necessary for the system to work correctly, but at the moment there are a couple of questions left:
How to fill /dev/bus/usb and /dev/pts directories correctly? The first is required for applications that require direct access to USB ports, and the second for terminal applications.
How to create /dev/rtc0 correctly? MAKEDEV creates an rtc character device, but the hwclock daemon still says that it cannot access the RTC device.


Last edited by unknown_person on Thu Nov 05, 2020 5:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47126
Location: 56N 3W

PostPosted: Wed Nov 04, 2020 11:04 pm    Post subject: Reply with quote

unknown_person,

/dev/pts requires that you have
Code:
devpts                  /dev/pts        devpts                  rw,nosuid,noexec,relatime,gid=5,mode=620 0 0
in /etc/fstab.
Not much works without that.

/dev/bus/usb needs to be populated by mknod.
Create the directories. I have
Code:
$ ls -l /dev/bus/usb
total 60
drwxr-xr-x 2 root root 4096 Aug  1  2017 001
drwxr-xr-x 2 root root 4096 Aug  1  2017 002
drwxr-xr-x 2 root root 4096 Aug  1  2017 003
drwxr-xr-x 2 root root 4096 Aug  1  2017 004
drwxr-xr-x 2 root root 4096 Aug  1  2017 005
drwxr-xr-x 2 root root 4096 Aug  1  2017 006
drwxr-xr-x 2 root root 4096 Aug  1  2017 007
drwxr-xr-x 2 root root 4096 Jul 19  2019 008
drwxr-xr-x 2 root root 4096 Aug  1  2017 009
drwxr-xr-x 2 root root 4096 Aug  1  2017 010
drwxr-xr-x 2 root root 4096 Nov  8  2015 011
drwxr-xr-x 2 root root 4096 Nov  8  2015 012
drwxr-xr-x 2 root root 4096 Nov  8  2015 013
drwxr-xr-x 2 root root 4096 Nov  8  2015 014
drwxr-xr-x 2 root root 4096 Nov  8  2015 015
that one for each bus and a few spare.
Inside each directory I have
Code:
ls -l /dev/bus/usb/001
total 0
crw-rw-r-- 1 root usb 189, 0 Nov  8  2015 001
crw-rw-r-- 1 root usb 189, 1 Nov  8  2015 002
crw-rw-r-- 1 root usb 189, 2 Nov  8  2015 003
crw-rw-r-- 1 root usb 189, 3 Nov  8  2015 004
crw-rw-r-- 1 root usb 189, 4 Nov  8  2015 005
crw-rw-r-- 1 root usb 189, 5 Aug  1  2017 006
crw-rw-r-- 1 root usb 189, 6 Aug  1  2017 007
crw-rw-r-- 1 root usb 189, 7 Aug  1  2017 008
crw-rw-r-- 1 root usb 189, 8 Aug  1  2017 009
crw-rw-r-- 1 root usb 189, 9 Aug  1  2017 010

128 devices are permitted on a bus. so each bus starts with a minor device number 128 higher that the last.

The first device node on each bus is therefore
Code:
ls -l /dev/bus/usb/*/001
crw-rw-r-- 1 root usb 189,    0 Nov  8  2015 /dev/bus/usb/001/001
crw-rw-r-- 1 root usb 189,  128 Nov  8  2015 /dev/bus/usb/002/001
crw-rw-r-- 1 root usb 189,  256 Nov  8  2015 /dev/bus/usb/003/001
crw-rw-r-- 1 root usb 189,  384 Nov  8  2015 /dev/bus/usb/004/001
crw-rw-r-- 1 root usb 189,  512 Nov  8  2015 /dev/bus/usb/005/001
crw-rw-r-- 1 root usb 189,  640 Nov  8  2015 /dev/bus/usb/006/001
crw-rw-r-- 1 root usb 189,  768 Nov  8  2015 /dev/bus/usb/007/001
crw-rw-r-- 1 root usb 189,  896 Nov  8  2015 /dev/bus/usb/008/001
crw-rw-r-- 1 root usb 189, 1024 Aug  1  2017 /dev/bus/usb/009/001
crw-rw-r-- 1 root usb 189, 1052 Aug  1  2017 /dev/bus/usb/010/001


For /devlrtc* I have
Code:
ls /dev/rtc* -l
crw-r--r-- 1 root root  10, 135 May 12  2013 /dev/rtc
crw-r--r-- 1 root root 253,   0 Dec 19  2017 /dev/rtc0

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
unknown_person
n00b
n00b


Joined: 08 Apr 2020
Posts: 46

PostPosted: Thu Nov 05, 2020 1:48 pm    Post subject: Reply with quote

@NeddySeagoon: Thanks for the help, more or less /dev is now configured.
I also set up some other directories and files using data from devtmpfs like net, mqueue, shm and so on.
True, with rtc0 there is some oddity, if create a character device with a major number 254 (because this is the number assigned to rtc0 from devtmpfs), then it only works until the first reboot, after reboot hwclock again stops working and writes this error:
Code:
hwclock: cannot open /dev/rtc0: No such device or address
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47126
Location: 56N 3W

PostPosted: Thu Nov 05, 2020 2:32 pm    Post subject: Reply with quote

unknown_person,

Do the rtc /dev nodes get changed?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5055
Location: Dallas area

PostPosted: Thu Nov 05, 2020 2:39 pm    Post subject: Reply with quote

eudev sets it up this way
Code:
$ ls -la /dev/rtc*
lrwxrwxrwx 1 root root      4 Sep  3 00:49 /dev/rtc -> rtc0
crw------- 1 root root 253, 0 Sep  3 00:49 /dev/rtc0


Just looked at admin cd and it's the same, symlink.
The admin cd rtc0 was 254 though, I suppose it might float depending on what else gets there first.
_________________
PRIME x570-pro, 3700x, RX 550 - 5.8 zen kernel
Acer E5-575 (laptop), i3-7100u - i965 - 5.5 zen kernel
---both---
gcc 9.3.0, profile 17.1 (no-pie) amd64-no-multilib, eudev, openrc, openbox

The New OTW
Back to top
View user's profile Send private message
unknown_person
n00b
n00b


Joined: 08 Apr 2020
Posts: 46

PostPosted: Thu Nov 05, 2020 4:12 pm    Post subject: Reply with quote

@NeddySeagoon: Sorry, but I don't quite understand what you mean.
If you meant whether the rtc0 node changes after a reboot, then no.
As an experiment, I tried the following things:
Create a symlink rtc->rtc0.
There are no changes.

Create rtc with number 10 135 and rtc0 with number 254 0.
There are no changes.

Use rtc with number 10 135 instead rtc0.
hwclock will ignore this node:
Code:
Trying to open: /dev/rtc0
Trying to open: /dev/rtc
Trying to open: /dev/misc/rtc
No usable clock interface found.


Use rtc0 with number 253.
hwclock writes error:
Code:
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
ioctl(3, RTC_UIE_ON, 0): Inappropriate ioctl for device
Waiting in loop for time from /dev/rtc0 to change
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Inappropriate ioctl for device
...synchronization failed
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47126
Location: 56N 3W

PostPosted: Thu Nov 05, 2020 4:55 pm    Post subject: Reply with quote

unknown_person,

I have the following in my kernel.
Code:
  │ ┌───────────────────────────────────────────────────────────────────────────────────┐ │ 
  │ │      --- Real Time Clock                                                          │ │ 
  │ │      [*]   Set system time from RTC on startup and resume                         │ │ 
  │ │      (rtc0)  RTC used to set the system time                                      │ │ 
  │ │      [*]   Set the RTC time based on NTP synchronization                          │ │ 
  │ │      (rtc0)  RTC used to synchronize NTP adjustment                               │ │ 
  │ │      [ ]   RTC debug support                                                      │ │ 
  │ │      [*]   RTC non volatile storage support                                       │ │ 
  │ │            *** RTC interfaces ***                                                 │ │ 
  │ │      [*]   /sys/class/rtc/rtcN (sysfs)                                            │ │ 
  │ │      [*]   /proc/driver/rtc (procfs for rtcN)                                     │ │ 
  │ │      [*]   /dev/rtcN (character devices)                                          │ │ 


Thare are two ways the system time can be synced to the RTC.
The kernel can do it with [*] Set system time from RTC on startup and resume or /etc/init.d/hwclock can be used.

Which one do you use.
I think I try to use both.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5055
Location: Dallas area

PostPosted: Thu Nov 05, 2020 4:58 pm    Post subject: Reply with quote

Kernel, Kconfig says this
Code:
config RTC_INTF_DEV
    bool "/dev/rtcN (character devices)"
    default RTC_CLASS
    help
      Say yes here if you want to use your RTCs using the /dev
      interfaces, which "udev" sets up as /dev/rtc0 through
      /dev/rtcN.

      You may want to set up a symbolic link so one of these
      can be accessed as /dev/rtc, which is a name
      expected by "hwclock" and some other programs. Recent
      versions of "udev" are known to set up the symlink for you.

      If unsure, say Y.


Edit to add: this is from /var/log/dmesg
Code:
[    0.949012] rtc_cmos 00:02: RTC can wake from S4
[    0.949637] rtc_cmos 00:02: registered as rtc0
[    0.950182] rtc_cmos 00:02: setting system clock to 2020-09-03T05:49:41 UTC (1599112181)
[    0.950714] rtc_cmos 00:02: alarms up to one month, y3k, 114 bytes nvram, hpet irqs

_________________
PRIME x570-pro, 3700x, RX 550 - 5.8 zen kernel
Acer E5-575 (laptop), i3-7100u - i965 - 5.5 zen kernel
---both---
gcc 9.3.0, profile 17.1 (no-pie) amd64-no-multilib, eudev, openrc, openbox

The New OTW
Back to top
View user's profile Send private message
unknown_person
n00b
n00b


Joined: 08 Apr 2020
Posts: 46

PostPosted: Thu Nov 05, 2020 5:44 pm    Post subject: Reply with quote

Understood.
The point was because I forgot to add the rtc_cmos module to modules-load.d.
Thank you all for your help.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47126
Location: 56N 3W

PostPosted: Thu Nov 05, 2020 6:08 pm    Post subject: Reply with quote

unknown_person,

The lights were but nobody was home.
You had the /dev node but not the kernel support underneath.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum