dd: opening `/dev/sdb': Permission denied [closed]
Asked Answered
M

2

11

I'm trying to write a Linux image in a CF card, as is shown in Google Code Archive: debian-for-alix - InstalationAndFirstSteps.wiki:

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 connected to a 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 ?

Mammalian answered 20/9, 2012 at 19:40 Comment(0)
A
14

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.

Angelitaangell answered 20/9, 2012 at 19:42 Comment(0)
K
6

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

Kutuzov answered 3/8, 2013 at 15:45 Comment(1)
A useful answer. Would you edit it to be a complete example please?Boiardo

© 2022 - 2024 — McMap. All rights reserved.