找回密碼
 新用戶註冊
搜索
熱搜: hifi av 音樂
樓主: obee

[CAS] 用 Pogoplug 玩CAS

[複製鏈接]
發表於 2013-4-2 11:55:18 | 顯示全部樓層
Thanks, (I am lw), trying to use ArchLinux + mpd to compare VAMP.  
回復

使用道具 舉報

 樓主| 發表於 2013-4-2 12:08:21 | 顯示全部樓層
CAS2012 發表於 2013-4-2 11:55
Thanks, (I am lw), trying to use ArchLinux + mpd to compare VAMP.

I see, welcome lw hing.
回復

使用道具 舉報

發表於 2013-4-5 00:59:35 | 顯示全部樓層
obee 發表於 2013-3-30 11:54
Play from USB is more difficult. So I won't tell in here.

Obee hing

I successfully installed Archlinux and plays file from NAS.  However as I am helping a friend to try the Pogoplug to work with his USB disk array, can you point me to some reference for setting up Pogoplug/Archlinux using USB drives ?  I tried to make a mount point for the USB drive but every time it make the system crashed and cannot boot up.

Thanks.
回復

使用道具 舉報

 樓主| 發表於 2013-4-5 07:47:04 | 顯示全部樓層
本帖最後由 obee 於 2013-4-5 07:48 編輯
elo 發表於 2013-4-5 00:59
Obee hing

I successfully installed Archlinux and plays file from NAS.  However as I am helping a  ...


You can add a "rule" to tell Linux auto mount for you on detecting new USB devices:
  1. vi /etc/udev/rules.d/11-auto-mount.rules
複製代碼
(or using other editors)

Then paste the following code:
  1. KERNEL!="sd[a-z]*", GOTO="auto_mount_end"
  2. ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="auto_mount_end"

  3. # Set environment
  4. ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p -s TYPE -s LABEL %N"

  5. # Global mount options
  6. ACTION=="add", ENV{mount_options}="relatime,users,umask=0,ro"

  7. # Filesystem specific options
  8. #ACTION=="add", ENV{ID_FS_TYPE}=="vfat", ENV{mount_options}="%E{mount_options},showexec"
  9. ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", ENV{mount_options}="%E{mount_options},utf8"

  10. # Get mount point
  11. # use basename to correctly handle labels such as ../mnt/foo
  12. ACTION=="add", ENV{ID_FS_LABEL}=="?*", PROGRAM="/usr/bin/basename '%E{ID_FS_LABEL}'", ENV{dir_name}="%c"
  13. ACTION=="add", ENV{dir_name}!="?*", ENV{dir_name}="usbhd-%k"

  14. # Main action
  15. ACTION=="add", ENV{dir_name}=="?*", RUN+="/bin/mkdir -p '/music/usb/%E{dir_name}'", RUN+="/bin/mount -o %E{mount_options} /dev/%k '/music/usb/%E{dir_name}'", RUN+="/usr/bin/mpc update"
  16. ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/umount -l '/music/usb/%E{dir_name}'", RUN+="/bin/rmdir '/music/usb/%E{dir_name}'", RUN+="/bin/rmdir '/music/usb'", RUN+="/usr/bin/mpc update"

  17. LABEL="auto_mount_end"

  18. # label must be cleared
  19. ENV{ID_FS_LABEL}=""
複製代碼
Remember to run "sync" before "poweroff"
回復

使用道具 舉報

發表於 2013-4-5 08:25:03 | 顯示全部樓層
obee 發表於 2013-4-5 07:47
You can add a "rule" to tell Linux auto mount for you on detecting new USB devices:(or using other ...

Thanks Obee hing

Just tried the instruction, mpd found the USB drive and showed all the files from it.  However when played the file, there is no sound output from the speaker, and the console showed journal commit I/O error.  Then seems the system crashed as whatever command I typed in, its said "no such command".  I pulled the power cord and tried to reboot but with the USB stick drive (where Archlinux was installed) inserted, Pogoplug could not boot up.  Only after I removed the USB stick drive, it can boot up.  Exactly the same as last time I made it work for a while.  Seems I need to re-installed Archlinux again and better stick to NAS rather USB drive.

Will further search on the net to see how to make it work.

Anyway thanks for your big help.
回復

使用道具 舉報

發表於 2013-4-5 22:02:50 | 顯示全部樓層
elo 發表於 2013-4-5 08:25
Thanks Obee hing

Just tried the instruction, mpd found the USB drive and showed all the files fro ...

I suppose you are using stock Arch Linux. The file system in USB drive may corrupt if the Pogoplug was not power down properly, and thus it may not be able to boot again.

Until we can have a read-only root filesystem, don't turn off Pogoplug without proper shutdown.
回復

使用道具 舉報

發表於 2013-4-12 15:51:02 | 顯示全部樓層
I have updated the Debian Wheezy on my Pogoplug to run with read-only root filesystem. I will let it run for a couple of days, and let you know the result if it is stable.

Cheers.
回復

使用道具 舉報

發表於 2013-4-12 16:11:14 | 顯示全部樓層
colorp 發表於 2013-4-12 15:51
I have updated the Debian Wheezy on my Pogoplug to run with read-only root filesystem. I will let it ...

Color hing

It is great.  Waiting for your update on this.  Thanks.
回復

使用道具 舉報

發表於 2013-4-12 17:17:28 | 顯示全部樓層
本帖最後由 CAS2012 於 2013-4-12 17:19 編輯

elo hing,
This morning I tried to install ArchLinux + mpd into Pogoplug, this time I ran through all the steps carefully, I could see the song playing in my pad, but no sound coming out, by the time I unplugged and plugged back dc trying to reset pogo, it cannot boot up. Have to try again tonight.
BTW, VAMP on contrary is very stable, no need to choose usb flash memory, Archlinux does not work on my newly bought HP usb flash memory. Extremely stable for music listening. Stevenha in R33 had done some research installing mpd into VAMP which support DSD, a very good news. I will keep my effort to make Archlinux mpd  sings in my system.
In streaming mode using pogo, use one pogo as server and fetch 24/192 flac no problem, but streaming NAS using pogo as server/client will encounter delay. In this case, I stick to NAS as server makes things simple enough.
LW
回復

使用道具 舉報

發表於 2013-4-18 19:47:17 | 顯示全部樓層
After a few days of testing, it seems that the read-only root FS is working fine with Debian Wheezy. If you want to install Debian Wheezy, please see the below for reference.

https://sites.google.com/site/le ... eze-on-pogoplug-e02
http://wiki.daviddarts.com/Pogoplug


回復

使用道具 舉報

發表於 2013-4-18 19:57:49 | 顯示全部樓層
Steps to prepare the read-only root FS:

Assumption:
- running Debian Wheezy
- login as root

1. install cron, mpd & nginx (optional, for serving cover arts for MPod/MPad), update configuration file and do tests as desired
2. stop mpd & nginx from automatic start up (I used "rcconf")
3. update /etc/fstab, mount / as read-only, then reboot
4. login and check whether / is mounted as read-only
5. remount / as writable ( mount -o remount,rw,noatime / )
6. save readonlyroot to /etc/init.d/, chmod 755 /etc/init.d/readonlyroot
7. run command: update-rc.d readonlyroot start 36 S . stop 99 0 6 .
8. run command: service readonlyroot init
9. run command: service readonlyroot save
10. check whether you have /var/persist/current.tar.gz
11. remount / as read-only
12. service start mpd
13. service start nginx
14. if no error, reboot
15. mount / as writable, run: crontab -e

        # daily at 4 a.m.
        0 4 * * * /etc/init.d/readonlyroot save >/dev/null
OR,
        # hourly
        0 * * * * /etc/init.d/readonlyroot save >/dev/null

16. start up mpd & nginx automatically on reboot (I used "rcconf")

readonlyroot:
  1. #! /bin/bash
  2. # readonlyroot.sh -- Setup dirs on the tmpfs to keep the root partition read-only
  3. # See-Also: http://roland.entierement.nu/pages/debian-on-soekris-howto.html
  4. # Available-At: https://gist.github.com/1216392
  5. #
  6. # Place this file in /etc/init.d and run:
  7. #   update-rc.d readonlyroot start 36 S . stop 99 0 6 .
  8. #
  9. # To maintain persistent data, place a file at /etc/cron.d/readonlyroot as:
  10. #   * 4 * * *      root    /etc/init.d/readonlyroot save >/dev/null
  11. #
  12. # 2013.04.11: modified by Pink Cheung for PogoPlug v2
  13. #
  14. ### BEGIN INIT INFO
  15. # Provides:          readonlyroot
  16. # Required-Start:    $local_fs
  17. # Required-Stop:     $local_fs
  18. # X-Stop-After:      $network
  19. # Should-Start:
  20. # Should-Stop:
  21. # Default-Start:     S
  22. # Default-Stop:      0 6
  23. # Short-Description: Prepare read-only root filesystem.
  24. # Description:
  25. ### END INIT INFO

  26. set -e

  27. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  28. DESC="read-only root"

  29. PREFIX=/mnt/ro-root
  30. DIRS=(
  31.         /var/backups
  32.         /var/log
  33.         /var/lib/{alsa,dhcpcd,ntpdate,urandom}
  34.         /var/lib/mpd/playlists
  35.         /var/lib/nginx/{body,fastcgi,proxy,scgi,uwsgi}
  36.         /var/tmp
  37.          )
  38. FILES=(
  39.         /etc/adjtime
  40.         /var/lib/mpd/tag_cache
  41.         /var/lib/mpd/state
  42.         /var/lib/mpd/sticker.sql
  43.         )
  44. MKDIRS=(
  45.         /var/log/{apt,fsck,mpd,nginx}
  46.         )
  47. TOUCHFILES=(
  48.         /var/log/wtmp
  49.         )

  50. PERSIST=/var/persist
  51. PERSISTPATHS=(
  52.         /var/backups
  53.         /var/lib/mpd/playlists
  54.         /var/lib/mpd/tag_cache
  55.         /var/lib/mpd/state
  56.         /var/lib/mpd/sticker.sql
  57.         /var/lib/nginx
  58.         )

  59. TMPFS_OPTS="size=64m,nosuid,nodev"
  60. ROFSFLAG=/run/lock/readonlyroot_ready

  61. # ============================================================================

  62. # ============================================================================

  63. case "$1" in
  64.         init)
  65.                 echo -n "Initializing $DESC... "
  66.                 mkdir -p ${PREFIX}
  67.                 mountpoint -q ${PREFIX} || mount -t tmpfs -o "$TMPFS_OPTS" tmpfs ${PREFIX}
  68.                 for i in "${DIRS[@]}" "${FILES[@]}"; do
  69.                         [ ! -L $i ] || [ x"`readlink $i`" != x${PREFIX}$i ] || continue
  70.                         echo $i
  71.                         mkdir -p `dirname ${PREFIX}$i`
  72.                         mv -f $i ${PREFIX}$i || rm -rf $i
  73.                         ln -sfn ${PREFIX}$i $i
  74.                 done
  75.                 echo "done."
  76.                 ;;
  77.         start)
  78.                 if [ -f "$ROFSFLAG" ]; then
  79.                         echo "$DESC in use... "
  80.                         exit 0
  81.                 fi
  82.                 echo -n "Setting up $DESC... "
  83.                 mkdir -p ${PREFIX}
  84.                 mountpoint -q ${PREFIX} || mount -t tmpfs -o "$TMPFS_OPTS" tmpfs ${PREFIX}
  85.                 # skeleton of $PREFIX
  86.                 for i in "${DIRS[@]}" "${MKDIRS[@]}" ; do
  87.                         mkdir -p ${PREFIX}$i
  88.                 done
  89.                 # files in $PREFIX
  90.                 for i in "${TOUCHFILES[@]}" ; do
  91.                         touch ${PREFIX}$i
  92.                 done
  93. #                 # fix stuffs
  94. #                 chown daemon:daemon ${PREFIX}/var/spool/cron/at{jobs,spool}
  95. #                 chmod ug=rwx,o=,+t ${PREFIX}/var/spool/cron/at{jobs,spool}
  96. #                 chown root:crontab ${PREFIX}/var/spool/cron/crontabs
  97. #                 chmod ug=rwx,g-r,o=,+t ${PREFIX}/var/spool/cron/crontabs
  98.                 #chown ntp:ntp ${PREFIX}/var/lib/ntp
  99.                 chown mpd:audio ${PREFIX}/var/lib/mpd/playlists
  100.                 #chown mpd:audio ${PREFIX}/var/log/mpd
  101.                 echo "done."
  102.                 # load persistent data
  103.                 "$0" load
  104.                 touch "$ROFSFLAG"
  105.                 ;;
  106.         stop)
  107.                 #"$0" save
  108.                 echo -n "Stopping $DESC... "
  109.                 echo "done."
  110.                 ;;
  111.         load)
  112.                 lastTS=`stat -c %Y "$PERSIST"/current.tar.gz`
  113.                 currTS=`date +%s`
  114.                 if [ $lastTS -gt $currTS ] ; then
  115.                         lastTS=`stat -c %y "$PERSIST"/current.tar.gz | cut -d"." -f 1`
  116.                         echo -n "Set system time to $lastTS... "
  117.                         date -s "$lastTS"
  118.                 fi
  119.                 echo -n "Loading persistent data... "
  120.                 cd "$PREFIX"
  121.                 tar xzpf "$PERSIST"/current.tar.gz
  122.                 #rsync -a -q --delete-after "$PERSIST" "$PREFIX"
  123.                 echo "done."
  124.                 ;;
  125.         save)
  126.                 echo -n "Saving persistent data... "
  127.                 next=tmp.tar.gz
  128.                 fs=`df "$PERSIST" | tail -n +2 | sed 's/.*% *//' | head -n 1`
  129.                         : ${fs:=/}
  130.                 trap 'mount -o remount,ro "$fs"' EXIT
  131.                 mount -o remount,rw "$fs"
  132.                 mkdir -p "$PERSIST"
  133.                 cd "$PREFIX"
  134.                 rm -rf "$PERSIST"/$next
  135.                 tar cpzf "$PERSIST"/$next "${PERSISTPATHS[@]#/}" || rm -f "$PERSIST"/current.tar.gz
  136.                 mv -f "$PERSIST"/$next "$PERSIST"/current.tar.gz
  137.                 #rsync -a -q --delete-after "$PREFIX" "$PERSIST"
  138.                 sync
  139.                 echo "done."
  140.                 ;;
  141.         *)
  142.                 echo "Usage: $SCRIPTNAME {start|stop|init|save|load}" >&2
  143.                 exit 1
  144.                 ;;
  145. esac

  146. exit 0
複製代碼
回復

使用道具 舉報

發表於 2013-4-18 21:53:41 | 顯示全部樓層
CAS2012 發表於 2013-4-12 17:17
elo hing,
This morning I tried to install ArchLinux + mpd into Pogoplug, this time I ran through all ...

LW hing

That's what I also came across.  Seems the file is playing but no sound then after power off, Archlinux cannot boot up...

As colorp hing just posted steps to make a read-only file system, hope it can make the Archlinux/Pogoplug more stable.

For installing mpd in VAMP, I will have a look in R33 forum.  Thanks for your information.

回復

使用道具 舉報

發表於 2013-4-19 15:00:42 | 顯示全部樓層
colorp 發表於 2013-4-18 19:57
Steps to prepare the read-only root FS:

Assumption:

colorp hing

Is that just copy and paste your command under root will convert to Read-only system with mpd installed?

Thanks.
回復

使用道具 舉報

 樓主| 發表於 2013-4-19 15:15:01 | 顯示全部樓層
elo 發表於 2013-4-18 21:53
LW hing

That's what I also came across.  Seems the file is playing but no sound then after power  ...


colorp 兄的做法不能apply在arch-linux上的. 只可apply在 debian 同系的 linux distribution上

Debian 用 init script 的:
http://wiki.debian.org/Daemon

Arch Linux 用 systemd 的, 係基於 Sys-V 上發展出來的:
https://wiki.archlinux.org/index.php/Systemd

簡單講, Arch Linux 用的 systemd 先進好多, 但唔係傳統用開的 init, 所以又要學過

其實唔同linux內部大至係一樣, 但一定有多小唔同, 要case by case 去講係講幾年都講唔完.

如果有D linux background, 自己摸下都可以做到 read-only FS 的, 參考番我在 cubox 上做 read-only FS 的 post:
http://www.hiendy.com/hififorum/ ... ;page=11#pid1381154
裡面的concept只要明白, 便可以 apply 番去 pogoplug 令佢有 read-only FS.
回復

使用道具 舉報

發表於 2013-4-19 15:19:09 | 顯示全部樓層
obee 發表於 2013-4-19 15:15
colorp 兄的做法不能apply在arch-linux上的. 只可apply在 debian 同系的 linux distribution上

Debian  ...

Thanks Obee hing

I know some basic Linux command but not up to the level can write script.  So I can just "copy & paste".  Hope someone can post the step to convert Archlinux/Pogoplug to Read-only file system.

Thanks
回復

使用道具 舉報

 樓主| 發表於 2013-4-19 15:25:00 | 顯示全部樓層
elo 發表於 2013-4-19 15:19
Thanks Obee hing

I know some basic Linux command but not up to the level can write script.  So I  ...

Actually no need write script, but you need to know the concept.

For arch linux, you need to know how "systemd" works. Then you can just copy some existing service profile and change to your need.

For debian kind linux, you need to know what is runlevel, how is the boot sequence, how to make a script run automatically and how to disable it.
回復

使用道具 舉報

發表於 2013-4-19 21:25:29 | 顯示全部樓層
各位師兄,小弟做了一個Debian Wheezy Linux 的image。有興趣就請試一試啦。

Requirements:
- Pogoplug v2 with latest uboot installed (see steps 1-3 in http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray)
- USB drive with at least 2GB space

1. boot Pogoplug without any USB drive attached
2. login in as root
3. insert USB drive into Pogoplug
4. use fdisk to create partition(s) (see steps 5-6 in http://archlinuxarm.org/platforms/armv5/pogoplug-v2-pinkgray for reference)
5. format the partition (ext2)
  1. mke2fs /dev/sda1
複製代碼
6. download the image and save files to the USB drive
  1. cd /tmp
  2. mkdir usb
  3. mount /dev/sda1 usb
  4. cd usb
  5. wget http://www.hklite.com/public/debian-wheezy-basic.tar.gz
  6. tar -xvpzf debian-wheezy-basic.tar.gz
  7. rm debian-wheezy-basic.tar.gz
  8. sync
  9. cd /tmp
  10. umount /tmp/usb
  11. reboot
複製代碼
7. after reboot, login with "root", and password "root"
8. run "uname -a", and you should see something as below.
  1. root@debian:~# uname -a
  2. Linux debian 3.2.0-4-kirkwood #1 Debian 3.2.41-2 armv5tel GNU/Linux
  3. root@debian:~#
複製代碼
9. now you can use "remountrw" to re-mount root partition as writable; use "remountro" to re-mount it as read-only
10. configure mpd & nginx as per your requirements

By default, the system will make a back up of the MPD data at 4am daily. You may change it with "crontab -e".

Cheers.

評分

1

查看全部評分

回復

使用道具 舉報

發表於 2013-4-19 21:34:44 | 顯示全部樓層
BTW, 如果 login 改左野,記得要 "remountro",然後先好拔電源啊。
回復

使用道具 舉報

發表於 2013-5-2 10:50:26 | 顯示全部樓層
hi Obee ching

Thank you so much for your generous teaching. I'm a idiot of Linux. I just follow your post and successfully install the Archlinux. However, mpad cannot detect any mpd server. I tried to type "mpd" on the command line and got the following message

putty capture 1.JPG

It seems that there is problem running mpd. I have checked music folder, it seems that it connected to my NAS successfully. I have checked "aplay" and seem that the output audio device is ok.

putty capture 2.JPG

So, can you advise me what's wrong and how can I fix it? Thx

回復

使用道具 舉報

 樓主| 發表於 2013-5-2 11:07:47 | 顯示全部樓層
jonahung 發表於 2013-5-2 10:50
hi Obee ching

Thank you so much for your generous teaching. I'm a idiot of Linux. I just follow you ...

In archlinux, if you want to check the status of mpd, you should run
  1. systemctl status mpd.service
複製代碼
Try to run it and show us the status first.
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 新用戶註冊

本版積分規則

Archiver|小黑屋|聯絡我們|刊登廣告|Hiendy.com 影音俱樂部 一個屬於音響愛好者的家

GMT+8, 2025-11-10 08:34 , Processed in 0.062232 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回復 返回頂部 返回列表