Author Archive

FreeBSD error in /boot/loader.conf

While experimenting with ZFS in FreeBSD, I made some tweaks to the vk.kmem_size variable in /boot/loader.conf. when setting it like this:

#/boot/loader.conf
vm.kmem_size="1024"

everything worked, but I wanted to see what would happen if i doubled it. Unfortunately, setting vm.kmem_size to 2048 kept the FreeBSD kernel from booting. At startup it would just do this:

panic: kmem_suballoc: bad status return of 3
cpuid = 0

To fix the erroneous variable setting, I had to :

1. Reboot.

2. Wait for the FreeBSD Boot menu. (the screen that lists Default, ACPI disabled, safe, and single user modes)

3. Press 6 to select “Escape to loader prompt”

4. At the loader prompt, type “show”. This will provide all the default variable settings. press the spacebar to page down. In my case, at the end, the incorrect variable was: vm.kmem_size=”2048″.

5. to switch it back and allow the system to boot, type

set (variable)=(correct value)

in my case this was:

set vm.kmem_size=1024M

6. type

boot

When you are finished with all that fun, you should edit the /boot/loader.conf file back so you don’t have to do this again.
Thanks to “crsd” from the FreeBSD IRC channel for the help.

Debian eth0, eth1, eth2, in Virtualbox or VMware Virtual machines when copying

Debian uses udev. Udev handles mapping MAC’s to the appropriate /dev/eth(X) file. If you copy a Virtual machine, Udev will remember the MAC address of the old NIC. When you copy the machine, the virtual host usually generates a new MAC address for the VM.
Udev will assign the new Device to eth1, eth2, and so on. If you want to change your NIC assignments make Udev forget the old MAC.
In Debian 5 (lenny) it is in this file:

/etc/udev/rules.d/70-persistent-net.rules

In Debian 4 (etch) it is in this file:

/etc/udev/rules.d/z25_persistent-net.rules

To apply changes in Lenny: “udevadm trigger” or “udevtrigger” (in Etch)

Karmic install cannot login (gdm freezes) Nvidia

On a fresh install of karmic, using an Nvidia 7800 GT. When I went to click on my username to log in, some artifacts would appear on the screen, then the system would freeze. hard. Couldnt even ctrl+alt to another console. Installing the Nvidia drivers fixed the issue. To fix it:

  1. Do a hard reset on the machine
  2. When you arrive at the GDM screen, DO NOT CLICK ON ANYTHING.
  3. press CTRL + ALT + F5. Your screen will switch over to a text console.
  4. Log in.
  5. Install the Nvidia glx driver
  6. sudo aptitude install nvidia-glx-new
  7. Reboot the machine.
  8. sudo reboot

Windows 32 (x86) or 64 (AMD64) detection in batch files

While there are a lot of ways to detect for a 64 bit version of windows. you can test for %programFiles(x86)%, but handling the output and writing the IF comparisons is messy.

In Batch files, you can easily check for architecture by using the “processor_architecture” variable. x86 versions of windows will have this set to “x86″, and x64 versions “x64″. Heres an easy example:

@echo off
IF %processor_architecture% == AMD64 echo This is a 64-bit version of windows
IF %processor_architecture% == x86 echo this is a 32-bit version of windows.
pause

Uninstall ALL Versions of WinZip Batch Script

I have been struggling with this for quite a while, and ran into a lot of issues with all of the different versions on our network. There are people with 100 line .vbs scripts to do this, and I think this is much simpler:

@echo off
REM
REM
REM    Detects winzip and silently uninstalls
REM    There is a un-stoppable pop-up window. so this will kill
REM    all instances of  IE after the UN-installation.
REM
REM
REM
taskkill /F /IM wzqkpick.exe
wmic product where "name like '%%winzip%%'" call Uninstall
REM
REM This section is for WinZip <12
REM
If Exist "%programfiles(x86)%\Winzip\winzip32.exe" GOTO 64
If Exist "%programfiles%\Winzip\winzip32.exe" "%programfiles%\WinZip\Winzip32.exe" /Uninstallx
taskkill /F /IM iexplore.exe
GOTO :END
:64
"%programfiles(x86)%\WinZip\Winzip32.exe" /Uninstallx
taskkill /F /IM iexplore.exe
:END

For getting rid of WinZip 12, the magic happens in the 'wmic' line. It searches all of the installed product's names for "winzip" and will uninstall anything it finds. This only works for products that use MSI's. If you ran this outside of a batch file, you will have to use a single % percentage sign instead of the %% double percentage sign... Windows scripting sucks, and that's just the way it is. Same thing that happens in "FOR" loops.

I never knew anything about the Windows management instrumentation control (wmic) until now, but I will be sure to exploit it's features.

 

Switch to our mobile site