Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: sbp on December 29, 2012, 02:41:55 AM

Title: Please help a beginner
Post by: sbp on December 29, 2012, 02:41:55 AM
Hi
I have been trying to use TCE 4.7.2 on my Raspberry (256 RAM).

It boots fine (and very quickly), but my problem starts when I try to install packages, I'm sure that I have done something wrong when preparing the SD-card - eventhough I tried to follw the instructions.

1. I copied the image to the card.
2. Next I used Gparted to fill up the rest of the card with a "data" partition - so I marked the unused part and made a new primary partition as ext2 file format called data. Gparted finished the job without any problems.
3. I started my Raspberry with the new image, and it started fine.
4. I tried to setup my tce directory, so used: tce-setdrive
5. Here I could onle see               1.   /mnt/mmcblk0p1
                                                  2.  /mnt/mmcblk0p2
So I was unable to see my newly created "data" partition.

I tried to use either 1 or 2 (that is /mnt/mmcblk0p1 or /mnt/mmcblk0p2) but then the packages that I dowloaded couldn't be touched, probably because that the directories are read-only.

So in short I think my problem is in point no 2 - where I should make the directory where the packages are stored. Any help is appreciated.

Thanks
Steen

PS: I'm very interested in the ALSA package, but the info on this package states that they are not RPI compatible - so do they not work at the moment?   
Title: Re: Please help a beginner
Post by: bmarkus on December 29, 2012, 04:02:27 AM
Hi

First, do not use all of the unused part of the SD for data, create a SWAP partition with 256MB size and only the rest for data. Forget ext2, use journaling file system, ext4 is perfect.

This is not enough to mark partition type but you must format it, both data and swap partion. Best is to do it with piCore itself using fdisk, mkfs.ext4 and mkswap commands as root.

When ready, either reboot or use rebuildfstab command as root.

New data partition is not mounted automatically as base system do not need it. Mount, create a directory /tce and reboot.

Now if everything is OK, downloaded extensions will be stored in /tce on the data partition and kept for next reboot.

Title: Re: Please help a beginner
Post by: bmarkus on December 29, 2012, 04:09:44 AM
Regarding ALSA, at the moment only the sound kernel moduls are available, ALSA tools itself will come in 1-2 weeks.

'Not PPI compatible' doesn't mean it doesnt work, it indicates only it is not within /usr/local. Everything is repo expected to work. If not, it's a bug.

Title: Re: Please help a beginner
Post by: sbp on December 29, 2012, 05:34:26 AM
Hi bmarkus

Thank you very much for your help. I now have everything running very smoothly - and I can even install packages that will be present after a reboot.

So once again thank you.

EDIT::: Skip this part - I forgot to install libasound!!!!!!!
I have been trying the alsa package, but unfortunately the program that I want to use is complaining about a specific file it is missing:
"error while loading shared libraries: libasound.so.2: cannot open shared object file; No such file or directory"


The error after installing Libasound is ALSA lib conf.c:3705(snd_config_update_r) Cannot access file /usr/local/share/alsa/alsa.conf
Output devices

So I will have to wait some weeks before you hopefully will have build the rest.

Steen
Title: Re: Please help a beginner
Post by: sbp on January 13, 2013, 09:10:57 AM
Hi, I'm seeking advise on two issues .

1. I'm using the piCore 4.7.3, but as far as can see the raspberry part of this image is not the newest, so I was wondering if it would be possible for me to update this part? Especially there seems to have been some development in the Gpu driver, which have improved the sound from the raspberry.

2. Does anybody know which USB  wifi dongle would be easiest to use in the piCore image?

Thanks

Title: Re: Please help a beginner
Post by: bmarkus on January 13, 2013, 11:25:40 AM

2. Does anybody know which USB  wifi dongle would be easiest to use in the piCore image?


Good starting point:

http://elinux.org/RPi_VerifiedPeripherals#USB_Wi-Fi_Adapters
Title: Re: Please help a beginner
Post by: sbp on January 14, 2013, 11:15:21 AM

2. Does anybody know which USB  wifi dongle would be easiest to use in the piCore image?


Good starting point:

http://elinux.org/RPi_VerifiedPeripherals#USB_Wi-Fi_Adapters

Thanks I will find one from the list.


Two new questions/problems:

1
I have been trying to make a small script - let us call it test, which I want to be able to run when I write test in a terminal.
Therefore I used:
sudo vi test

In the test file I added these lines:
#!/bin/bash
clear
echo "Good morning, world."

Saved the file test
Then:
sudo chmod -R 755 test

BUT I cant make it run. Trying with:
./test     results in
sh: ./test not found

But the command: 
ls           returns
sbp       (in green)

So it seems I lack some fundamental understanding here.


2.
Another question is (when I manage to make a working script). where should I put this script, so that I can run it via putty in a terminal? Should I put it in init.d directory, or where is the best place?

Steen     
Title: Re: Please help a beginner
Post by: bmarkus on January 14, 2013, 11:24:19 AM
Steen

1) By default piCore shipped with ash shell implemented as a BusyBox applet. It is similar to bash, but smaller and a bit different operation. Replace first line of the script with

#!/bin/sh

In most cases you do not need bash. If you write your own script, avoid using bash specific features. If you (or an application) really need it, install from the repo.

2) Put it to /usr/local/bin or /usr/local/sbin These locations are in the path so they will be executed. Don't forget to make them executable. If you want to make them persistent, add them to the backup or make your own .tcz extension.


Title: Re: Please help a beginner
Post by: sbp on January 15, 2013, 10:59:33 AM
Hi bmarcus.

Thanks for the help.
Now I can run a script. I have been trying to make a script which will allow the user to put in the correct start up sentence for the Squeezetite player (it will depend on the kind of USB DAC used)

This is the script:

#!/bin/sh
clear
# here the user input the string
echo -e "Hi, please write the squeezelite commands you would like to use for starting Squeezelite"
read START_STRING
echo "$START_STRING - Will be written to /opt/bootlocal.sh."
read -p "Is it correct (y/n)?"
[ "$REPLY" = "y" ] || sudo echo "START_STRING" >> /opt/bootlocal.sh


# here the changes are made persistent
echo -e "Now these changes will be saved"
filetool.sh -b
echo -e " "
echo -e "If you will use an external USB DAC please insert now"


# here it ask for a reboot
read -p "To use the new settings you should reboot now (Y/N)?"
[ "$REPLY" = "y" ] || sudo reboot



My problems are:
1. START_STRING is added to the bootlocal.sh instead of the actual string given by the user.

2. the y/n option in the script seems to not discriminate between a "y" or a "n" press.

3. what I really would like the script to do is to find this line in bootlocal.sh:
sudo /mnt/mmcblk0p2/tce/squeezelite-armv6hf -n piCoPlayer -m 00:11:95:00:54:01 -
and exchange it with the string given by the user from the first part of my script
so that it does not simply add a new line to the bootlocal.sh file
Will that be possible?

4. After I have made the script file /usr/local/sbin/setup-audio  and used:     filetool.sh -b   this script file is not present after a reboot

After running the script the resulting bootlocal.sh file:

# put other system startup commands here
usr/local/etc/init.d/dropbear start
sudo /mnt/mmcblk0p2/tce/squeezelite-armv6hf -n piCoPlayer -m 00:11:95:00:54:01 -
amixer set PCM 400 unmute
START_STRING
Title: Re: Please help a beginner
Post by: Rich on January 15, 2013, 11:23:03 AM
Hi sbp
Quote
1. START_STRING is added to the bootlocal.sh instead of the actual string given by the user.
Try    $START_STRING
Code: [Select]
echo "$START_STRING" >> /opt/bootlocal.sh
Title: Re: Please help a beginner
Post by: tinypoodle on January 15, 2013, 11:28:54 AM
Omit use of sudo in bootlocal.sh which is run as root.
Title: Re: Please help a beginner
Post by: Rich on January 15, 2013, 12:05:01 PM
Hi sbp
You might also want to take a look at some of the scripts that come with Tinycore for examples of proper syntax.
I Found this:
Code: [Select]
        echo "Existing config detected. Overwrite? [y/n]"; read OVERWRITE

        case $OVERWRITE in
                y*) true ;;
                *) servers; exit ;;
        esac
in  /usr/bin/tc-terminal-server, you should be able to adapt it to your needs. You can find scripts you could study in
/etc/init.d. Also, anything beginning with   tce-   under  /usr/bin
Title: Re: Please help a beginner
Post by: sbp on February 15, 2013, 01:23:42 AM
Hi

I'm now trying to make my piCorePlayer in one partition, so that the TCE will be on the same partition as the rest.

What I did is to use:
tce-setdrive
and then choose the only available like  /mnt/mmcblk0p1

Then I installed all the packages I needed (Flac, libvorbis, wifi dropbear etc).
Then I added these three lines to /opt/.filetool.lst
opt
home
etc/passwd
etc/shadow
usr/local/etc/dropbear/dropbear_dss_host_key
usr/local/etc/dropbear/dropbear_rsa_host_key

and edited /opt/bootlocal.sh to add this line:
usr/local/etc/init.d/dropbear start

Everything is working fine up to here.

The problem I have is the script I made, I can't seem to make it persistent. I did the following:

To make the new script:
Code: [Select]
sudo vi /usr/local/sbin/picoreplayerand then writing the script

Next make it exutable:
Code: [Select]
sudo chmod 755 /usr/local/sbin/picoreplayer
And if I check it now I can start he script fine.

In order to make it persistent I add this line to opt/.filetool.lst:
Code: [Select]
usr/local/sbin/picoreplayer
Then:

Code: [Select]
filetool.sh -b
BUT after a reboot there is no picoreplayer in usr/local/sbin.


Can you spot what I am missing, or doing wrong?
Title: Re: Please help a beginner
Post by: sbp on February 15, 2013, 01:40:22 AM
I don't know if this is important but doing a "dry run" backup - I can't see that my /usr/local/sbin/picoreplayer is included in the backup:
Code: [Select]
 
tc@box:~$ filetool.sh -d
Performing dry run backup (backup will not actually take place).   Please wait.

  0.00 MB  /usr/local/etc/dropbear/dropbear_rsa_host_key
  0.00 MB  /usr/local/etc/dropbear/dropbear_dss_host_key
  0.00 MB  /etc/shadow
  0.00 MB  /etc/passwd
  0.00 MB  /home/tc/.ashrc
  0.00 MB  /home/tc/.ash_history
  0.00 MB  /home/tc/.profile
  0.00 MB  /home/tc/wifi.db
  0.00 MB  /opt/.filetool.lst
  0.00 MB  /opt/bootsync.sh
  0.00 MB  /opt/tcemirror
  0.00 MB  /opt/.xfiletool.lst
  0.00 MB  /opt/shutdown.sh
  0.00 MB  /opt/bootlocal.sh


This is the content of my /opt/.filetool.lst:
Code: [Select]
tc@box:~$ cat /opt/.filetool.lst
opt
home
etc/passwd
etc/shadow
usr/local/etc/dropbear/dropbear_dss_host_key
usr/local/etc/dropbear/dropbear_rsa_host_key
usr/local/sbin/picoreplayer


This is the content of /usr/local/sbin before a reboot - so it seems like the picoreplayer is present before I reboot. But after a reboot it is gone.
Code: [Select]
tc@box:/usr/local/sbin$ ls
alsaconf           iwgetid            nl-classid-lookup  nl-qdisc-delete
alsactl            iwlist             nl-cls-add         nl-qdisc-list
dropbearmulti      iwpriv             nl-cls-delete      picoreplayer
genl-ctrl-list     iwspy              nl-cls-list        wpa_cli
ifrename           nl-class-add       nl-link-list       wpa_passphrase
iwconfig           nl-class-delete    nl-pktloc-lookup   wpa_supplicant
iwevent            nl-class-list      nl-qdisc-add
Title: Re: Please help a beginner
Post by: bmarkus on February 15, 2013, 02:44:57 AM
Check /opt/.xfiletools.lst Is the exclusion list. Did you add /usr/local/picoreplayer by accident?

Anyhow, in this case backup is not the right solution. Make a picoreplayer.tcz extension instead up backup/restore.

This will create a picoreplayer.tcz extension with an md5 file:

Code: [Select]
cd /tmp
mkdir -p picoreplayer/usr/local/sbin
cp -r /usr/local/sbin/picoreplayer picoreplayer/usr/local/sbin
mksquashfs picoreplayer picoreplayer.tcz
md5sum picoreplayer.tcz > picoreplayer.tcz.md5.txt

Copy these file to your tce/optional directory and add picoreplayer.tcz to the onboot.lst file manually ot with apps.

You need squashfs-tools-4.x.tcz installed.


Title: Re: Please help a beginner
Post by: sbp on February 15, 2013, 03:05:28 AM
Hi bmarcus

Thanks for your advice, I will try to make a tcz.

However, I have been able to make it work before, when I used a separate partition for the TCE directory.
Does this make any sense?
Is there a difference between making the microcore with the piCorePlayer one partition or using two (one for microcore and one for the TCE directory)?

The only other thing that are different is that I use the newest microcore 4.7.4 now.


edit:
This is the content of my /opt/.xfiletool.lst  (originally the mnt was uncommented, I tried to comment it out, but it did not solve my problem.

Code: [Select]
tc@box:/opt$ cat /opt/.xfiletool.lst
Cache
cache
.cache
XUL.mfasl
XPC.mfasl
#mnt
.adobe/Flash_Player/AssetCache
.macromedia/Flash_Player
.opera/opcache
.opera/cache4
.Xauthority
.wmx

Title: Re: Please help a beginner
Post by: bmarkus on February 15, 2013, 03:42:12 AM

Is there a difference between making the microcore with the piCorePlayer one partition or using two (one for microcore and one for the TCE directory)?


What do you mean "piCorePlayer" one partition? Its is a directory in the file system /usr/local/sbin/picoreplayer

How does its content get populated with files?

BTW, tce directory can be on any readable portition's root (FAT or EXTn type), first found will be used automatically by the system, if not specified explicitely with a boot code.

For example I have /tce on both /mnt/mmcblk0p2 and /mnt/mmcblk0p4 with different set of modules for development and testing. System mounts one from  /mnt/mmcblk0p2 When I want to use the other, just renaming it to tcexxx and system will boot with /mnt/mmcblk0p4
Title: Re: Please help a beginner
Post by: sbp on February 15, 2013, 03:56:35 AM

Is there a difference between making the microcore with the piCorePlayer one partition or using two (one for microcore and one for the TCE directory)?


What do you mean "piCorePlayer" one partition? Its is a directory in the file system /usr/local/sbin/picoreplayer

How does its content get populated with files?

BTW, tce directory can be on any readable portition's root (FAT or EXTn type), first found will be used automatically by the system, if not specified explicitely with a boot code

Sorry that was unclear.

What I did this time was that after booting the microcore for the first time I used "tce-setdrive" and there was only one partition to choose from so I chose 1 =  /mnt/mmcblk0p1

Previously I had been making a new ext4 partition (following one of your previous advise) and the had chosen this separate partition (/mnt/mmcblk0p2) for the TCE directory.

But this time I would like to include all in one partition - but then I seem unable to get microcore to backup any new files that I make manually
Title: Re: Please help a beginner
Post by: bmarkus on February 15, 2013, 04:27:17 AM
Is there a tce directory on the /mnt/mmcblk0p1 partition? Please consider it's limited size, it's all together 40Mbyte and nout a journaling type, do not put /tce there. Use always a different partition for /tce and you need a swap partition also. Can't be a problem, you can't find SD card with less than 2GB capacity (even 2GB is out of productiond and hard to find).
Title: Re: Please help a beginner
Post by: sbp on February 15, 2013, 04:49:05 AM
Is there a tce directory on the /mnt/mmcblk0p1 partition?


Yes that was my goal to only have one partition (like you do with the piCore-X beta)

Please consider it's limited size, it's all together 40Mbyte and nout a journaling type, do not put /tce there.

I will only use this as a dedicated piCorePlayer (a music player for the Logitech Squeezebox system), so there will only be installed what I put in this player, and therefore swap will not be needed either. I have managed to get it down to 23 MB all in all (microcore + ALSA + dropbear + WiFi + squeezelite player)
Title: Re: Please help a beginner
Post by: Rich on February 15, 2013, 07:18:43 AM
Hi sbp
Quote
originally the mnt was uncommented
The .filetool.lst and .xfiletool.lst files are not scripts, they contain patterns that tar uses to determine which files
to include and exclude. When you added:
Code: [Select]
usr/local/sbin/picoreplayerto .filetool.lst, did you remember to hit carriage return?
Title: Re: Please help a beginner
Post by: sbp on February 15, 2013, 08:04:37 AM
Hi Rich

You were spot on - after adding a carriage return - everything is working fine.

I learn so much from you all. Thank you