Bug 9176

Summary: minnowboard : USB not mounted
Product: buildroot Reporter: CB <christophebricout>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: critical CC: buildroot, ezequiel, yann.morin.1998
Priority: P5    
Version: 2015.11   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: .config file
Linux kernel configuration (gzip)
Unix Kernel Configuration (simplified) (gzip)

Description CB 2016-08-15 17:31:51 UTC
Created attachment 6606 [details]
.config file

Dear All,

I have generated an image using buildroot, targeting minnowboard and the .config file. This image works fine and boot correctly on SD Card.

The problems seems to come when I am plugging an USB pendrive.

The device is "detected" but it is not mounted automatically.
The message displayed after inserting the USB pendrive is: "usb 1-1: new high-speed USB device number 2 using xhci_hcd".

I have tried to change the "dev managment" using the 3 buildroot options but the problem still occured.

To complete my point, the same USB pendrive is detected in a linux machine (CENTOS7).  By this way, we can reasonably say that the problem refers to the image generated by buildroot.

I am not able to figure out this issue.
Anyway, I can make some additional experiments.
Thanks in advance for your support.
Best Regards
Christophe
Comment 1 Ezequiel Garcia 2016-08-15 18:32:53 UTC
Hi,

I'm not sure why you are expecting your USB pendrive to be mounted automatically.
The device manager is certainly not going to do this out of the box.

There are several ways to do it, all of them documented at length.

1. Using an mdev script
   https://wiki.gentoo.org/wiki/Mdev/Automount_USB

2. Using udisks
   https://wiki.archlinux.org/index.php/udisks

3. Using autofs
   https://wiki.archlinux.org/index.php/autofs

I'm only using (1), so I have no idea about the other two, but you can find Buildroot packages for them, so I'd say it's possible.

This report doesn't seem valid, as you're .config is not selecting any of that. Can you double check and comment some more or close this?

Thanks!
Comment 2 CB 2016-08-17 20:26:08 UTC
Dear Ezequiel,

In order to clarify my issue, I made some additional test.
Please find here after the results 

SUMMARY: 

Using the default buildroot configuration paramaters, I am not able to mount an external USB. For information, linux was booting sucessfully from SDcard.
 
So, I would like to know if I missed some steps/actions on buildroot configuration in order to access an external USB drive .... 
Is that normal or a unix workaround is available.

Thanks in advance for your support.
I can make addionnal test.

Regards

Technical information: 

BUILDROOT VERSION:

I am using the last stable version of buildrppt (2016.05) and I am 
configuring  buildroot using minnowboard_max_defconfig file.

Note: The problem still exists with 2015.11.1


MINNOWBOARD MAX/TURBOT LOG FILE:

Here after, please find an extract of the screenshot.
The usb 2-1 device has been found but I am not able to mount it.

......       
usb 2-1: new SuperSpeed USB device number 2 using xhci_hcd                      
fbcon: inteldrmfb (fb0) is primary device                                       
input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1b.0/sound/ca4
input: HDA Intel PCH HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1b.0/sound/ca5
mmc2: new high speed SDHC card at address 0001                                  
mmcblk0: mmc2:0001 SD16G 14.6 GiB                                               
 mmcblk0: p1 p2  
Console: switching to colour frame buffer device 128x48                         
i915 0000:00:02.0: fb0: inteldrmfb frame buffer device                          
EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities    
EXT4-fs (mmcblk0p2): couldn't mount as ext2 due to feature incompatibilities    
EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem             
EXT4-fs (mmcblk0p2): write access will be enabled during recovery               
clocksource: Switched to clocksource tsc                                        
EXT4-fs (mmcblk0p2): recovery complete                                          
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)    
VFS: Mounted root (ext4 filesystem) readonly on device 179:2.                   
devtmpfs: mounted                                                               
Freeing unused kernel memory: 808K (ffffffff81783000 - ffffffff8184d000)        
EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered                             
Starting logging: OK                                                            
Initializing random number generator... random: dd urandom read with 10 bits ofe
done.    

Welcome to Buildroot                                                            
buildroot login: root   


MOUNT COMMAND :
                                                        
# mount                                                                         
/dev/root on / type ext4 (rw,relatime,data=ordered)                             
devtmpfs on /dev type devtmpfs (rw,relatime,size=975292k,nr_inodes=243823,mode=)
proc on /proc type proc (rw,relatime)                                           
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)                     
tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)                             
tmpfs on /tmp type tmpfs (rw,relatime)                                          
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)                    
sysfs on /sys type sysfs (rw,relatime)
Comment 3 Yann E. MORIN 2016-08-17 21:32:02 UTC
Christophe,

I'm a bit surprised that you say that you are "not able to mount an
external USB".

First, check that the partitions on the device are detected:

    $ cat /proc/partitions

If not, then you are missing a driver in your kernel (unlikely as you
said it was "detected").

Next, can you actually mount your USB drive manually, e.g. with:

    $ mkdir /tmp/test
    $ mount /dev/sda1 /tmp/test

If not, you might be missing support for that filesystem in the kernel.

If something was not working so far, then you need to adapt your Linux
kernel configuration to enable additional support (be it a driver or a
filesystem or both):

    $ make linux-menuconfig
       (and then enable the missing pieces)
    $ make

And then restart from the beginning.

If everything works so far, then it means you are missing to mount the
partitions dynamically. You have to know that block devices are never
automounted by the kernel; you need a userspace program for that.

Ezequiel provided a list of possible solution to make the partitions
mounted automatically.

Regards,
Yann E. MORIN.
Comment 4 CB 2016-08-18 20:55:18 UTC
Created attachment 6616 [details]
Linux kernel configuration (gzip)
Comment 5 CB 2016-08-18 21:02:47 UTC
Dear Yann and Ezequiel,

According to yours remarks, I made some more investigation.
The problem is solved!
Indeed, the default Kernel configuration for minnowboard was not handling USB.
After uptadting the kernel configuration (see attachment), I succeeded mount the USB devices manually.

So, I think it could interessting to updqte the default configuration in order to match minnowboard. Up to you.

Anyway, thanks for your help
Best regards
Christophe
Comment 6 CB 2016-08-21 12:34:24 UTC
Created attachment 6621 [details]
Unix Kernel Configuration (simplified) (gzip)

Hi,

Please find kernel config file for minnowboard simplified and working for mass storage.

Best Regards
Comment 7 Ezequiel Garcia 2016-08-22 00:27:22 UTC
Hi Christophe,

Comparing the last config file you attached against current 4.x config board/minnowboard/linux-4.6.config, I cannot see any added options that would make this work.

Could you mind trying this using "make minnowboard_max_defconfig"? It uses board/minnowboard/linux-4.6.config. Given the above I suspect it will work just fine.

Of ocurse, if we are missing any option, it would be great to add it.

Thanks a lot!
Ezequiel
Comment 8 CB 2016-08-22 17:16:09 UTC
(In reply to Ezequiel Garcia from comment #7)
Dear Ezequiel,

You are right about the kernel version. On the buildroot version 2016.08, the kernel version is 4.6 but still some parameters are missing. (I think).
See the comment added at the end of the last file I sent.

Anyway, here after the missing parameters:
CONFIG_BLK_DEV_SD=y
CONFIG_USB_STORAGE=y

Futhermore, in order to mount autmatically an external USB drive, I modified the fstab file. Minnowboard worked fine also with distribution selecting systemd capabilities.

Lastly, I found some strange behaviour using rootfs skeleton custom. I will probably open a new ticket. Indeed, some confguration seems to no more be considered when selecting the rootfs skeleton option....Before, I will check with the last buildroot...


Anyway, regarding the current ticket (Bug 9176), for me it is solved.
Thanks for your support (Yann and You).
Best Regards
Christophe

Best Regards
Comment 9 Ezequiel Garcia 2016-08-22 17:30:26 UTC
CONFIG_BLK_DEV_SD=y
Comment 10 Ezequiel Garcia 2016-08-22 17:32:26 UTC
(In reply to CB from comment #8)

CONFIG_BLK_DEV_SD=y
CONFIG_USB_STORAGE=y

Both options are currently enabled, so you shouldn't be missing anything.

Thanks!
Comment 11 Ezequiel Garcia 2016-08-22 17:34:37 UTC
Oops, I suddenly realized I was looking at a branch where those two options were enabled. Sorry about that, I'll push a patch adding them upstream.

Thanks for the report,
Ezequiel