Bob's Notepad

Notes on projects I have done and things I have learned saved for my reference and for the world to share

Monday, June 17, 2024

Open a process that's already running in a terminal in a screen session

 It happens time and time again.... you start a process and then it starts taking a really long time and you need to leave and take your laptop with you.  After many years I have found a solution that worked -- well at least this one time.

First install reptyr:

  • Run "apt-get install reptyr"

Then in the running session:

  • Press ctrl-z
  • Run "bg" (no parameters should be needed)
  • Run "jobs -l" and look for the process ID of the stopped job
  • Run "disown -h processID"

In another terminal, launch screen and then:

  • Run "reptyr -T processID" (this may lock up your other terminal but we don't need it anymore)
  • You may have to press enter after a few moments to get back to a command prompt
  • Run "jobs -l" and you should see your process there now
  • Run "fg" and your process should now be running in your new screen session

It should be noted that the -T option of reptyr is experimental.  In some cases, depending on the task you are running, you may be able to just run "reptyr processID" in a screen session without backgrounding and disowning but many tasks spawn child processes and without the -T you will get an error in those instances.

 

Reference Link


Wednesday, November 10, 2010

Add files to an ISO using OSX

If you've ever wanted to create a linux CD or DVD with a kickstart file and you're on a Mac you've probably ran into this issue. You can use this method to add/edit/delete files from an ISO image (works as of OSX 10.6.4, despite using PPC binaries).

First, you need to grab a file:

http://homepage.mac.com/machiavel/Executables/cdrtools-OSXbin.tgz (or mirror
Thanks to Greg Nyquist

You'll want to extract the tgz file and then you'll want to copy ./sw/bin/* to /usr/bin/:
  • Open Terminal
  • cd "/cdrtools/cdrtools-2.00.3 (PPC binaries)/sw/bin"
  • sudo cp * /usr/bin
Create a folder for your new ISO compilation and then open the original ISO file by double clicking (it should mount as a disk image). Copy all of the contents on that disk image to the new folder and then add/edit/delete those files as needed. Once you've got the new "image" to your liking, you'll want to go ahead and create the new ISO image. In order to keep your CD/DVD bootable you will need to figure out what the boot image is for your CD. On Linux CDs you will likely find this here: ./isolinux/isolinux.bin
  • Open Terminal if not already
  • cd /newcdimage/
  • rm isolinux/boot.cat
  • mkisofs -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -c isolinux/boot.cat -iso-level 2 -J -joliet-long -v -o /outputdir/NewISO.iso .
  • If you get "Missing pathspec" then you missed the . at the end of the command line
A helpful note: If you're creating a bootable ISO that you want to automatically start installing based on a kickstart file, you can edit ./isolinux/isolinux.cfg on your new CD image folder to have it do so. Something like this should work for centos:
default ks   
prompt 1
timeout 15 
label linux
  kernel vmlinuz
  append initrd=initrd.img
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img text

Note that you may have to do a "chmod +w isolinux.cfg" before editing

Labels:

Reference Link


Sunday, June 27, 2010

PVR-150 IR Blaster on MythBuntu 10.04

For some reason I decided that I was going to upgrade my Mythbuntu system to 10.04 and that everything was going to go ok. Everytime I do this I regret it for at least a day because, for whatever reason, Ubuntu is hell-bent on making the Hauppauge PVR-150's IR-Blaster not work. It doesn't make much sense to me considering it is probably the most popular analog tuner card -- but whatever -- after lots of googling, cussing, and typing I have found the solution. I do have to say that aside from the PVR-150 issues the upgrade went pretty smooth with the exception of mythtv-backend not being reinstalled but that was fixed by "apt-get install mythtv-backend mythtv-database".

First of all, please note that this may not be a complete set of instructions if you are starting from scratch. To fill in the blanks please see my previous posts here and here. Secondly, thanks to everyone who did the bulk of the work: mrplow, Jarod, Jimmybondo and Mark as well as anyone I missed.

Ok, so you want your PVR-150 blasting IR codes on your Mythbuntu 10.04 system? First, if you're going to upgrade, back up your /etc/lirc/ directory as you'll likely just want to revert to your old configuration files. Once you do your upgrade, make sure everything is working (besides, of course, your IR blaster).

Here's what you'll want to do (it's virtually identical to 9.10 with a different file):
  • sudo bash
  • apt-get remove lirc-modules-source
  • rm -rf /usr/src/lirc-0.8.6/
  • apt-get install lirc-modules-source
  • cd /usr/src/lirc-0.8.6
  • wget http://bobkmertz.com/blog-files/zilog-for-lucid.diff
  • patch -p0 < zilog-for-lucid.diff
  • dpkg-reconfigure lirc-modules-source
Now you want to adjust your /etc/lirc files and make sure that hardware.conf references only 2 modules: lirc_dev lirc_zilog More information on those files can be found in my previous posts listed above. You'll also need to make sure that you have haup-ir-blaster.bin in your /lib/firmware/ directory (again, information on this can be found in my prior posts)

After you run all of the above commands you may want to go ahead and reboot the machine. For some reason it seems to take lirc_zilog a bit before it actually initializes and loads the firmware file which could result in seeing errors about unknown symbols.

As a side note, I am still running a 32bit kernel because I'm not seeing much of an indication that the PVR-150 will work under a 64 bit kernel (see comments of my prior posts). I haven't attempted it and really don't have much of a desire to even try -- it takes enough to just keep this stuff running with Ubuntu wanting to break the PVR-150 everytime someone sneezes.

Hopefully this post helps someone out and prevents them from missing Dr. Who like I did tonight.

Labels: , , , , , , , ,

Reference Link


Saturday, May 22, 2010

Diaspora

Reference Link


Tuesday, February 02, 2010

Changes

After many MANY years of loyally supporting Blogger despite there being other solutions that may have fit better it seems that Blogger has given up on me. Why? Because I use FTP to publish my blog to my own site without using Google Hosting, etc. Google/Blogger has announced that they will be stopping support for FTP in the near future and this has left me in a position where I need to move... and move quickly it seems.

I am very disappointed that after being a user of Blogger since September of 2003 that Google has decided to leave me no option but to find another solution. I feel that I've grown and changed with Blogger and Google and now am just abandoned by them because they have a user base and no real need for those that have stuck by the product.

In the future I will have to be making changes to both notepad.bobkmertz.com and http://blog.bibleboy.org. It is my hope that I will be able to keep these domains with another solution but that is undecided at this time. I will try to update everyone as soon as I have more information.

UPDATE: I have decided to go ahead and move over to Google's hosting since they are now offering subdomains of domains you have DNS hosted elsewhere. I'm not exactly happy about this scenario but this is the result of the Google overlords I guess. To the end-reader this blog shouldn't change at all, however, there may be broken links on some of my old posts. If you find a broken link in one of my posts, please make a comment on that post and let me know about it so I can try to fix it.

Labels: , , , ,

Reference Link


Sunday, January 10, 2010

Apple Time Machine backups to Ubuntu network drive

Apple's Time Machine is an awesome utility but gets frustrating when you have to use an external drive. An easier was to do these back ups is using a network drive. Fortunately, the netatalk package installed on an Ubuntu server can provide the functionality you want.

I am using Ubuntu 9.10 on my server. As a note, this is actually a MythBuntu server but functionality should be the same on any other Ubuntu 9.10 server/workstation.

First, as of this writing, the netatalk 2.0.5 packages are not available in karmic's repositories so let's add a debian repository by adding the following to /etc/apt/sources.list:
deb http://ftp.de.debian.org/debian sid main

Now let's install the netatalk package:
sudo apt-get install netatalk

Create a directory for time machine backups:
mkdir /home/user/timemachine

Now we need to edit the /etc/netatalk/AppleVolumes.default file and add the following line:
/home/user/timemachine timemachine options:tm

And restart netatalk:
sudo /etc/init.d/netatalk restart

Now on your mac, open finder, select the Go menu and "Connect to Server". Fill in your server's ip address prefixed by afp:// (for example, afp://192.168.1.100) and you should be prompted for a volume to mount. Select "timemachine", of course. Once that volume is mounted, go to time machine preferences and select that disk and you're all set. If you don't see your network drive as an option then open up terminal and issue the following command:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

As a note, you may want to now go and remove the extra line from your /etc/apt/sources.list file so that future apt-get commands don't rely on debian's repository and not it's own

Labels: , , , , , , , ,

Reference Link


Thursday, November 19, 2009

PVR-150 IR Blaster on MythBuntu 9.10 with Dish Network

Upgrading to MythBuntu 9.10 from 9.04 was a challenge on some respects but the biggest of the challenges was getting my PVR-150 IR Blaster working.... again. I don't know why Ubuntu loves to break this thing on every upgrade but they do. Thanks to Jimmybondo for the bulk of this work.



  • sudo apt-get install lirc-modules-source
  • cd /usr/src/lirc-0.8.6
  • wget http://www.skynet.ie/~shabba/zilog.diff
  • sudo patch -p0 < ~/Downloads/zilog.diff
  • sudo dpkg-reconfigure lirc-modules-source


Now edit your /etc/init.d/hardware.conf file and replace lirc_pvr150 with lirc_zilog and you should be set.

If you're not upgrading from MythBuntu 9.04 and/or don't have the rest of your configuration files, you can refer to my prior post for what your lircd.conf file needs to look like. You may also need to add the following to hardware.conf:
TRANSMITTER_DEVICE="/dev/lirc0"

Labels: , , , , , ,

Reference Link