Package related questions: pkg_info, pkg_add, etc.

2010-01-21 Thread Song Li
Hi:

I am really a newbie on OpenBSD. So my question might look stupid to you.

I am using the current release 4.6 installed from the file
install46.iso  on ftp://openbsd.ftp.fu-berlin.de/pub/OpenBSD/4.6/i386/

Have anyone encountered any problem using pkg_info, pkg_add, etc.?
They do not seem working to me.

Take a simplest example, when I checked pkg_info, the man page says:
...
-A Show information for all currently installed packages,
including internal packages
...
but when I typed "pkg_info -A", it does not return anything. Just
silently back to the commond line prompt. Similarly, "-a" does not
work either.


I also tryed "pkg_info man46.tgz", "pkg_info -L man46.tgz" and none of
them gave me any response. (with man46.tgz in the current directory)

For pkg_add, I tried the following command:
pkg_add man46.tgz   (again, man46.tgz is in the current directory)
and it responded:
Can't resolve man46.tgz
and
pkg_add man46(with "export PKG_PATH=/mnt/cdrom/4.6/i386")
and it responded:
Can't find CONTENTS from file:/mnt/cdrom/4.6/i386/man46.tgz
/usr/sbin/pkg_add: man46: Fatal error
and another try:
pkg_add ./man46
gives similar response:
Can't find CONTENTS from file:./man46.tgz
/usr/sbin/pkg_add: man46: Fatal error

It seems like man46.tgz has a wrong format (with missing CONTENTS?)
but all the other .tgz files on the CD (from install46.iso) have the
same problem.

In addition, it seems that "pkg_add ./man46" is more like the correct
command than "pkg_add man46.tgz". However, "man packages" says:

... Adding a new package is as simple as
pkg_add foo-1.0-vanilla.tgz

So I am quite confused (regarding the suffix .tgz, keep it or not?).
How should we really use the command pkg_info and pkg_add? Are the
manuals up-to-date?

These problems are not critical problems since we can probably just go
through the scripts of these commands and see what's inside and maybe
there is just a easy way to fix it. My question is, however,

1) Did I get the corrent release file? The sha sum of my iso matches
the key listed on their web (d53855c34bfa2d7b46f643ca4de8cc55debd8524)
but I have not checked other sites yet.
2) The usage of pkg_add and pkg_info seems to be different from the
FreeBSD version. And OpenBSD seems also using its own set of basic
commands like cp instead of GNU set. So I wonder maybe I missed
something basic for OpenBSD users?
3) are such problems common to OpenBSD users and how people usually
solve such problems? Built-in manual (seems not very reliable to me)
or search the web? It seems a little annoying to get stucked with such
basic things.

Any comments on the specific package problems or the above general
questions on OpenBSD are much appreciated. Thanks.

Best,

Song

ps. even though I do not think it's relevant to dmesg output, I think
it does not hurt so I still paste it here:

= dmesg 
OpenBSD 4.6 (GENERIC.MP) #89: Thu Jul  9 21:32:39 MDT 2009
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: Intel(R) Core(TM)2 Duo CPU T9300 @ 2.50GHz ("GenuineIntel"
686-class) 2.50 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR
real mem  = 3756036096 (3582MB)
avail mem = 3647295488 (3478MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 11/19/08, BIOS32 rev. 0 @
0xffa10, SMBIOS rev. 2.4 @ 0xf71e0 (45 entries)
bios0: vendor Dell Inc. version "A12" date 11/19/2008
bios0: Dell Inc. XPS M1530
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP HPET APIC MCFG SLIC OSFR BOOT SSDT
acpi0: wakeup devices PCI0(S5) PCIE(S4) USB1(S0) USB2(S0) USB3(S0)
USB4(S0) USB5(S0) EHC2(S0) EHCI(S0) AZAL(S3) RP01(S5) RP02(S3)
RP03(S3) RP04(S3) RP05(S3) RP06(S3) LID_(S3) PBTN(S4) MBTN(S5)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 199MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU T9300 @ 2.50GHz ("GenuineIntel"
686-class) 2.50 GHz
cpu1: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,CX16,xTPR
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 2
acpiprt0 at acpi0: bus 3 (PCIE)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 9 (RP01)
acpiprt3 at acpi0: bus 11 (RP02)
acpiprt4 at acpi0: bus -1 (RP03)
acpiprt5 at acpi0: bus -1 (RP04)
acpiprt6 at acpi0: bus 12 (RP05)
acpiprt7 at acpi0: bus -1 (RP06)
acpiprt8 at acpi0: bus 0 (PCI0)
acpicpu0 at acpi0: C3, C2, C1, PSS
acpicpu1 at acpi0: C3, C2, C1, PSS
acpitz0 at acpi0: critical temperature 126 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: PBTN
acpibtn2 at acpi0: SBTN
acpiac0 at 

Another question: device naming convention

2010-01-21 Thread Song Li
Hi,

Here comes a question again: what's the naming convention of the
device on OpenBSD?

I am still using the newly installed OpenBSD release 4.6.

It did take me some effort to find out the name of device for me to
use with fdisk and mount:

fdisk /dev/rwd0c
and
mount /dev/sd0i

The first one is especially confusing to me since other attemps like
"fdisk /dev/rwd0a", "fdisk /dev/rwd0d" do not work. In face, the
examples given by the man page of fdisk use "fdisk /dev/wd0" for mbr
and "fdisk /dev/rwd0c" for the OpenBSD. It does make perfect sense to
me. On my OpenBSD system, however, fdisk cannot find device /dev/wd0
and "fdisk /dev/rwd0c" gives the mbr information. This seems very
confusing to me.

For the mount device: what's the device naming convention and the
rationale behind it? I do not think it's a good idea to search through
all the device and find out the device name. Linux and FreeBSD use
slightly different convention but they both make sense to me. What
about OpenBSD?


For your reference, the output of various fdisk commands is listed
below. The first one gives correct information.

Disk: /dev/rwd0cgeometry: 15566/255/63 [250069680 Sectors]
Offset: 0   Signature: 0xAA55
Starting Ending LBA Info:
 #: id  C   H   S -  C   H   S [   start:size ]
---
 0: 07  0   1   1 -   8923 254  63 [  63:   143363997 ] NTFS
 1: 83   8924   0   1 -  10941 254  63 [   143364060:32419170 ] Linux files*
 2: A5  13425   0   1 -  15565 254  63 [   215672625:34395165 ] FreeBSD
*3: A6  10942   0   1 -  13424 254  63 [   175783230:39889395 ] OpenBSD
Disk: /dev/rwd0ageometry: 15566/255/63 [250069680 Sectors]
Offset: 0   Signature: 0xAA55
Starting Ending LBA Info:
 #: id  C   H   S -  C   H   S [   start:size ]
---
 0: E8  15356  77   8 - 229721 118   4 [   246698998:  3443776305 ] 
 1: 01  0   0   1 - 267349  89   4 [   0:   0 ] DOS FAT-12
 2: 00  0   0   0 -  0   0   0 [   0:   0 ] unused
 3: 3F  0   0   1 - 267349  89   4 [   0:   0 ] 
Disk: /dev/rwd0bgeometry: 15566/255/63 [250069680 Sectors]
Offset: 0   Signature: 0x3834
Starting Ending LBA Info:
 #: id  C   H   S -  C   H   S [   start:size ]
---
 0: 20  58716   3  28 - 118439 184  60 [   943272756:   959461431 ] Willowsoft
 1: 31  52413  63  48 - 100661  37  61 [   842018861:   775102496 ] 
 2: 37  57639  15  25 - 115302 140  12 [   925971504:   926363958 ] 
 3: 31  53486  55  56 - 104879 180  37 [   859256110:   825636402 ] 
Disk: /dev/rwd0dgeometry: 15566/255/63 [250069680 Sectors]
Offset: 0   Signature: 0x3831
Starting Ending LBA Info:
 #: id  C   H   S -  C   H   S [   start:size ]
---
 0: 00  0   0   0 -  0   0   0 [   0:   0 ] unused
 1: 73  75192 139  32 -  75194  99  17 [  1207968268:   29596 ] 
 2: 03  1 215   4 -  58686  13   6 [   29613:   942761802 ] XENIX /usr
 3: 08  37963  38  28 - 145529 126  55 [   609878016:  1728053362 ] AIX fs



Re: Another question: device naming convention

2010-01-21 Thread Song Li
Hi Johan,

Thank you for the info. They are quite helpful. It seems like I have
to read quite some documents on the same things I have been used to
work with on Linux and FreeBSD ...

On Fri, Jan 22, 2010 at 6:04 AM, Johan Beisser  wrote:
> On Thu, Jan 21, 2010 at 8:42 PM, Song Li  wrote:
>
>> For the mount device: what's the device naming convention and the
>> rationale behind it? I do not think it's a good idea to search through
>> all the device and find out the device name. Linux and FreeBSD use
>> slightly different convention but they both make sense to me. What
>> about OpenBSD?
>
> Read intro(4), sd(4), wd(4) and disklabel(5)/disklabel(8).
>
> The naming comes from the driver itself: sd is scsi disk, wd is
> "WD100x compatible hard disk driver." It depends on the upper level
> driver to determine the device name.
>
> The 'r' prefix, "rsd0" for example, is the raw device. It's rare
> you'll need to access it, but it does happen occasionally.



Re: Package related questions: pkg_info, pkg_add, etc.

2010-01-21 Thread Song Li
Thank you Bret. I can see that now after Aaron's comments and yours.

cheers,

Song

On Fri, Jan 22, 2010 at 6:34 AM, Bret S. Lambert 
wrote:
> On Fri, Jan 22, 2010 at 05:27:39AM +0100, Song Li wrote:
>> Hi:
>>
>> I am really a newbie on OpenBSD. So my question might look stupid to you.
>>
>> I am using the current release 4.6 installed from the file
>> install46.iso  on ftp://openbsd.ftp.fu-berlin.de/pub/OpenBSD/4.6/i386/
>>
>> Have anyone encountered any problem using pkg_info, pkg_add, etc.?
>> They do not seem working to me.
>>
>> Take a simplest example, when I checked pkg_info, the man page says:
>> ...
>> -A Show information for all currently installed packages,
>> including internal packages
>> ...
>> but when I typed "pkg_info -A", it does not return anything. Just
>> silently back to the commond line prompt. Similarly, "-a" does not
>> work either.
>>
>>
>> I also tryed "pkg_info man46.tgz", "pkg_info -L man46.tgz" and none of
>> them gave me any response. (with man46.tgz in the current directory)
>
> Base tarballs are not managed with the pkg_* tools. I can see why you
> made that assumption, but your assumption is incorrect; pkg_* only
> deals with precompiled 3rd-party software.



Re: Another question: device naming convention

2010-01-21 Thread Song Li
On Fri, Jan 22, 2010 at 6:44 AM, Bret S. Lambert 
wrote:
> On Fri, Jan 22, 2010 at 05:42:25AM +0100, Song Li wrote:
>> Hi,
>>
>> Here comes a question again: what's the naming convention of the
>> device on OpenBSD?
>>
>> I am still using the newly installed OpenBSD release 4.6.
>>
>> It did take me some effort to find out the name of device for me to
>> use with fdisk and mount:
>>
>> fdisk /dev/rwd0c
>> and
>> mount /dev/sd0i
>>
>> The first one is especially confusing to me since other attemps like
>> "fdisk /dev/rwd0a", "fdisk /dev/rwd0d" do not work. In face, the
>> examples given by the man page of fdisk use "fdisk /dev/wd0" for mbr
>> and "fdisk /dev/rwd0c" for the OpenBSD. It does make perfect sense to
>> me. On my OpenBSD system, however, fdisk cannot find device /dev/wd0
>> and "fdisk /dev/rwd0c" gives the mbr information. This seems very
>> confusing to me.
>
> It works for me here on my sd device:
>
> $ fdisk sd0
> Disk: sd0   geometry: 20673/240/63 [312581808 Sectors]
> Offset: 0   Signature: 0xAA55
>Starting Ending LBA Info:
>  #: id  C   H   S -  C   H   S [   start:size ]
>
-
--
>  0: 00  0   0   0 -  0   0   0 [   0:   0 ] unused
>  1: 00  0   0   0 -  0   0   0 [   0:   0 ] unused
>  2: 00  0   0   0 -  0   0   0 [   0:   0 ] unused
> *3: A6  0   1   1 -  20672 239  63 [  63:   312575697 ] OpenBSD
>
> so I'm not sure what's going on with you.

"fdisk sd0" is not a problem to me now either after I've seen Aaron's
comments on fdisk. The problem on mount still exists though:

What seems a little counter intuitive to me is: I would see sd0 as a
shortcut of /dev/sd0 for fdisk, but "fdisk /dev/sd0" does not work.

In addition, the fact that we need "mount /dev/sd0i /mnt/usb" and the
slice letter 'i' seems weird to me. I can now see the possible
rationale behind: OpenBSD assigns slice letters for *all* devices
together in sequence, while  other OS may just start it over for a
different device. OpenBSD may have a reason for this design but that's
what confused me, esp., after the change of device name from ad to wd,
and the alias of /dev/rwd0c for wd0, etc.


>
>>
>> For the mount device: what's the device naming convention and the
>> rationale behind it? I do not think it's a good idea to search through
>> all the device and find out the device name. Linux and FreeBSD use
>> slightly different convention but they both make sense to me. What
>> about OpenBSD?
>
> The naming convention is device driver name, device number, partition
> letter (e.g., mount /dev/sd1e /mnt/foo). And as far as I know, it's
> been like that since the BSDs were in diapers, so I'm not sure why
> it's coming as a surprise.
>

I happen to have FreeBSD 6.4 in hand. The following commands work as
expected:

fdisk ad4
fdisk /dev/ad4
fdisk da0
fdisk /dev/da0
mount /dev/ad4s4 /mnt/openbsd
mount -t msdosfs /dev/da0s1 /mnt/usb

and the following commands do not work:
mount ad4s4 /mnt/openbsd
mount -t msdosfs da0s1 /mnt/usb

The works and not-works all seem reasonable to me, while those on
OpenBSD are different.


>>
>>
>> For your reference, the output of various fdisk commands is listed
>> below. The first one gives correct information.
>
> Great! output of the various commands which doesn't specify which
> command was run is *totally* useful!

Since the first line of the output for each command shows the device,
I thought it's quite self-explanary. But I can see now how it may lead
to confusion. Sorry, should have made them more clear.

>
>>
>> Disk: /dev/rwd0c  geometry: 15566/255/63 [250069680 Sectors]
>> Offset: 0 Signature: 0xAA55
>> Starting Ending LBA Info:
>>  #: id  C   H   S -  C   H   S [   start:size ]
>>
-
--
>>  0: 07  0   1   1 -   8923 254  63 [  63:   143363997 ] NTFS
>>  1: 83   8924   0   1 -  10941 254  63 [   143364060:32419170 ] Linux
files*
>>  2: A5  13425   0   1 -  15565 254  63 [   215672625:34395165 ]
FreeBSD
>> *3: A6  10942   0   1 -  13424 254  63 [   175783230:39889395 ]
OpenBSD
>> Disk: /dev/rwd0a  geometry: 15566/255/63 [250069680 Sectors]
>> Offset: 0 Signature: 0xAA55
>> Starting Ending LBA Info:
>&g

Re: Another question: device naming convention

2010-01-22 Thread Song Li
On Fri, Jan 22, 2010 at 9:20 AM, Marc Espie  wrote:
> On Fri, Jan 22, 2010 at 07:43:31AM +0100, Song Li wrote:
>> What seems a little counter intuitive to me is: I would see sd0 as a
>> shortcut of /dev/sd0 for fdisk, but "fdisk /dev/sd0" does not work.
>
> It's not, as miod pointed out.
>
> Is it something you tried to "deduce" on your own ? or some misinformation
> you found in a manpage/webpage somewhere ? if there is a typo in our
> documentation that actually says "fdisk /dev/sd0", we would like to know
> about it...
>

The man page for fdisk matches the actual OS. There is no typo.

On the other hand, IMHO, a system should allow its user's reasonable
assumption. It would be a headache for everyone if we have to memorize
the exact syntax for every single command.

Maybe it's more so for other desktop friendly OS like FreeBSD and
Linux but not so true for OpenBSD, which does not have a high priority
for easy use. At any rate, you are much more experienced and should be
able to make better judgment than on how it should work. You can just
ignore my two cents and I will respect its current design -- it must
have many merits waiting for me to appreciate ...

Best,

Song