LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 01-11-2018, 09:24 AM   #1
nisargshah95
LQ Newbie
 
Registered: Feb 2014
Location: India
Distribution: Ubuntu 17.10
Posts: 20

Rep: Reputation: 1
Exclamation QEMU - Failed to initialize USB device 'usb-storage': Block node is read-only


I'm using QEMU version 2.10.1(Debian 1:2.10+dfsg-0ubuntu3.1) on an Ubuntu 17.10 64-bit system. I'm trying to start a VM with USB drive attached with the following command -

Code:
$ qemu-system-i386 -L . -m 256 -fda kolibri.img -boot a -localtime -vga vmware -net nic,model=rtl8139 -net user -soundhw ac97 -usb -usbdevice disk:format=raw:fat:/media/drive/drive/ -usbdevice tablet
I have a USB drive mounted on /media/drive/drive. I get the following response

Code:
qemu-system-i386: -usbdevice disk:format=raw:fat:/media/drive/drive/: '-usbdevice' is deprecated, please use '-device usb-...' instead
qemu-system-i386: -usbdevice tablet: '-usbdevice' is deprecated, please use '-device usb-...' instead
WARNING: Image format was not specified for 'kolibri.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
vvfat /media/drive/drive/ chs 1024,16,63
qemu-system-i386: -usbdevice disk:format=raw:fat:/media/drive/drive/: Failed to initialize USB device 'usb-storage': Block node is read-only
qemu-system-i386: -usbdevice disk:format=raw:fat:/media/drive/drive/: could not add USB device 'disk:format=raw:fat:/media/drive/drive/'
I can create files on /media/drive/drive with current user permissions. How do I fix it for the VM to start with the USB drive attached?
 
Old 01-11-2018, 09:45 AM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
'-usbdevice' is deprecated, please use ---> '-device usb-...
did you try that yet?
and this is what it is doing making read only
Code:
 Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
 Specify the 'raw' format explicitly to remove the restrictions.
gives examples of using the proper update calls ( -device usb- ) to mount usb device.

https://www.linux-kvm.org/page/USB_H...igned_to_Guest
 
1 members found this post helpful.
Old 01-14-2018, 10:40 AM   #3
nisargshah95
LQ Newbie
 
Registered: Feb 2014
Location: India
Distribution: Ubuntu 17.10
Posts: 20

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by BW-userx View Post
Thanks. I fixed the disk format issue, but specifying '-device usb-tablet' gives me an error

Code:
$ qemu-system-i386 -L . -m 256 -drive file=kolibri.img,media=disk,format=raw,if=floppy -boot a -localtime -vga vmware -net nic,model=rtl8139 -net user -soundhw ac97 -device usb-tablet -device usb-host,hostbus=2,hostaddr=10

qemu-system-i386: -device usb-tablet: No 'usb-bus' bus found for device 'usb-tablet'
Even removing usb-tablet gives the same error for usb-host

Code:
$ qemu-system-i386 -L . -m 256 -drive file=kolibri.img,media=disk,format=raw,if=floppy -boot a -localtime -vga vmware -net nic,model=rtl8139 -net user -soundhw ac97 -device usb-host,hostbus=2,hostaddr=10

qemu-system-i386: -device usb-host,hostbus=2,hostaddr=10: No 'usb-bus' bus found for device 'usb-host'
 
Old 01-14-2018, 02:15 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
looks like you missed a step,
is it written like this
Code:
-device usb-host,hostbus=2,hostaddr=3 to add the host's USB device at Bus 2, Device 3. Simple as that.
lsusb gives me this
Code:
Bus 005 Device 002: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy (MTP)
#that tell me I should write it as such
-device usb-host,hostbus=5,hostaddr=2
try writing it like that, but looking again you did, I suppose, then ther is tis]

Quote:
This HOWTO is limited to UHCI devices (no USB2 EHCI).
I found this on how to see what type of USB controler you're dealing with,

mine shows only the number 1 or 2 so even I am still lost if it is a UHCI or EHCI
https://wiki.debian.org/HowToIdentifyADevice/USB
 
Old 01-15-2018, 08:46 AM   #5
nisargshah95
LQ Newbie
 
Registered: Feb 2014
Location: India
Distribution: Ubuntu 17.10
Posts: 20

Original Poster
Rep: Reputation: 1
lsusb gives me
Code:
$ lsusb
Bus 001 Device 004: ID 0bda:5776 Realtek Semiconductor Corp. 
Bus 001 Device 003: ID 0bda:b001 Realtek Semiconductor Corp. 
Bus 001 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 013: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
Bus 002 Device 012: ID 04ca:0061 Lite-On Technology Corp. 
Bus 002 Device 011: ID 413c:2107 Dell Computer Corp. 
Bus 002 Device 010: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 002 Device 009: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Here "SanDisk Cruzer Blade" is my USB drive. So the hostbus and hostaddr values seem to be correct.

EDIT: It seems I was missing the -usb option to enable the USB driver. Thank you very much for the help!

Last edited by nisargshah95; 01-15-2018 at 08:54 AM. Reason: add info
 
Old 01-15-2018, 10:22 AM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
so its working now.. yes! enjoy!
 
  


Reply

Tags
qemu, qemu usb



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: QEMU 1.4 Improves USB 2.0, Block Device Mirroring LXer Syndicated Linux News 0 02-17-2013 10:10 PM
USB drive not working properly, read only device? (USB key storage device) Arodef Linux - Hardware 14 01-01-2010 07:32 AM
USB Mass Storage not mount 'Buffer I/O error on device sde, logical block 0' limdel Linux - Hardware 4 06-19-2009 10:35 AM
MP3 player (USB mass storage) not mountable anymore, no block-oriented device the who Slackware 8 09-07-2004 05:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 04:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration