Thursday, March 25, 2010

HowTo: Upgrade FreeBSD 7.2 to 7.3

Disclaimer: this post is for those that instead of using FreeBSD's excellent documentation maintain the bad habit of googling for things already covered in the project's official documentation. This is more or less a copy-paste of the FreeBSD 7.3-RELEASE Announcement instructions for upgrading 7.2 to 7.3.

These are needed steps to upgrade, through the binary upgrade method, the kernel and userland utilities to 7.3-RELEASE:
  1. % su
  2. # freebsd-update upgrade -r 7.3-RELEASE
  3. # freebsd-update install
  4. # shutdown -r now
  5. % su
  6. # freebsd-update install
  7. # shutdown -r now
On step 1 we've started of by becoming the superuser. Step 2 initiates the freebsd-update utility pointing the upgrade to 7.3-RELEASE, after that we proceed with the installation of the kernel on step 3.

Upon rebooting the new kernel is enabled and we move into step 6. Here we end the upgrade process by updating the userland utilities.

That's it!

If you found this post useful that's actually a bad news: you aren't reading the project's official documentation! So please point to http://www.freebsd.org and educate yourself on FreeBSD ;)

Saturday, March 6, 2010

Tip: Dealing with virtualbox-ose PUEL license on Gentoo

I came across a peculiar message from portage when trying to install virtualbox-ose in Gentoo:
  1. $ su
  2. # eix-sync
  3. # emerge --tree --ask --verbose virtualbox-ose
These are the packages that would be merged, in reverse order:

Calculating dependencies... done!

!!! All ebuilds that could satisfy "~app-emulation/virtualbox-ose-additions-3.1.4" have been masked.
!!! One of the following masked packages is required to complete your request:
- app-emulation/virtualbox-ose-additions-3.1.4 (masked by: PUEL license(s))
A copy of the 'PUEL' license is located at '/usr/portage/licenses/PUEL'.


(dependency required by "app-emulation/virtualbox-ose-3.1.4" [ebuild])
(dependency required by "virtualbox-ose" [argument])

For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.
The solution is to add the PUEL license to the /etc/portage/package.license file:
  1. # echo "app-emulation/virtualbox-ose-additions PUEL" >> /etc/portage/package.license
  2. # echo "app-emulation/virtualbox-ose PUEL" >> /etc/portage/package.license
Now can finally get to emerge VirtualBox.

As a side note you can also use /etc/make.conf and make use of the ACCEPT_LICENSE variable. For instances adding ACCEPT_LICENSE="*" to /etc/make.conf unmasks all licenses. Alternatively you can unmask licenses one by one.

More information can be obtained reading make.conf and portage's man pages.

Tuesday, January 12, 2010

Tip: Dealing with nvidia-driver-195.22 on FreeBSD 7.2-RELEASE

I haven't migrated to FreeBSD 8.0 as I came across visual artefacts while running 8.0, nvidia-driver-195.22 and Enemy Territory on a test install.

To update my installed ports I use for the most part csup to update the ports collection and sysutils/portmaster to actually update the ports with new versions.

Recently nvidia-driver-195.22 hit the Ports tree and upon running portmaster -a I found out that Nvidia's latest driver version requires FreeBSD-STABLE or FreeBSD-CURRENT. Guess who's running RELEASE?

Symptoms:
  • % su
  • # csup -L 2 -h cvsup2.uk.freebsd.org /usr/share/examples/cvsup/ports-supfile
  • # portmaster -L
===>>> nvidia-driver-185.18.36
===>>> New version available: nvidia-driver-195.22
===>>> This port is marked IGNORE
===>>> requires fairly recent FreeBSD-STABLE, or FreeBSD-CURRENT
  • # portmaster -a
===>>> Launching child to update nvidia-driver-185.18.36 to nvidia-driver-195.22

===>>> Port directory: /usr/ports/x11/nvidia-driver
===>>> This port is marked IGNORE
===>>> requires fairly recent FreeBSD-STABLE, or FreeBSD-CURRENT

===>>> If you are sure you can build it, remove the
IGNORE line in the Makefile and try again.

===>>> Update for nvidia-driver-185.18.36 failed
===>>> Aborting update

Solution:
  • # cd /var/db/pkg/nvidia-driver-185.18.36/
  • # touch +IGNOREME
  • # portmaster -a
===>>> Launching child to update nvidia-driver-185.18.36 to nvidia-driver-195.22

===>>> nvidia-driver-185.18.36 has an +IGNOREME file

===>>> Update anyway? [n]
  • answer "n"
Now portmaster -a ignores updates to the nvidia-driver port until the issue is fixed or I move to 8.0 ;)

Friday, September 18, 2009

HowTo: Mount EXT2FS partitions with inode 256 on FreeBSD

Mounting ext2/ext3 slices (or "partitions" in the Linux world) is easy on FreeBSD... if the filesystem was NOT created with inode 256 that is!

If you are one of those unlucky bastards this post presents the required steps on how to patch the FreeBSD 7.2 kernel module that mounts ext2/ext3 filesystems.

First let's begin by installing the sysutils/e2fsprogs application that provides tune2fs which will allow us to confirm that the ext2/ext3 filesystem was in fact created with inode 256. Assuming that the target slice is in the /dev/ad4 disk:
  • % su
  • # cd /usr/ports/sysutils/e2fsprogs
  • # make install clean
  • # rehash
  • # fdisk /dev/ad4
******* Working on device /dev/ad4 *******
parameters extracted from in-core disklabel are:
cylinders=395136 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=395136 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 131 (0x83),(Linux native)
start 63, size 80262 (39 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 4/ head 254/ sector 63
The data for partition 2 is:
sysid 130 (0x82),(Linux swap or Solaris x86)
start 80325, size 1012095 (494 Meg), flag 0
beg: cyl 5/ head 0/ sector 1;
end: cyl 67/ head 254/ sector 63
The data for partition 3 is:
sysid 131 (0x83),(Linux native)
start 1092420, size 10008495 (4886 Meg), flag 0
beg: cyl 68/ head 0/ sector 1;
end: cyl 690/ head 254/ sector 63
The data for partition 4 is:
sysid 15 (0x0f),(Extended DOS (LBA))
start 11100915, size 350907795 (171341 Meg), flag 0
beg: cyl 691/ head 0/ sector 1;
end: cyl 1023/ head 254/ sector 63
  • # tune2fs -l /dev/ad4s1 | grep -i 'inode size'
fdisk is used to list the slices that exist on the disk. Sysid 131 means that a ext2/ext3 slice exists and this is target for tune2fs.

Next let's fetch the patch:
  • % wget http://pflog.net/~floyd/ext2fs.diff
In alternative, get the patch from here:
  • % wget http://pastebin.ca/raw/1280738
Now that we have the patch, let's proceed by applying it and build the patched module:
  • # cd /usr/src/sys/gnu/fs
  • # patch < /path/to/patch
  • # cd /usr/src/sys/modules/ext2fs
  • # make depend ; make obj ; make ; make ; make install ; make unload ; make load ; make clean
This way you'll build all dependencies for the module, build the module itself, install it, unload the current loaded module and finally load the new one.

Having the new module loaded you can now successfully mount your ext2/ext3 filesystem:
  • # mount -t ext2fs /dev/ad6s1 /mnt
That's it!

References:
kern/124621: [ext3] [patch] Cannot mount ext2fs partition
man mount
sysutils/e2fsprogs

Thursday, September 17, 2009

Tip: Introducing the PKGDIR environment variable on FreeBSD

Though I prefer using the ports tree to install applications on FreeBSD, the fact is that packages are way faster especially if your hardware is old or you just want to bring a test install online as fast as possible.

If you want to keep the downloaded packages, you need to set the PKGDIR environment variable pointing to the place where to store the downloaded .tbz files.

Here's how to set PKGDIR with the t/csh shell to /usr/ports/packages/All:
  • % su
  • # setenv PKGDIR /usr/ports/packages/All
  • # mkdir -p /usr/ports/packages/All
To download, store and install a package named foo:
  • # pkg_add -Kr foo
The -K switch informs pkg_add that you want to keep the downloaded package on the directory defined by PKGDIR.

Using packages is all fine and dandy, however not all applications in the ports tree are available as packages due to licensing issues.

I found out that after setting the PKGDIR, every single port that I tried to install failed with the same error: "Missing pkg-descr".

To fix the problem simply unset the PKGDIR environment variable like so:
  • # unsetenv PKGDIR
And voilá! You can now use the best of both worlds.

Tuesday, August 25, 2009

Tip: Fetch and password-protected web pages

In order to make fetch (the FreeBSD downloading tool) ask for username/password when it encounters a password-protected web page, you can set the environment variable HTTP_AUTH to 'basic:*'.

Users of t/csh shells can temporarily set the environment variable like so:
% setenv HTTP_AUTH='basic:*'
To set it permanetly we need to add it to .cshrc:
% vim ~/.cshrc
setenv HTTP_AUTH 'basic:*'
And that's it.

HowTo: Intel PRO/Wireless 3945ABG on Debian

I've recently dabbled with Debian Lenny on my Dell D620 and found myself needing to access my wireless network.

These are the required steps to activate the Intel PRO/Wireless 3945 ABG device on Debian GNU/Linux 5.0 Lenny:
  1. $ su
  2. # aptitude install firmware-iwlwifi
  3. # modprobe -r iwl3945 && modprobe iwl3945
  4. point to the Network Manager icon on Gnome's top panel and enter the details of your wireless network
Do notice that firmware-iwlwifi is a non-free firmware so you need to enable the non-free repositories. To do so point to System -> Administration -> Software Sources -> Debian Software and enable the non-free and contrib repositories.

I found the whole process of enabling and using 3945ABG on Debian very simple and straightforward which was a welcome change from the days of the old ipw driver ;)