bug: cant write to solaris partitioned disk

H.Rosmanith (kernel@wildsau.idv.uni.linz.at)
Thu, 14 Nov 2002 22:15:20 +0100 (MET)


hi,

after not being active on a solaris machine, I forgot the root-password.
since the machine is a blade100, I just plugged the harddisk to my
linux-workstation, mounted the filesystem with ufs, but no matter what,
I was not able to reset the root-password by modifying /mnt/etc/shadow,
allthough I had CONFIG_EXPERIMENTAL=y and CONFIG_UFS_FS_WRITE=y and
specifed -o ufstype=sun on the mount-command-line.

therefore, I tried a different approach: search the partition for
the string "root:cryptpw:1234:::::" and clear the root-pw with
"dd". so I specified "dd if=newrootpw of=/dev/hdc1 bs=4096 seek=10794 count=1"
(the 10794 are the result of the previous search-operation). since I
couldnt get "dd" to work, I wrote a small helperprog, which does an
"lseek(fd,4096*10794,SEEK_SET)" and then write the new shadow-entry with
the cleared root-pw. but that one failed too!! the error-code I got
was -EBADF. quite strange.

so I tried another approach, which worked: copy the *whole* solaris-partition
to my linux-disk, make a copy of that, modify the root-pw on the copy and
copy the whole partition back. that worked, and I am now logged in as
root with no password on the blade100 again (phew!).

so, what the bug seems to me: it is not possible to write() to a solaris
partition when previously, an lseek() operation has been performed, in
contrast, write()ing without lseek()ing *is* possible.

bug or feature?

please comment/fix, thank you,
herbert rosmanith

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/