# Howto View Roamio Logs on Linux



## telemark (Nov 12, 2013)

PREFACE: While Linux will let you WRITE to the drive as well, doing so runs a small risk the Roamio will reject the drive and go into an infinite reboot loop. The only certain way to recover from is to erase the drive losing your recordings. Don't try it, unless you have the tools and skill to recover from such a situation. The steps below are for READS and is likely safe because of it.

The Ext partitions on Roamio hard drives _appear_ to be readable on commonplace Linux PC's. There's no new techniques in here, but an attempt to be accurate and safe for the semi-technical.

1) Connect the Roamio Hard Drive to a Linux computer, either via Sata or eSata/USB housing. 
Check the drive has had enough time to spin up.

2) Locate device name by running:
> dmesg | tail -30
You are looking for a few lines that says "sd" followed by a lower case letter. Confirm it's the right drive, it should say:
sdX: unknown partition table
And just above that it will list the size and model name detected. Make sure everything matches. This is very important as one day you'll erase all your data if you have this one letter off.

3) View the partition map of the device name from step 2. Viewing the device probably requires root permissions so su or sudo at this point.

To view by hand it's:
> dd if=/dev/sdX skip=9 count=1 bs=512 | od -h -a

Automatic programs:
> ./pmdmp /dev/sdX
> ./pdisk -l /dev/sdX (not Roamio aware as of today, but eventually)
> ./mfslayout.sh /dev/sdX (requires the Roamio fork)

4) /var is partition 9, you're looking for the offset for this partition. Most viewers will be displaying 512byte blocks. Multiply this number by 512 to convert to bytes, on a calculator that can handle large numbers. [Google works: OFFSET * 512]

5) Create loopback device with calculated offset:
> losetup --offset NUMBER_FROM_4 -f /dev/sdX

6) Locate corresponding new loopback device, in the first column:
> losetup -a

7) Test it if makes sense as Ext:
> dumpe2fs /dev/loopX
This will either give you a short and curt error message or long and detailed success message with more than you want to know. If you got the short message, nothing you can do except skip to the Undo part and try again, double checking you have your numbers, math, and device right.

7b) Another method in case if you're really stuck but slightly off, is looking for the magic header in the superblock by hand.
> od -h /dev/loopX | grep "ef53" 
This is not easy so you might as well just post back for help instead.

8) Mount Read Only:
> mkdir /mnt/Roamio
> mount -oro /dev/loopX /mnt/Roamio

9) View logs:
> cd /mnt/Roamio/log/
> less kernel
> less messages
> less tverr

9b) older logs get compressed. Use zcat or gzcat.

-1) Undo above steps manually:
> cd / # in all shells
> umount /mnt/Roamio
> losetup -D
Device should be free now if there were no errors.

X) Undo them all at once, it should be safe to do a reboot:
> /sbin/shutdown -r now


----------



## ntlord (Nov 30, 2013)

Could you do an ls of a couple of directories, like /etc, maybe /usr/bin

It would be interesting to see what programs come installed on the roamio. Maybe we could get an ssh or telnet daemon up and running or something. We might also be able to modify the rpc daemon


----------



## telemark (Nov 12, 2013)

/etc and /usr/bin are not on the hard drive.

On drive there's just swap, /var, /db [and MFS]

```
/var:                                            directory
/var/packages:                                   directory
/var/tmp:                                        directory
/var/tmp/.podapp:                                socket
/var/tmp/TranscoderSync:                         directory
/var/tmp/mcp:                                    directory
/var/tmp/HmeHost:                                directory
/var/tmp/RttDaemon:                              directory
/var/tmp/java:                                   directory
/var/tmp/java/tcdclient:                         directory
/var/tmp/java/tcdclient/data:                    directory
/var/tmp/java/tcdclient/data/3:                  directory
/var/tmp/java/tcdclient/fwprops.xargs:           ASCII text
/var/tmp/java/tcdclient/bs:                      directory
/var/tmp/java/tcdclient/bs/1:                    directory
/var/tmp/java/tcdclient/bs/1/lastModifed:        data
/var/tmp/java/tcdclient/bs/1/location:           data
/var/tmp/java/tcdclient/bs/1/jar0:               Zip archive data, at least v1.0 to extract Java Jar file data (zip)
/var/tmp/java/tcdclient/bs/1/startlevel:         raw G3 data, byte-padded
/var/tmp/java/tcdclient/bs/3:                    directory
/var/tmp/java/tcdclient/bs/3/lastModifed:        data
/var/tmp/java/tcdclient/bs/3/autostart:          raw G3 data, byte-padded
/var/tmp/java/tcdclient/bs/3/location:           data
/var/tmp/java/tcdclient/bs/3/jar0:               Zip archive data, at least v1.0 to extract Java Jar file data (zip)
/var/tmp/java/tcdclient/bs/3/startlevel:         raw G3 data, byte-padded
/var/tmp/java/tcdclient/bs/5:                    directory
/var/tmp/java/tcdclient/bs/5/lastModifed:        data
/var/tmp/java/tcdclient/bs/5/autostart:          raw G3 data, byte-padded
/var/tmp/java/tcdclient/bs/5/location:           data
/var/tmp/java/tcdclient/bs/5/jar0:               Zip archive data, at least v2.0 to extract Java Jar file data (zip)
/var/tmp/java/tcdclient/bs/5/startlevel:         raw G3 data, byte-padded
/var/tmp/java/tcdclient/bs/2:                    directory
/var/tmp/java/tcdclient/bs/2/lastModifed:        data
/var/tmp/java/tcdclient/bs/2/autostart:          raw G3 data, byte-padded
/var/tmp/java/tcdclient/bs/2/location:           data
/var/tmp/java/tcdclient/bs/2/jar0:               Zip archive data, at least v1.0 to extract Java Jar file data (zip)
/var/tmp/java/tcdclient/bs/2/startlevel:         raw G3 data, byte-padded
/var/tmp/java/tcdclient/bs/4:                    directory
/var/tmp/java/tcdclient/bs/4/lastModifed:        data
/var/tmp/java/tcdclient/bs/4/autostart:          raw G3 data, byte-padded
/var/tmp/java/tcdclient/bs/4/location:           data
/var/tmp/java/tcdclient/bs/4/jar0:               Zip archive data, at least v2.0 to extract Java Jar file data (zip)
/var/tmp/java/tcdclient/bs/4/startlevel:         raw G3 data, byte-padded
/var/tmp/java/tcdclient/startlevel:              directory
/var/tmp/java/tcdclient/startlevel/currentlevel: raw G3 data, byte-padded
/var/tmp/openvpn:                                directory
/var/tmp/openvpn/VPNClientStatus:                fifo (named pipe)
/var/tmp/openvpn/client.config:                  C source, ASCII text
/var/tmp/meshsvc_socket:                         socket
/var/tmp/firewall:                               directory
/var/tmp/firewall/TmkServerIpTables.lock:        empty
/var/tmp/PmSysHost:                              directory
/var/tmp/S_EventSwitcherSocket740:               socket
/var/tmp/tcphonehome.lck:                        empty
/var/tmp/NetflixHost:                            directory
/var/tmp/TvCryptoDaemon:                         directory
/var/tmp/FlashHost:                              directory
/var/tmp/myworld:                                directory
/var/tmp/shmemd:                                 directory
/var/tmp/dbgc-mcp:                               directory
/var/tmp/WebHost:                                directory
/var/tmp/fswak.lock:                             setuid, setgid, sticky, empty
/var/tmp/RendezvousDaemon:                       directory
/var/tmp/SiHost:                                 directory
/var/tmp/res:                                    empty
/var/tmp/jaganmata:                              socket
/var/tmp/httpd:                                  directory
/var/tmp/mindd:                                  directory
/var/tmp/hppm:                                   fifo (named pipe)
/var/tmp/SystemServices:                         directory
/var/tmp/rd:                                     directory
/var/tmp/mfsd:                                   directory
/var/tmp/BlobServiceLauncher:                    directory
/var/tmp/LaunchUI:                               directory
/var/tmp/tcphonehome:                            directory
/var/tmp/DlnaClientEDCMainDaemon:                directory
/var/tmp/KnownHostComponent:                     directory
/var/tmp/StandbyHost:                            directory
/var/utils:                                      directory
/var/persist:                                    directory
/var/dev:                                        directory
/var/dev/log:                                    socket
/var/mtab:                                       ASCII text
/var/etc:                                        directory
/var/etc/locale-cache:                           ASCII text, with no line terminators
/var/keystore:                                   directory
/var/keystore/Eiger0.cer:                        data
/var/keystore/Eiger0.key.bf:                     data
/var/keystore/hdcp.bf:                           data
/var/keystore/wm9.bf:                            data
/var/keystore/shas:                              ASCII text
/var/keystore/blowfish.tcd:                      ASCII text, with very long lines, with no line terminators
/var/keystore/$TSN:                   ASCII text, with no line terminators
/var/keystore/CLMfg_RootCA.cer.bf:               data
/var/keystore/CA00004MfgCA.cer:                  data
/var/run:                                        directory
/var/run/wpa_supplicant_response:                directory
/var/run/wpa_supplicant_response/$NUMS:         socket
/var/run/klogd.pid:                              ASCII text
/var/run/.nscd_socket:                           socket
/var/run/wpa_supplicant:                         directory
/var/run/wpa_supplicant/wifi0:                   socket
/var/run/run:                                    broken symbolic link to `/volatile/run'
/var/run/nscd:                                   directory
/var/run/nscd/socket:                            socket
/var/run/nscd/nscd.pid:                          ASCII text
/var/run/syslogd.pid:                            ASCII text
/var/run/squid.pid:                              ASCII text
/var/cache:                                      directory
/var/cache/tivo:                                 directory
/var/cache/tivo/guide:                           directory
/var/state:                                      directory
/var/state/dhcp:                                 directory
/var/log:                                        directory
/var/log/tvlog:                                  ASCII text, with very long lines
/var/log/tclient:                                ASCII text
/var/log/tverr:                                  ASCII text, with very long lines
/var/log/kdebug:                                 ASCII text
/var/log/tvdebuglog:                             empty
/var/log/svclog:                                 ASCII text
/var/log/svclog.lck:                             empty
/var/log/syslog.pipe:                            fifo (named pipe)
/var/log/demo:                                   ASCII text, with very long lines
/var/log/messages:                               ASCII text, with very long lines
/var/log/kernel:                                 ASCII text
```


```
/db:                                                        directory
/db/VodDb.sqlite-shm:                                       data
/db/UserDb.sqlite-shm:                                      data
/db/TrioDb.sqlite:                                          SQLite 3.x database, user version 27
/db/UclDb.sqlite-shm:                                       data
/db/PgDb_1.sqlite-wal:                                      empty
/db/flashpkgs:                                              directory
/db/RecordingDb.sqlite:                                     SQLite 3.x database, user version 8
/db/ApgDb.sqlite:                                           SQLite 3.x database, user version 26
/db/LdrDb.sqlite-shm:                                       data
/db/ApgDb.sqlite-shm:                                       data
/db/LdrDb.sqlite:                                           SQLite 3.x database, user version 12
/db/NpkDb.sqlite-shm:                                       data
/db/UclDb.sqlite-wal:                                       SQLite Write-Ahead Log, version 3007000
/db/sticky:                                                 ASCII text
/db/Persist.sqlite:                                         SQLite 3.x database
/db/NpkDb.sqlite:                                           SQLite 3.x database, user version 26
/db/PgDb_1.sqlite:                                          SQLite 3.x database, user version 20
/db/HttpDb.sqlite-shm:                                      data
/db/UserDb.sqlite-wal:                                      empty
/db/RecordingDb.sqlite-wal:                                 SQLite Write-Ahead Log, version 3007000
/db/TrioDb.sqlite-shm:                                      data
/db/HttpDb.sqlite-wal:                                      empty
/db/flashapps2:                                             directory
/db/flash2:                                                 directory
/db/flash2/data:                                            directory
/db/flash2/data/volumes:                                    directory
/db/flash2/data/config:                                     directory
/db/flash2/data/config/ssl:                                 directory
/db/flash2/data/config/ssl/certs:                           directory
/db/flash2/data/config/ssl/certs/unencrypted:               directory
/db/flash2/data/config/ssl/certs/unencrypted/ca-bundle.crt: broken symbolic link to `/tvbin/flash3/ssl/certs/unencrypted/ca-bundle.crt'
/db/flashapps:                                              directory
/db/RelDb.sqlite:                                           SQLite 3.x database, user version 2
/db/VodDb.sqlite:                                           SQLite 3.x database, user version 6
/db/VodDb.sqlite-wal:                                       empty
/db/PgDb_1.sqlite-shm:                                      data
/db/ApgDb.sqlite-wal:                                       empty
/db/HttpDb.sqlite:                                          SQLite 3.x database, user version 26
/db/Persist.sqlite-wal:                                     empty
/db/Persist.sqlite-shm:                                     data
/db/flash:                                                  directory
/db/flash/stagecraft-data:                                  directory
/db/flash/stagecraft-data/ssl:                              directory
/db/flash/stagecraft-data/ssl/certs:                        directory
/db/flash/stagecraft-data/ssl/certs/ca-bundle.crt:          broken symbolic link to `/tvbin/flash/ssl/certs/ca-bundle.crt'
/db/flash/stagecraft-data/shared-objects:                   directory
/db/flash/stagecraft-data/shared-objects/database.conf:     broken symbolic link to `/tvbin/flash/config/database.conf'
/db/sqlite_temp:                                            directory
/db/UserDb.sqlite:                                          SQLite 3.x database, user version 7
/db/lost+found:                                             directory
/db/PgDb.sqlite:                                            broken symbolic link to `/db/PgDb_1.sqlite'
/db/RecordingDb.sqlite-shm:                                 data
/db/NpkDb.sqlite-wal:                                       SQLite Write-Ahead Log, version 3007000
/db/UclDb.sqlite:                                           SQLite 3.x database, user version 26
/db/LdrDb.sqlite-wal:                                       empty
/db/TrioDb.sqlite-wal:                                      SQLite Write-Ahead Log, version 3007000
```


----------



## ntlord (Nov 30, 2013)

Does anyone know what that "tcdclient" is? Those jar files look interesting. Should be easily decompiled

Also, is this a complete directory listing? For example, what's under that utils directory? Is it empty? Also, the /var/tmp/etc?

Very interesting.


----------



## telemark (Nov 12, 2013)

Well, my image is virgin. A long running system would have many more files.

This image has not made it through guided setup and not hooked up to net so should not have anything that did not come off of flash.


----------

