Subject: Re: access to device fails after update
To: Jukka Salmi <jukka-netbsd@2004.salmi.ch>
From: Michael Eriksson <Michael.Eriksson@era-t.ericsson.se>
List: current-users
Date: 06/20/2004 15:11:09
Jukka Salmi wrote:
> Jukka Salmi --> current-users (2004-06-16 09:35:33 +0200):
> > since I updated my current NetBSD i386 system (sources from yesterday)
> > I can't write images to CF cards anymore:
> > 
> > $ gzip -dc image.gz | wc -c                   
> >  5242880
> > $ gzip -dc image.gz | dd of=/dev/rwd0d bs=16k
> > dd: /dev/rwd0d: Invalid argument
> > 35+1 records in
> > 35+0 records out
> > 573440 bytes transferred in 1.712 secs (334953 bytes/sec)
> > 
> > This worked fine before, and still works fine when using NetBSD stable
> > with the same hardware.
> 
> Tracing dd reveals the following:
> 
> [...]
>    442 dd       CALL  read(0,0x804e000,0x4000)
>    442 dd       GIO   fd 0 read 2084 bytes
> [...]
>    442 dd       RET   read 2084/0x824
>    442 dd       CALL  __sigprocmask14(1,0x804c334,0xbfbfeaa0)
>    442 dd       RET   __sigprocmask14 0
>    442 dd       CALL  write(3,0x804e000,0x824)
>    442 dd       RET   write -1 errno 22 Invalid argument
> [...]

The raw device /dev/rwd0d can only do writes which are a multiple of
the block size (512 bytes). Solutions:

- Use the block device /dev/wd0d.
- Use "obs=16k conv=osync" instead of "bs=16k" as parameters to dd.

Good luck! :-)

/Micke