Showing posts with label pcbsd. Show all posts
Showing posts with label pcbsd. Show all posts

Sunday, February 8, 2015

PC-BSD: Running QT applications from within a Warden "Ports" jail (for X11 applications)

I've been running PC-BSD 10.1.1 with great success. However, there are a few "bleeding edge" applications that I want to compile and run; most notably, Anki, my favorite flash-carding application / learning aid.

I started out by creating a "Ports Jail (insecure, allows running X applications)," which automatically downloads and installs the FreeBSD ports tree (a large library of applications that can be compiled to run on a FreeBSD system). I installed a few packages (binary, precompiled programs), including the ssh daemon and sudo.

From there, I descended into the ports tree in /usr/ports/games/anki, and then I executed a recursive make command, to automatically compile everything
/usr/bin/nice -n 19 make DISABLE_VULNERABILITIES=yes -DBATCH
This worked swimmingly, and a subsequent make install successfully integrated Anki into my jailed environment. However, a few issues remain:

  1. X11 over SSH:  ssh -Y username@ports_jail does NOT forward X11 correctly. Launching any X11 program results in the following message:
    X11 connection rejected because of wrong authentication.
    Error: Can't open display: localhost:11.0
    If you're SSHing in via a shell within your computer's X11 environment, this can be rectified with:
    export DISPLAY=":0.0"
    However, this doesn't really fix the ssh X11 forwarding problem, and I'm still at an impasse.
  2. QT doesn't render correctly. When launched without environmental variables, I get the following results:
    • A number of X11 errors when launching from the command line:

      QNativeImage: Unable to attach to shared memory segment.
      X Error: BadDrawable (invalid Pixmap or Window parameter) 9
      Major opcode: 62 (X_CopyArea)
        Resource id: 0x0
      X Error: BadDrawable (invalid Pixmap or Window parameter) 9
      Major opcode: 62 (X_CopyArea)
      Resource id: 0x0
    • The initial screen is rendered improperly: gray windows, weird artifacts. 
    To solve, modify the QT_GRAPHICSSYSTEM environment variable:
    QT_GRAPHICSSYSTEM=native anki
I'm going to post my experiences to the PC-BSD forums, and see if some folks have some ideas about how to fix the issue.

Saturday, January 17, 2015

PC-BSD: FreeBSD 10.0 -> 10.1 upgrade using freebsd-update

I was having problems getting pc-sysupdate to work properly. For some reason, purging the pkg cache and forcing updates through pkg update -f resulted in package size mismatches, so I decided to try to upgrade my PC-BSD system manually. It took a while, but I think I figured out how to get it going.

First, I created a boot environment for my new upgrade:

beadm create fbsd_10.1_update
beadm mount fbsd_10.1_update /.updateStage


Next, I performed the freebsd-update on this new boot environment:

freebsd-update -b /.updateStage fetch
freebsd-update -b /.updateStage install


Eventually, the script finished its business. I then switched to the new environment:

beadm umount fbsd_10.1_update
beadm activate fbsd_10.1_update


All done, right? Here's what happened next. I rebooted the machine, and was dropped to a grub> prompt. What? beadm didn't handle grub gracefully?

Ugh. After digging, I figured out how to manhandle grub to boot my ZFS partition. The first trick, to save time, is to set an environment variable to the root filesystem. This saves a LOT of typing. Use "tab" completion to figure out what filesystems are available to you:

set P=(hd0,msdos2)/ROOT/fbsd_10.1_update/@/


Now, we can tell grub to load all the things (tab completion works with the $P expansion! brilliant!):

kfreebsd $P/boot/kernel/kernel
kfreebsd_loadenv $P/boot/device.hints
kfreebsd_module_elf $P/boot/kernel/opensolaris.ko
kfreebsd_module_elf $P/boot/kernel/zfs.ko
kfreebsd_module $P/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
set kFreeBSD.vfs.root.mountfrom=zfs:tank/ROOT/fbsd_10.1_update


boot


Voila! System working again. But I still need to repair GRUB... after the system boots into the correct boot environment:

grub-mkconfig -o /boot/grub/grub.cfg

Unfortunately, that last step didn't actually fix my grub installation. I'm puzzled as to how to fix it. But for now, at least I can get the machine running.

Saturday, September 8, 2012

PC-BSD 9 -> FreeBSD Notes

I've been using PC-BSD 9 for a while, and I got sick of having only PBI (push-button installer) software installed, opting for a more traditional BSD experience of dependency hell. Here are a few tips for the uninitiated (notes for noobs) -- to help you get away from PC-BSD PBI updates and into FreeBSD source-centric happiness.
  1. Use portmaster to upgrade packages. It's really the way to go. In order to get portmaster, you can use the command: portupgrade -PN portmaster
  2. The first time you upgrade your packages, browse /usr/ports/UPDATING. When you update your packages, this is the first place to look when something doesn't compile. After you finish with your update, NOTE THE DATE OF THE UPDATE somewhere. That way, the next time you upgrade packages, you don't have to look through the entire /usr/ports/UPDATING file.
  3. Accelerate your life. Tell FreeBSD to find and use the fastest mirror site:
    1. portmaster ports-mgmt/fastest_sites
    2. /usr/local/bin/fastest_sites > /usr/local/etc/ports_sites.conf
    3. echo '.include "/usr/local/etc/ports_sites.conf"' >> /etc/make.conf
  4. PERL updates are funky. When updating PERL, you'll need to update the many PERL packages that are already installed on your system. The p5-XML-SAX- packages are temperamental because p5-XML-SAX-Expat modifies a file that is contained in p5-XML-Parser. I haven't bothered to understand the problem well enough to write a definitive tutorial here. You'll also need to update all p5- ports, as well as print/foomatic-db-engine because it, too, contains a PERL package.

  5. Make your fonts pretty. Everyone uses LCDs these days, so go download some patches to better support your eyeballs. The patches at https://github.com/paranormal/freebsd_fonts_ubuntu allow FreeBSD to use subpixel antialiasing. The only port that I needed to patch in order to make both Firefox and LibreOffice look beautiful was the freetype2 package.
  6. Update your kernel for the latest fixes. If you decide to update your kernel (at this point, there are lots of bugfixes in 9-STABLE), try SVN: 
    1. svn checkout svn://svn.freebsd.org/base/stable/9 /usr/STABLE
    2. mv /usr/src /usr/RELEASE
    3. ln -s /usr/STABLE /usr/src
  7. Do all your configs at once. When using the Makefiles in /usr/ports/..., all you need to do is make config-recursive. portmaster apparently does this by default; I haven't yet figured out how to cause the tool to prompt with all of the configs (maybe using the -P option has something to do with this).