Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dd: opening `/dev/sdb': Permission denied

Tags:

flash

dd

I'm trying to write a linux image in a CF card, as is shown in *:

When I do:

sudo bzcat debian-for-alix-cf2g.img.bz2 | dd of=/dev/sdb bs=16k

I get:

dd: opening `/dev/sdb': Permission denied

I can see in mtab that /dev/sdb corresponds to the target CF conected to an USB port.

The line in the mtab file is

/dev/sdb1 /media/2020-2020 vfat rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush 0 0

Before executing

sudo bzcat debian-for-alix-cf2g.img.bz2 | dd of=/dev/sdb bs=16k

I unmounted the device with

umount /media/2020-2020

Why can't I write to /dev/sdb ?

like image 773
Guillermo Parada Avatar asked Sep 20 '12 19:09

Guillermo Parada


2 Answers

Try running it as root:

user ~ $ sudo -s
Password: 
root ~ # bzcat debian-for-alix-cf2g.img.bz2 | dd of=/dev/sdb bs=16k

The way you tried doesn't work probably because prepending sudo runs bzcat as root, but not dd.

like image 197
Blender Avatar answered Sep 21 '22 13:09

Blender


or put sudo after the pipe, | sudo dd...

sudo bzcat debian-for-alix-cf2g.img.bz2 | sudo dd of=/dev/sdb bs=16k

Although this might ask for password twice, so I actually prefer using sudo -s or sudo -i

like image 41
Martin W Avatar answered Sep 24 '22 13:09

Martin W