This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Why the /sys directory is empty?

Hello

      I cut down my linux code(2.6.37) to reduce the size. but now, when I login into linux, type "ls /sys", there is nothing.

      before cutting, I can see device/bus/class  and so on. I don't know which files or configure I delete affect this??

Thanks!

BR

Vincent

 

  • Kindly confirm that "sys-fs" is mounted. (using mount command)

    to mount sysfs use below command

    mount -t sysfs sysfs /sys

  • Vincent,

    If mount fails then do the following

    1.Check if the sysfs files are present under fs/sysfs/

    2. Check CONFIG_SYSFS is enabled in your configuration (if not, enable it through menuconfig)

     

    Regards,

    RK

     

  • Thanks all!

    to Gururaja

        I try your method and it is OK.

        but still has questions: I want to mount automatically and I think it relate with /etc/fstab. but I didn't modify this file. Is there any other flie which control auto mount? I mean it can auto mount before, but can't now.

        Also I add mount info to /etc/fstab

    rootfs               /                    auto       defaults              1  1
    proc                 /proc                proc       defaults              0  0
    devpts               /dev/pts             devpts     mode=0620,gid=5       0  0
    usbfs                /proc/bus/usb        usbfs      defaults              0  0
    tmpfs                /var/volatile        tmpfs      defaults,size=16M     0  0
    tmpfs                /dev/shm             tmpfs      mode=0777             0  0
    tmpfs                /media/ram           tmpfs      defaults,size=16M     0  0

    sysfs  /sys  sysfs  defaults  0   0

    /dev/mmcblk0p1       /media/mmcblk0p1          auto       defaults,sync,noauto  0  0
    /dev/mmcblk0p2       /media/mmcblk0p2          auto       defaults,sync,noauto  0  0

     

    but when I login into linux, type "mount", it display:

    rootfs on / type rootfs (rw)
    /dev/root on / type ext3 (rw,relatime,errors=continue,barrier=0,data=writeback)
    devtmpfs on /dev type devtmpfs (rw,relatime,size=21780k,nr_inodes=5445,mode=755)
    proc on /proc type proc (rw,relatime)

    It seems the /etc/fstab hasn't been run?

     

    BR

    Vincent

  • could you show us the part "Pseudo filesystems" inside file ".config" under your linux kernel folder? 

  • Hi Jack

         I compare to the original .config, I find this part is not changed.

    #
    # Pseudo filesystems
    #
    CONFIG_PROC_FS=y
    CONFIG_PROC_SYSCTL=y
    CONFIG_PROC_PAGE_MONITOR=y
    CONFIG_SYSFS=y
    CONFIG_TMPFS=y
    # CONFIG_TMPFS_POSIX_ACL is not set
    # CONFIG_HUGETLB_PAGE is not set
    # CONFIG_CONFIGFS_FS is not set
    CONFIG_MISC_FILESYSTEMS=y
    # CONFIG_ADFS_FS is not set
    # CONFIG_AFFS_FS is not set
    # CONFIG_ECRYPT_FS is not set
    # CONFIG_HFS_FS is not set
    # CONFIG_HFSPLUS_FS is not set
    # CONFIG_BEFS_FS is not set
    # CONFIG_BFS_FS is not set
    # CONFIG_EFS_FS is not set
    CONFIG_JFFS2_FS=y
    CONFIG_JFFS2_FS_DEBUG=0
    CONFIG_JFFS2_FS_WRITEBUFFER=y
    CONFIG_JFFS2_FS_WBUF_VERIFY=y
    # CONFIG_JFFS2_SUMMARY is not set
    # CONFIG_JFFS2_FS_XATTR is not set
    # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
    CONFIG_JFFS2_ZLIB=y
    # CONFIG_JFFS2_LZO is not set
    CONFIG_JFFS2_RTIME=y
    # CONFIG_JFFS2_RUBIN is not set
    CONFIG_UBIFS_FS=y
    # CONFIG_UBIFS_FS_XATTR is not set
    # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
    CONFIG_UBIFS_FS_LZO=y
    CONFIG_UBIFS_FS_ZLIB=y
    # CONFIG_UBIFS_FS_DEBUG is not set
    # CONFIG_LOGFS is not set
    # CONFIG_CRAMFS is not set
    # CONFIG_SQUASHFS is not set
    # CONFIG_VXFS_FS is not set
    # CONFIG_MINIX_FS is not set
    # CONFIG_OMFS_FS is not set
    # CONFIG_HPFS_FS is not set
    # CONFIG_QNX4FS_FS is not set
    # CONFIG_ROMFS_FS is not set
    # CONFIG_SYSV_FS is not set
    # CONFIG_UFS_FS is not set
    CONFIG_NETWORK_FILESYSTEMS=y
    CONFIG_NFS_FS=y
    CONFIG_NFS_V3=y
    # CONFIG_NFS_V3_ACL is not set
    CONFIG_NFS_V4=y
    # CONFIG_NFS_V4_1 is not set
    CONFIG_ROOT_NFS=y
    # CONFIG_NFS_USE_LEGACY_DNS is not set
    CONFIG_NFS_USE_KERNEL_DNS=y
    # CONFIG_NFS_USE_NEW_IDMAPPER is not set
    # CONFIG_NFSD is not set
    CONFIG_LOCKD=y
    CONFIG_LOCKD_V4=y
    CONFIG_NFS_COMMON=y
    CONFIG_SUNRPC=y
    CONFIG_SUNRPC_GSS=y
    CONFIG_RPCSEC_GSS_KRB5=y
    # CONFIG_CEPH_FS is not set
    # CONFIG_CIFS is not set
    # CONFIG_NCP_FS is not set
    # CONFIG_CODA_FS is not set
    # CONFIG_AFS_FS is not set

  • could you list the deleted files and configurations ?

  • pls also show us /etc/mtab and /proc/mounts.

  • Hi Jack

        Sorry I modify too many files and I can't list detail.

    root@(none):~# cat /etc/mtab
    rootfs / rootfs rw 0 0
    /dev/root / ext3 rw,relatime,errors=continue,barrier=0,data=writeback 0 0
    devtmpfs /dev devtmpfs rw,relatime,size=21780k,nr_inodes=5445,mode=755 0 0
    proc /proc proc rw,relatime 0 0

    root@(none):/proc# cat mounts
    rootfs / rootfs rw 0 0
    /dev/root / ext3 rw,relatime,errors=continue,barrier=0,data=writeback 0 0
    devtmpfs /dev devtmpfs rw,relatime,size=21780k,nr_inodes=5445,mode=755 0 0
    proc /proc proc rw,relatime 0 0

     

  • could you attach .config?

    did you modify something in file system? if yes, what's that?

  • Hi Jack

         I delete too many files in file system to cut down linux size and I can't remember which file affect this.

  • pls mark following and show us the /etc/mtab.

    #usbfs                /proc/bus/usb        usbfs      defaults              0  0

  • Hi Jack

        I comment this line in /etc/fstab. the content of /etc/mtab has no change.

        I guess what's your mean is when kernel run /etc/fstab, it meet this line and failed, so the rest of /etc/fstab can't be run?

        In /etc/mtab, I can see this line

        devtmpfs /dev devtmpfs rw,relatime,size=21780k,nr_inodes=5445,mode=755 0 0

         but in /etc/fstab, I can't find this one before usbfs line, even in the whole file. How this line in /etc/mtab is generated?

        Thanks!

  •  I guess what's your mean is when kernel run /etc/fstab, it meet this line and failed, so the rest of /etc/fstab can't be run?

    - no. just because usbfs is supported by CONFIG_USB_DEVICEFS. But I didn't see that in your .config. You may have
    #
    # Miscellaneous USB options
    #
    CONFIG_USB_DEVICEFS=y
    CONFIG_USB_DEVICE_CLASS=y
    # CONFIG_USB_DYNAMIC_MINORS is not set
    CONFIG_USB_SUSPEND=y
    # CONFIG_USB_OTG is not set
    # CONFIG_USB_MON is not set
    # CONFIG_USB_WUSB is not set
    # CONFIG_USB_WUSB_CBAF is not set


     but in /etc/fstab, I can't find this one before usbfs line, even in the whole file. How this line in /etc/mtab is generated?

    - it's a kernel's option
    Device Drivers --->
    Generic Driver Options --->
    (/sbin/hotplug) path to uevent helper
    [*] Maintain a devtmpfs filesystem to mount at /dev
    [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs
    [*] Select only drivers that don't need compile-time external firmware
    [*] Prevent firmware from being built

  • could you attach your boot log?

  • Hi Jack

         If I add "mount -t sysfs sysfs /sys" to script in \etc\rc5.d, mount can be ok.

        Below is the boot log:

    reading uImage

    1893524 bytes read
    ## Booting kernel from Legacy Image at 80009000 ...
       Image Name:   Linux-2.6.37
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    1893460 Bytes = 1.8 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37 (user@user-laptop) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #90 Fri Apr 19 15:09:00 CST 2013
    CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7f
    CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
    Machine: ti811xevm
    ti81xx_reserve: ### Reserved DDR region @82f00000
    reserved size = 0 at 0x0
    Memory policy: ECC disabled, Data cache writeback
    OMAP chip is TI811X 1.0
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 11936
    Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootwait mem=48M@0x80000000 ip=off noinitrd
    PID hash table entries: 256 (order: -2, 1024 bytes)
    Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
    Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
    Memory: 47MB = 47MB total
    Memory: 43560k/43560k available, 5592k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
        vmalloc : 0xc3800000 - 0xf8000000   ( 840 MB)
        lowmem  : 0xc0000000 - 0xc3000000   (  48 MB)
        pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
        modules : 0xbf000000 - 0xbfe00000   (  14 MB)
          .init : 0xc0008000 - 0xc0032000   ( 168 kB)
          .text : 0xc0032000 - 0xc0397000   (3476 kB)
          .data : 0xc0398000 - 0xc03cae80   ( 204 kB)
    SLUB: Genslabs=11, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    NR_IRQS:375
    omap_hwmod: gpio1: softreset failed (waited 10000 usec)
    omap_hwmod: gpio2: softreset failed (waited 10000 usec)
    omap_hwmod: gpio3: softreset failed (waited 10000 usec)
    omap_hwmod: gpio4: softreset failed (waited 10000 usec)
    omap_hwmod: gpio5: softreset failed (waited 10000 usec)
    omap_hwmod: gpio6: softreset failed (waited 10000 usec)
    IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    Total of 128 interrupts on 1 active controller
    GPMC revision 6.0
    Trying to install interrupt handler for IRQ368
    Trying to install interrupt handler for IRQ369
    Trying to install interrupt handler for IRQ370
    Trying to install interrupt handler for IRQ371
    Trying to install interrupt handler for IRQ372
    Trying to install interrupt handler for IRQ373
    Trying to install interrupt handler for IRQ374
    Trying to install type control for IRQ375
    Trying to set irq flags for IRQ375
    OMAP clockevent source: GPTIMER1 at 20000000 Hz
    Console: colour dummy device 80x30
    Calibrating delay loop... 598.01 BogoMIPS (lpj=2990080)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    devtmpfs: initialized
    TI81XX: Map 0x82f00000 to 0xfe500000 for dram barrier
    TI81XX: Map 0x40300000 to 0xfe600000 for sram barrier
    omap_voltage_early_init: voltage driver support not added
    regulator: core version 0.5
    regulator: dummy:
    NET: Registered protocol family 16
    omap_voltage_domain_lookup: Voltage driver init not yet happened.Faulting!
    omap_voltage_add_dev: VDD specified does not exist!
    OMAP GPIO hardware version 0.1
    OMAP GPIO hardware version 0.1
    OMAP GPIO hardware version 0.1
    OMAP GPIO hardware version 0.1
    OMAP GPIO hardware version 0.1
    OMAP GPIO hardware version 0.1
    omap_mux_init: Add partition: #1: core, flags: 4
    bio: create slab <bio-0> at 0
    omap_i2c omap_i2c.1: bus 1 rev4.0 at 100 kHz
    Switching to clocksource gp timer
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 2048 (order: 2, 16384 bytes)
    TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
    TCP: Hash tables configured (established 2048 bind 2048)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    NetWinder Floating Point Emulator V0.97 (double precision)
    PMU: registered new PMU device of type 0
    omap-iommu omap-iommu.0: ducati registered
    omap-iommu omap-iommu.1: sys registered
    JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
    msgmni has been set to 85
    io scheduler noop registered
    io scheduler deadline registered
    io scheduler cfq registered (default)
    omap_uart.0: ttyO0 at MMIO 0x48020000 (irq = 72) is a OMAP UART0
    console [ttyO0] enabled
    brd: module loaded
    loop: module loaded
    m25p80 spi1.0: n25q128 (16384 Kbytes)
    Creating 5 MTD partitions on "spi_flash":
    0x000000000000-0x000000020000 : "U-Boot-min"
    0x000000020000-0x000000060000 : "U-Boot"
    0x000000060000-0x000000080000 : "U-Boot Env"
    0x000000080000-0x000000300000 : "Kernel"
    0x000000300000-0x000001000000 : "File System"
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
    davinci_mdio davinci_mdio.0: no live phy, scanning all
    davinci_mdio: probe of davinci_mdio.0 failed with error -5
    mice: PS/2 mouse device common for all mice
    omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
    i2c /dev entries driver
    OMAP Watchdog Timer Rev 0x00: initial timeout 60 sec
    TCP cubic registered
    NET: Registered protocol family 17
    Registering the dns_resolver key type
    VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    omap_voltage_late_init: Voltage driver support not added
    Power Management for TI81XX.
    Detected MACID=e0:c7:9d:5a:ef:cc
    omap_rtc omap_rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
    Waiting for root device /dev/mmcblk0p2...
    mmc0: host does not support reading read-only switch. assuming write-enable.
    mmc0: new high speed SDHC card at address e624
    mmcblk0: mmc0:e624 SU04G 3.69 GiB
     mmcblk0: p1 p2
    EXT3-fs: barriers not enabled
    kjournald starting.  Commit interval 5 seconds
    EXT3-fs (mmcblk0p2): warning: maximal mount count reached, running e2fsck is recommended
    EXT3-fs (mmcblk0p2): using internal journal
    EXT3-fs (mmcblk0p2): recovery complete
    EXT3-fs (mmcblk0p2): mounted filesystem with writeback data mode
    VFS: Mounted root (ext3 filesystem) on device 179:2.
    devtmpfs: mounted
    Freeing init memory: 168K
    INIT: version 2.86 booting
    INIT: Entering runlevel: 5
    Removing stale PID file /var/run/dbus/pid.
    Starting system message bus: dbus.
    Starting telnet daemon.
    Starting syslogd/klogd: done

     _____                    _____           _         _
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|
                  |___|                    |___|

    Arago Project http://arago-project.org (none) ttyO0

    Arago 2011.09 (none) ttyO0

    (none) login:

     

  • good!

    so let me confirm your /etc/inittab finally

    # /etc/inittab: init(8) configuration.
    # $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

    # The default runlevel.
    id:5:initdefault:

    # Boot-time system configuration/initialization script.
    # This is run first except when booting in emergency (-b) mode.
    si::sysinit:/etc/init.d/rcS
       |
       |
       -----> did you have this ?   if yes, did you have /etc/rcS.d/S03sysfs ?  if yes, then you don't need to do the mount. 

  • Hi Jack

         You are right, I find /etc/rcS.d/S03sysfs was deleted. I restore the file and the contents of /sys appear. Thanks!

         But why I add these two line in /etc/fstab can't take effect?

    sysfs                /sys                 sysfs      defaults              0  0

    /dev/mmcblk0p2       /media/mmcblk0p2          auto       defaults,sync,noauto  0  0

     

    BR

    Vincent