|
|
Index: Home | What Is Izumi | Linux Tips | OpenBSD Tips | FreeBSD TipsThis page contain several tips for using FreeBSD. I use this mostly as reminders of commands that I found useful. There's generally nothing here one couldn't learn by searching on the net or reading the man pages, which is generally how I got the commands in the first place.
$Id: Free Bsd Tips.izu,v 1.11 2006-12-25 02:58:50 ralf Exp $
Weird. So I tried to mount the already mounted CD-ROM (or something similar,
not quite sure what). Eventually I do an ls /cdrom/blah and boom: kernel
panic and reboot.
Turns out ufs complains about a corrupted inode in /tmp.
A bit too fragile if you ask me.
Anyway, the point is to learn so here's what I'm doing:
ufs complaining about some corrupted inode in /tmp.Now that I have a prompt in single-user mode let's poke around:
# df -ah
df tells me that /dev/ad0s1a is mounted on /.
# mount -aHmm so here I learn that
/ was mounted R/W and it's not clean.
All partitions were not properly dismounted (well that's the kernel panic right there).
And /tmp is on /dev/ad0s1e. So let's try this:
# umount /tmp # fsck /dev/ad0s1eOr let's be more radical:
# umount /usr # umount /var # and whatever else is mounted except
# fsck -y # check all available filesystems with auto-yes # mount -a # no errors # df -ah
OK that solves. However it's a bit freaking that the file system got corrupted so easily in the first place.
What, no journaling in the default filesystem? would I hear? Apprently the "solution" choosen by FreeBSD is soft updates instead of journaling. More detais on UFS here (a.k.a. Unix FS, BSD FFS, etc.)
LiveCD:
$ sudo pkg_add -r livecd $ cd /usr/local/livecd
$ sudo mount /cdrom
/usr/src is a requirement:$ sudo sysinstall > Configure > Distribution
$ sudo ./livecd.sh > Language: English > Livecd.sh is running from: /usr/local/livecd > Create LiveCD's / in /usr/live_root > Create LiveCD.iso in /usr > Not an install media > No CD burner in this machine but I have a CDR > My CD device is /dev/acd0
... and then it all breaks. Turns out this is from 2003 and targets a 4.x or 5.x release of FreeBSD. Doesn't work on 6.1-Release.
Conclusion: Want a LiveCD? Just use FreeSBiE.
Settings up the ports system on an already installed system, typically if you dismissed the fact during the update:
sysinstall (same menu as presented during install) and update the distribution packages.
So first thing first:
# pkg_add -r sudo
Now edit the sudoers and allow the wheel group to run all commands:
# vim /usr/local/etc/sudoers ... # Uncomment to allow people in group wheel to run all commands %wheel ALL=(ALL) ALL :wq
OK now our default user should be created using its own group.
We also want it part of the wheel. This is explained in the
handbook about groups.
pw groupmod is what you need but the trick is that groupmod will set
the complete group list, so you need to list the content of wheel
first and add yours. I find that a bit odd and a tad dangerous. Anyway it works
like this:
# pw groupshow wheel wheel:*:0:root # pw groupmod wheel -M root,ralf # su - ralf $ sudo pw groupshow wheel wheel:*:0:root,ralf
The id comand is useful to list current membership:
$ id uid=1001(ralf) gid=1001(ralf) groups=1001(ralf), 0(wheel)
Finally let's set bash as the default for my user:
$ sudo vipw /ralf s@/bin/sh@/usr/local/bin/bash :wq
Sounds like I should really give it a try on my PCG-R505.
And this will be most useful:
Packages:
Even if you don't want to use ports, there's a benefit in having a fully up-to-date
ports collection to quickly find what exists using whereis.
Another way is to do
$ fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/packages/INDEXand grep it there after:
$ grep sudo INDEXbut the output is rather ters.e Or simply do this as root:
$ pkg_add -r sudowhich will fetch
sudo remotely and install it if found (or let you know it's not
been found with a rather cryptic message.)
So let's do the usual:
# pkg_add -r sudo # pkg_add -r vim # pkg_add -r screen # not foundI already had
bash and rsync installed via sysinstall.
For a port-based approach, here are some interesting tips:
Let's apply what I found with OpenBSD. The OpenBSD install was really terse. This one at least is menuconfig-like (i.e. text-based dialog boxes as in Debian 3.0) with lots of sensible defaults.
Vocabulary: slices and partitions are defined in the handbook on how to add disks. A slice is one of the four BIOS partitions that PC drives can have. Partitions are logical BSD partitions living inside a slice.
Install:
ad0s1 slice (aka physical BIOS partition) to make it bootablescreen in All.Cancel to close a sub-package selection box (how intuitive, again!)gtk (as a dependency from what, I don't have a clue) which was on neither install CD. Sucka'.And voila, a rather painless install.
So what do we have now?
su - disabled by default.sudo: command not found... ah!$ uname -a FreeBSD freebsd.of.nine 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:32:43 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
$ df -h Filesystem Size Used Avail Capacity Mounted on /dev/ad0s1a 496M 34M 422M 8%
devfs 1.0K 1.0K 0B 100% /dev /dev/ad0s1e 496M 12K 456M 0% /tmp /dev/ad0s1f 13G 193M 12G 2% /usr /dev/ad0s1d 1.2G 968K 1.1G 0% /var
OK I'm done here. Let's move on to OpenBSD.
Getting ports:
# portsnap fetch # portsnap extract # portsnap update
Getting a specific port:
# whereis bash # whereis bash bash /usr/ports/shells/bash # cd /usr/ports/shells/bash && make install # cd /usr/ports/security/sudo && make install
Blog Archives:
Most recent posts
2006/06/25 - 2006/06/25
[RSS]
|
|

This work is licensed by Raphaël Moll under a Creative Commons License.
|
|
| Color Theme: | Gray | Blue | Black | Sand | Khaki | Egg | None |
|
|
|
|