12

I have connected an SD card to my notebook and I'm using it as my home partition. When I turn my computer on I have no problem reaching the home folder and subdirectories, but when I suspend it and resume, the system doesn't read the SD card. So it may freeze, forcing me to reboot the machine to get everything to work again.

Some useful info is:

  • MacBook Air 2016
  • macOS Sierra & Ubuntu 17.04 Dual boot
  • (Same problem also occurred on 16.10)

Some further info:

$ sudo LC_MESSAGES=POSIX lshw -c storage
*-usb                     
   description: Mass storage device
   product: Card Reader
   vendor: Apple
   physical id: 3
   bus info: usb@2:3
   logical name: scsi1
   version: 8.20
   serial: 000000000820
   capabilities: usb-3.00 scsi emulated scsi-host
   configuration: driver=usb-storage maxpower=896mA speed=5000Mbit/s

$ lsusb -vd 05ac:8406 is:
    Bus 002 Device 002: ID 05ac:8406 Apple, Inc. 
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x05ac Apple, Inc.
  idProduct          0x8406 
  bcdDevice            8.20
  iManufacturer           3 
  iProduct                4 
  iSerial                 5 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           44
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              224mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               4

Also the main difference is that before suspend lsblk shows my sdb1 device (which is my SD card mounted as /home). After wake-up lsblk command doesn't show my SD card and I can't reach my files on /home folder. Also I can't reconnect my SD card; it isn't recognized.

  • syslog – the most recent suspension happens from "May 9 22:56:01" at line 45263.

    The interesting parts appear to be:

    May  9 22:56:25 MacBookAir kernel: [ 5883.035573] PM: Finishing wakeup.
    May  9 22:56:25 MacBookAir kernel: [ 5883.035575] Restarting tasks ... 
    May  9 22:56:25 MacBookAir kernel: [ 5883.035795] usb 2-3: USB disconnect, device number 2
    [...snip...]
    May  9 22:56:26 MacBookAir kernel: [ 5884.869838] usb usb2-port3: cannot disable (err = -32)
    May  9 22:56:26 MacBookAir kernel: [ 5884.869942] xhci_hcd 0000:00:14.0: Cannot set link state.
    May  9 22:56:26 MacBookAir kernel: [ 5884.869969] usb usb2-port3: cannot disable (err = -32)
    
Robert Riedl
  • 4,351
Ege Sucu
  • 556
  • If you need privacy, having the /home directory on the harddisk and encrypt it would be better. – user258532 May 02 '17 at 14:49
  • @user258532 I have no problem with privacy. I am using SD memory because I have m.2 sata ssd which has 128 GB memory and 60-70% of it belongs to macOS. – Ege Sucu May 02 '17 at 19:13
  • Do you see any change in lsusb output before and after suspend/wake? – blvdeer May 09 '17 at 12:31
  • Since you can still interact with your system after wake-up, could you please include the content of /var/log/pm-suspend.log and /var/log/syslog in your question? You can use a pastie service if they don't fit into the question. – David Foerster May 09 '17 at 18:32
  • There was no log file called pm-suspend.log . However I copied the syslog file as pastebin. – Ege Sucu May 09 '17 at 20:09
  • @DavidFoerster mentioned in case you didin't realize my last edit. – Ege Sucu May 10 '17 at 20:47
  • It looks like there's a disconnect event right after system resumption for the USB card reader device in question (compare the bus and device numbers). I don't know how to investigate that further though. – David Foerster May 10 '17 at 23:57
  • suspend / hibernate has been problematic for ubuntu. are you able to interact with your system after wake up? (you only say home folder is inaccessible).. for me the usual thing was system would freeze waking up and I had to reboot. I tried several suggestions and finally settled with something which works :-D Does your suspend/wakeup works normally without SD card? – sbharti May 15 '17 at 10:01
  • Have you found a solution to this ? I suspect it might be connected to usb power management. – Robert Riedl Jan 18 '18 at 18:28
  • @RobertRiedl it seems like Apple doesn't like to sleep your device with SD card on it and it ejects the sd card from the system when it's going to sleep. The only solution is that to eject the drive, shut down the machine and reinsert the drive. :/ – Ege Sucu Jan 19 '18 at 11:26

3 Answers3

1

Had the exact same problem . Does also occur on windows 7-10.

Solution:

sudo gedit /lib/systemd/system-sleep/usbc.sh

then paste this into the empty document:

 #!/bin/sh

case "$1" in
        pre)

 echo -n "0000:00:14.0" | tee /sys/bus/pci/drivers/xhci_hcd/unbind



                ;;
esac


case "$1" in
        post)
 echo -n "0000:00:14.0" | tee /sys/bus/pci/drivers/xhci_hcd/bind

                ;;
esac

Save it and run chmod:

sudo chmod a+x /lib/systemd/system-sleep/usbc.sh

Then reboot and test

  • I don't really understand how this solution is intended to function, but I tried it anyway: MacBook Air 6,2 Early 2012, UbuntuStudio 20.04. Doesn't work, unfortunately. Be glad of any further hints! – J. Simon van der Walt Apr 30 '21 at 08:48
0

Some USB HDDs have firmware that forces them to sleep after periods of dis-use. Maybe this is your problem too.

Automounter is able to wake devices (https://help.ubuntu.com/community/Autofs).

I hope this will help you.

Eraseth
  • 376
0

Try to change the power settings so that it never suspends. That's what I had to do to ensure copying 128 GB to SD Card succeeded.

Keep your laptop plugged in, too.

mondotofu
  • 777