Wednesday, June 29, 2011

Upgrade to Fedora 15

After moving /boot to LVM I can run preupgrade.

At the end of preupgrade, it came up with an error because my /boot was in LVM

Traceback (most recent call last):
File "/usr/share/preupgrade/preupgrade-gtk.py", line 259, in on_assistant_apply
self._do_main()
File "/usr/share/preupgrade/preupgrade-gtk.py", line 278, in _do_main
self.main_preupgrade()
File "/usr/share/preupgrade/preupgrade-gtk.py", line 497, in main_preupgrade
extra_args += " ks=%s" % self.pu.generate_kickstart()
File "/usr/lib/python2.7/site-packages/preupgrade/__init__.py", line 601, in generate_kickstart
return dev.bootpath_to_anacondapath(targetfile, UUID=True)
File "/usr/lib/python2.7/site-packages/preupgrade/dev.py", line 91, in bootpath_to_anacondapath
raise PUError, "/boot is on RAID device %s" % bootdev
preupgrade.error.PUError: /boot is on RAID device dm-15

To fix this, I had to add a /etc/grub.d/35_preupgrade file to the grub2 config scripts (and chmod 755 to the file)


#!/bin/sh
exec tail -n +3 $0
#############
# Custom script for F14->F15 preupgrade
#############
menuentry "Fedora 15 Preupgrade" {
insmod lvm
insmod ext2
set root='(vg_rootvg-boot_lv)'
echo Loading Fedora 15 Preupgrade
linux /boot/upgrade/vmlinuz
initrd /boot/upgrade/initrd.img
boot
}

Added that file, ran grub2-mkconfig / grub2-install on my /dev/sdc again. Now grub2-mkconfig adds an entry for the new "Fedora 15 Preupgrade" item in the Grub2 menu.

Reboot and saw the new entry. Selected it and the Fedora 15 preupgrade ran successfully.

New entries were added to the Grub2 menu after the F15 installation. On first boot, it generated a kernel panic "Kernel Panic not syncing vfs" because the boot procedure couldn't find root.

Had to re-run grub2-mkconfig to have it automaticallly add a missing initrd line in the boot procedure

menuentry "GNU/Linux, with Linux 2.6.38.8-32.fc15.i686.PAE" --class gnu-linux --class gnu --class os {
set gfxpayload=keep
insmod lvm
insmod ext2
set root='(vg_rootvg-boot_lv)'
search --no-floppy --fs-uuid --set 856a58e8-4d98-4ef3-a062-7b6982f6d8f9
echo Loading Linux 2.6.38.8-32.fc15.i686.PAE ...
linux /vmlinuz-2.6.38.8-32.fc15.i686.PAE root=UUID=f25ba21c-194e-49cd-a347-fd0540a96c1b ro rdblacklist=nouveau nouveau.modeset=0 quiet rhgb
echo Loading initial ramdisk ...
initrd /initramfs-2.6.38.8-32.fc15.i686.PAE.img
}

Upgrading Grub to Grub2

This started with the Fedora 15 upgrade. Preupgrade needed +120MB in /boot, and I only had a /dev/sdc1 100MB /boot and the rest of the filesystems in LVM. GRUB2 supported /boot in LVM. So I used parts of

GRUB2 Guide from Fedora Forum.org

as a guideline.

1. Installed Grub2. Tested to make sure Grub booted to Grub2 and it was still booting my F14 kernel
2. Used grub2-mkconfig and grub2-install to write the grub2 boot loader to my /dev/sdc so that I can boot directly to GRUB2 in F14. Worked successfully.
3. Created 500MB boot_lv - lvcreate -L 500M -n boot_lv /dev/rootvg
4. Unmount /boot, mount in /mnt/boot. Mount /dev/rootvg/boot_lv to /boot.

cd /boot; find ./ -xdev -print0 | cpio -pa0V /mnt/boot

5. Change fstab to point to new LVM /boot instead of the old UUID static partition /boot. Run grub2-mkconfig / grub2-install again to get updated /boot.
6. Reboot to test.

Friday, June 24, 2011

Rotate video from the command line

Taken from http://www.thelinuxblog.com/rotating-videos-in-linux/ - great info

Command to rotate a video is:

mencoder -ovc lavc -vop rotate=1 -oac copy input.mpg -o output.mpg

The rotate=1 can be replaced with whatever option best suits your needs. Rotating video options are below:

0 Rotate by 90 degrees clockwise and flip (default).
1 Rotate by 90 degrees clockwise.
2 Rotate by 90 degrees counterclockwise.
3 Rotate by 90 degrees counterclockwise and flip.

FFMPEG to truncate video


[root@localhost] ffmpeg -i [inputfile] -vcodec copy -acodec copy  -ss [start] -t [duration] [outputfile]

Seems to work faster than the mencoder method

Monday, July 19, 2010

Android random information

Mount SD card from recovery (or from adb)

adb shell
mount /sdcard
exit

Access Recovery Mode

Power down phone
Hold down Home button
Press power

Install APK from adb

Copy file into android-sdk/tools dir

adb install .apk

Downgrade radio to 3.22


fastboot flash radio Radio_HTC_PVT_32A_3.22.20.17.img
fastboot flash hboot hboot-1.33.2010.img
fastboot flash recovery recovery-RA-sapphire-v1.5.2H.img
fastboot erase system -w
fastboot reboot-bootloader

Sunday, July 11, 2010

gthumb import folder date format

This is for gthumb 2.11.3 or above.

Go into Preferences, change to custom date format, and use regular unix date format to make the directory structure like the original gthumb directory structure

%Y-%m-%d--%H.%M.%S

Saturday, January 30, 2010

Convert WMV to DVD using mencoder

ffmpeg -i sourcevideo.wmv -target ntsc-dvd -aspect 4:3 targetvideo.mpg

FFmpeg version SVN-r20372, Copyright (c) 2000-2009 Fabrice Bellard, et al.
built on Nov 7 2009 17:50:32 with gcc 4.4.2 20091027 (Red Hat 4.4.2-7)
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.37. 1 / 52.37. 1
libavformat 52.39. 2 / 52.39. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1. 4. 1 / 1. 4. 1
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0

Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 30.00 (30/1)
Input #0, asf, from 'sourcevideo.wmv':
Duration: 00:11:45.18, start: 3.000000, bitrate: 2844 kb/s
Stream #0.0(eng): Audio: wmav2, 44100 Hz, 2 channels, s16, 64 kb/s
Stream #0.1(eng): Video: wmv2, yuv420p, 1600x1200, 2722 kb/s, 30 tbr, 1k tbn, 1k tbc
Metadata
WMFSDKVersion : 11.0.6002.18049
WMFSDKNeeded : 0.0.0.0000
IsVBR : 1
ASFLeakyBucketPairs:
VBR Peak : 6298117
Buffer Average : 37364
[ac3 @ 0x8bd0e60]No channel layout specified. The encoder will guess the layout, but it might be incorrect.
Output #0, dvd, to 'targetvideo.mpg':
Stream #0.0(eng): Video: mpeg2video, yuv420p, 720x480 [PAR 8:9 DAR 4:3], q=2-31, 6000 kb/s, 90k tbn, 29.97 tbc
Stream #0.1(eng): Audio: ac3, 48000 Hz, stereo, s16, 448 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Press [q] to stop encoding
[dvd @ 0x8bcfed0]buffer underflow i=1 bufi=1540 size=1792ate=1707.6kbits/s
Last message repeated 1 times
frame=21133 fps= 58 q=2.0 Lsize= 176904kB time=705.10 bitrate=2055.3kbits/s
video:132564kB audio:38568kB global headers:0kB muxing overhead 3.372647%


dvdauthor -o videodir -t targetvideo.mpg

DVDAuthor::dvdauthor, version 0.6.14.
Build options: gnugetopt graphicsmagick iconv freetype
Send bugs to

INFO: dvdauthor creating VTS
STAT: Picking VTS 01

STAT: Processing targetvideo.mpg...
STAT: VOBU 1168 at 171MB, 1 PGCS
INFO: Video pts = 0.500 .. 705.637
INFO: Audio[0] pts = 0.500 .. 705.748
STAT: VOBU 1174 at 172MB, 1 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x480
INFO: Audio ch 0 format: ac3/2ch, 48khz drc

STAT: fixed 1174 VOBUS



Create table of contents

dvdauthor -o videodir -T

DVDAuthor::dvdauthor, version 0.6.14.
Build options: gnugetopt graphicsmagick iconv freetype
Send bugs to

INFO: dvdauthor creating table of contents
INFO: Scanning video/VIDEO_TS/VTS_01_0.IFO

mkisofs -dvd-video -o video_dvd.iso video

I: -input-charset not specified, using utf-8 (detected in locale settings)
5.64% done, estimate finish Sat Jan 30 22:25:39 2010
11.25% done, estimate finish Sat Jan 30 22:25:39 2010
16.89% done, estimate finish Sat Jan 30 22:25:39 2010
22.50% done, estimate finish Sat Jan 30 22:25:39 2010
28.13% done, estimate finish Sat Jan 30 22:25:39 2010
33.75% done, estimate finish Sat Jan 30 22:25:39 2010
39.38% done, estimate finish Sat Jan 30 22:25:39 2010
45.00% done, estimate finish Sat Jan 30 22:25:39 2010
50.63% done, estimate finish Sat Jan 30 22:25:39 2010
56.24% done, estimate finish Sat Jan 30 22:25:39 2010
61.88% done, estimate finish Sat Jan 30 22:25:39 2010
67.49% done, estimate finish Sat Jan 30 22:25:39 2010
73.13% done, estimate finish Sat Jan 30 22:25:39 2010
78.74% done, estimate finish Sat Jan 30 22:25:39 2010
84.37% done, estimate finish Sat Jan 30 22:25:40 2010
89.99% done, estimate finish Sat Jan 30 22:25:40 2010
95.62% done, estimate finish Sat Jan 30 22:25:40 2010
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 4096
Path table size(bytes): 42
Max brk space used 19000
88904 extents written (173 MB)