# Accidentally deleted all contents of /usr/port/sysutil using rm -rf



## aurora (May 27, 2009)

Late at night while trying to port an application, I have accidentally deleted all contents of /usr/port/sysutil using 
rm -rf. 

Now, how do I return them back in any way (i.e. reinstalling them thru the FreeBSD 6.3 Installation CD's, or simply recovering them from harddisk)

mount -l gives:
/dev/ad0sle on / (ufs, local)
devfs on /dev (devfs, local)
...


----------



## DrJ (May 27, 2009)

Just update your ports tree using your favorite utility (such as csup or cvsup).  The directory will be restored, albeit in updated form.


----------



## mdg583 (May 27, 2009)

I am not at my freebsd desktop now, but I used a line like this in my supfile:
*default date=2009.04.28.23.59.59
Maybe you can google it, and set it to about the time of the release, if you really don't want an updated ports tree.


----------



## pbd (May 27, 2009)

If you want the original ports tree from FreeBSD 6.3, unpack it from CD, or fetch it:


```
fetch -o - ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/i386/6.3-RELEASE/ports/ports.tgz | tar -z -x -v --include ports/sysutils -f - -C /usr/
```

You can also update your ports tree, which will "restore" your ports/sysutils - create a supfile as described in 





> /usr/share/examples/cvsup/ports-supfile


 and use cvsup as described in 





> http://www.freebsd.org/doc/en/books/handbook/cvsup.html


----------



## vivek (May 27, 2009)

Or run portsnap:

```
portsnap fetch extract
```


----------



## DutchDaemon (May 27, 2009)

Was portsnap already in the 6.3 base system? Don't remember.


----------



## vivek (May 27, 2009)

On FreeBSD v6.0 or above, portsnap is contained in the FreeBSD base / core system. You only need to to install portsanp if you are using older version i.e. 5.x


----------



## pbd (May 27, 2009)

DutchDaemon said:
			
		

> Was portsnap already in the 6.3 base system? Don't remember.



Yes, it is.


```
# uname -a
FreeBSD ... 6.3-RELEASE-p10 FreeBSD 6.3-RELEASE-p10 #0: Thu Apr 23 02:58:25 CEST 2009     root@...:/usr/obj/usr/src/sys/KERNEL  i386
# which portsnap 
/usr/sbin/portsnap
```


----------



## richardpl (May 27, 2009)

vivek said:
			
		

> Or run portsnap:
> 
> ```
> portsnap fetch extract
> ```


Overbloat, in OP case 



> portsnap extract sysutils



Please next time do RTFM, portsnap(8)


----------



## DutchDaemon (May 27, 2009)

Doesn't incorporating a ports 'subtree' into an existing (and seemingly untouched) 6.3 ports tree cause problems with INDEX, versions, dependencies, et al.?


----------



## richardpl (May 27, 2009)

Well if OP use old ports tree that is another pile of problems .... in this case portsnap just extract one subtree(aka path) instead extracting all tree.
If it doesn't require fetch command I don't see any problems.


----------



## DutchDaemon (May 27, 2009)

Ok, aurora72: 

- are you using an unaltered 6.3 ports tree as it came off the CD?
-> use the suggestion in post #3 (fetch the 'frozen' 6.3 ports snapshot and extract the sysutils stuff)

- are you using an up-to-date ports tree?
-> use the 'partial portsnap' solution and restore sysutils

- are you unsure at what stage your ports tree is right now?
-> get with the program and use 'portsnap fetch extract' once and 'portsnap fetch update' in the future


----------



## vivek (May 27, 2009)

richardpl said:
			
		

> Overbloat, in OP case
> 
> 
> 
> Please next time do RTFM, portsnap(8)


It is not a bad idea to make entire tree upto date. OP can update all outdated package. I will take security any day over little spend to perform ports tree (and ports itself) to upgrade 

Also, modern hardware and network is pretty powerful to handle any overbloat that cab be caused by 48MB file. If OP is on home computer with crappy internet than only I guess it is overbloat...


----------



## aurora (May 27, 2009)

DutchDaemon said:
			
		

> Ok, aurora72:
> 
> - are you using an unaltered 6.3 ports tree as it came off the CD?
> -> use the suggestion in post #3 (fetch the 'frozen' 6.3 ports snapshot and extract the sysutils stuff)
> ...



Well, first of all I must say that my FreeBSD computer's got no Internet connection as I'm still trying to make its wireless PCI card work with NDISWrapper.

Also, I have written the FreeBSD version wrong, it must have been 6.4 and not 6.3. (I was sleepy as I wrote it last night) To be exact, the version is 6.4-RELEASE and machine : i386

So now I have 3 Installation CD's of FreeBSD 6.4 which are labeled as CD#1, CD#2 and CD#3, though I haven't used the CD#3 during the installation.

Among the suggestions, the one made by pbd in particular, suggests that I use


```
fetch -o - ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/i386/6.3-RELEASE/ports/ports.tgz | tar -z -x -v --include ports/sysutils -f - -C /usr/
```

which I cannot, as it's not connected to Internet.

So which way should I use to reinstall the sysutils from CD?

Thanks.


----------



## DutchDaemon (May 27, 2009)

Ok:

```
Type: [cmd=]sysinstall[/cmd]
Choose: Configure
Choose: Distributions
Check: [X] Ports
Select: 1 Install from CD/DVD
Select: your CD/DVD Drive
```
Take it from there. I don't have CDs here, so I can't look beyond that point.

Once you have an Internet connection, update the ports tree and keep it up-to-date using portsnap(8). Use ports-mgmt/portmaster or ports-mgmt/portupgrade for updating ports (applications).


----------



## aurora (May 27, 2009)

DutchDaemon said:
			
		

> ```
> Type: [cmd=]sysinstall[/cmd]
> Choose: Configure
> Choose: Distributions
> ...



I was browsing the sysinstall documents and that procedure has cut it. It downloaded >40MB of files from the CD#1 and everything's now back in place. Might seem like a rough way of recovering only the "sysutils" but I had no other choice as I'm still a newbie and that's why the suggestions of other friends looked intimitading to me, though they were technically more precise...

I can go on installing the NDISWrapper and the WiFi PCI card now


----------



## richardpl (May 27, 2009)

This is second time you mentioned NDISWrapper. But NDISWrapper is available only for linux. *BSD use *NDISulator* aka *Project Evil* TM


----------



## Mel_Flynn (May 27, 2009)

richardpl said:
			
		

> This is second time you mentioned NDISWrapper. But NDISWrapper is available only for linux. *BSD use *NDISulator* aka *Project Evil* TM



That's not so bad. I call ubuntu MS Linux.
(iow: can't we all get along? It really is a wrapper around the NDIS protocol, but the name was taken, hmm?)


----------



## richardpl (May 27, 2009)

Are you serious?
That is same as calling linux freebsd or freebsd linux.

They are doing same thing but in completly different way so it is incorrect to deny existence of any of them.

I'm going for another happy pill now ... please wait


----------



## SirDice (May 28, 2009)

richardpl said:
			
		

> This is second time you mentioned NDISWrapper. But NDISWrapper is available only for linux. *BSD use *NDISulator* aka *Project Evil* TM



ndis(4)

I'd call it ndiswrapper too :e


----------



## richardpl (May 28, 2009)

You can call it NWO if you want.
Oh those kids today ...


----------



## fronclynne (May 28, 2009)

. . . just don't call me late for dinner.


----------



## aurora (May 29, 2009)

I wouldn't guess that the thread would go on, but anyways that's fine. Well, having come over the problems I had at the start, I gave a little pause and did not attempt to use the WiFi PCI card on my FreeBSD machine for a while but soon I will start working on it.

As for the confusion about the naming of NDIS simulator/wrapper richardpl's correct in emphazising the difference between, because the name "NDISulator" is present on "Setting up network interface cards" section of the FreeBSD manual and no mention of NDISWrapper has been made there.

However, I 'll have to use the NDISWrapper because that's the only one I have up for the task. 
(I had downloaded it from http://garr.dl.sourceforge.net/sourceforge/ndiswrapper/ndiswrapper-1.54.tar.gz)

But I suspect it will be installed under FreeBSD. Or should I try installing NDISulator instead? But where do I download its source files if there are any? I googled by the terms "NDISulator download" and no download links are returned. 

Is NDISulator listed under ports collection? I couldn't find it in a search at FreeBSD Ports Search by the search term "NDISulator"

So, what should I do to install my USR5417 WiFi PCI card (whose .sys & .inf files I have)?

Thanks.


----------



## DutchDaemon (May 30, 2009)

[cmd=]apropos ndis[/cmd]


----------



## richardpl (May 30, 2009)

aurora72 said:
			
		

> I wouldn't guess that the thread would go on, but anyways that's fine. Well, having come over the problems I had at the start, I gave a little pause and did not attempt to use the WiFi PCI card on my FreeBSD machine for a while but soon I will start working on it.
> 
> As for the confusion about the naming of NDIS simulator/wrapper richardpl's correct in emphazising the difference between, because the name "NDISulator" is present on "Setting up network interface cards" section of the FreeBSD manual and no mention of NDISWrapper has been made there.
> 
> ...



RTFM, Everything is explained in Handbook and in ndisgen(8) and ndis(4) you dont need ports if you already have *inf* and *sys* files.

NDISwrapper works only and only on Linux ...


----------



## richardpl (May 30, 2009)

One more thing I always forget to add, you must have kernel sources available in /sys directory.

The kernel source is always available on installation CD.


----------



## aurora (May 30, 2009)

Oh it's  alright. Having read the manual ,I've managed to use the ndisgen utility to integrate the .sys&.inf into the kernel but ...

It failed at the last step, namely the "kernel module generation" and the following lines are present:

Generaing Makefile... done.
Building kernek module... /usr/share/misc/windrv_stub.c:57:20: windrv.h: No such file of directory.
mkdep: compile failed

So, what could be the solution to this? Shall I manually get those two  files (windrv_stub.c & windrv.h) and place them in the directory /usr/share/misc/ or should I install something else all over?

Thanks!


----------



## richardpl (May 30, 2009)

I already answered to that question one post above.
You are missing kernel sources and that is clearly mentioned in FreeBSD Handbook.

The same case would apply for Linux; when using ndiswrapper on *ubuntu.


----------



## aurora (May 30, 2009)

Everthing's (putting the CD#1) alright, and I managed to integrate the NDIS driver to the kernel. The PCI card now shows up as
ndis0: NDIS API version: 5.1
ndis0: Ethernet address: aa:aa:aa:bb:bb:bb

Now I'm trying to configure it further.

Thanks!


----------

