====== aide mémoire de mon nslu2 ====== Voilà en gros les notes que j'ai prises pour installer mon [[wpfr>NSLU2]] (aka SLUG) sous linux. Cette page m'est utile. Si elle peut servir à d'autres, tant mieux. Le machin arrive avec un système (un linux certe) assez simplistique qui ne permet que de faire qq bricoles et dont les réglages se font via l'interface web... Ce qui est intéressant dans le slug est sa faible consommation d'électricité. Je veux donc le garder en marche en permanence pour me faire un petit serveur maison. Si je lui mets un gros disque dur, je perds la faible consommation. Je vais donc l'installer avec une <> clef USB. (actuellement c'est une 32 16 Go mais j'ai commencé avec un truc du genre de 512 Mo) On peut installer tout un linux dans la flash du slug, mais j'ai envie d'un truc un tout petit peu moins serré. donc, avant de commencer, sur mon pc linux je crée trois partitions sur ma clef usb. et je les formate. - ext3 150 500 Mo (utilisé pour le système) - swap 40 500 Mo - ext3 le reste (utilisé pour les dossiers personnels (''/home'')) Je pourrai donc installer plein de logiciels après coup dans la partition de 150 500 Mo. qq liens * site du contstructeur : http://homesupport.cisco.com/en-us/wireless/lbc/NSLU2/download * "LE" site des fana de linux sur un NSLU2 : http://www.nslu2-linux.org/ J'ai enlevé la résistance R83 pour doubler la fréquence du processeur. Il ne s'agit pas d'//overclocking//, mais juste de faire tourner le CPU du slug à la vitesse prévue par INTEL. Comme indiqué sur [[http://www.nslu2-linux.org/wiki/HowTo/OverClockTheSlug|cette page]]. D'après elle, on peut la déssouder, l'enlever en la tiraillant avec un coupe-ongle, la détruire avec un cutter -- parait que c'est fragile --, découper la soudure avec une lame de rasoir, bref tout est bon pourvu que la résistance disparaisse. Perso, j'ai demandé à une personne qui sait manier un fer à souder... Lorsque j'ai installé mon slug sous slugos/5.3, les docs n'étaient pas si claires qu'elles les sont actuellement. Si vous lisez bien l'anglais, si vous , n'êtes pas moi (qui vais continuer à lire ma propre prose), vous devriez commencer par faire un tour sur les site du slug cité plus haut, et notamment la page http://www.nslu2-linux.org/wiki/SlugOS/InstallandTurnupABasicSlugOSSystem Page qui permet d'éviter de se prendre la tête avec les réglages que j'ai fait manuellement... ===== Pour installer le slug ===== Matériel utilisé * un slug bien sûr, * un pc sous linux, * il faut le logiciel upslug2\\ pclinux$ sudo apt-get install upslug2 * un câble ethernet croisé * une clef USB ou un disque dur externe (facultatif mais recommandé) **NB**, sous linux, la clef/disque branchée dans le port USB du haut du slug s'appelle ''/dev/sda'', celle branché dans le second port s'appelle ''/dev/sdb''. Il peut aussi s'appeler ''/dev/.static/dev/sda'' ou ''/dev/.static/dev/sdb'' ===== Description ===== * Son adresse MAC est : 00:14:bf:65:a5:b1 * By default, l'adresse IP du NSLU2 est 192.168.1.77 Pour mettre le NSLU2 en mode « prèt à être flashé » : * maintenir le bouton //Reset//, appuyer sur marche, * attendre que la del « //ready// » change de couleur, * relâcher le bouton //Reset//. * La del doit clignoter rouge/vert (le temps d'attente varie de 7 à 13 secondes environ) Le slug est prèt. On peut maintenant flasher le SLUG pour y mettre un linux personalisable (voir sections suivantes). **pour remettre la ROM d'origine en cas de pépins** J'ai Téléchargé la ROM officielle depuis le site de linksys (maintenant site cisco [[http://homesupport.cisco.com/en-us/wireless/lbc/NSLU2|NSLU2]]). Pour la remettre si jamais j'aime pas mon nouveau linux (douteux mais on ne sait jamais): * passer le slug en mode « prèt à être flashé », puispclinux$ sudo upslug2 -d eth0 -i NSLU2_V23RA5.bin ===== Distribution choisie ===== Il y a plusieurs distributions Linux qu'on peut essayer sur cette machine. J'ai voulu rester dans les systèmes <>. C'est sûr, un chouette Debian avec ses 23000 paquets, ça pête, mais ça mange de la RAM à gogo. Les trucs et bidules de config, d'alternative etc... n'ont pas leur place sur de l'embarqué (à mon avis). J'ai donc porté mon choix sur deux distrib : "Ångström" et "SlugOS be". Malheureusement pour les raisons détaillées dans la section suivante, Ångström ne peut pas en l'état être installé sur un SLUG. reste donc la distribution "SlugOS be" qui est celle qui fonctionne actuellement sur mon SLUG. ==== Ångström ==== J'ai voulu essayer la distribution [[http://www.angstrom-distribution.org/|Ångström]] car : * Elle utilise des paquets spécialement conçus pour les appareils embarqués * Elle utilise l'ABI stroumph du processeur strongARM et est donc super performante en flottant. Malheureusement, cette distribution nécessite, //juste pour pouvoir se connecter la **première** fois en root//, un clavier. le slug n'en a pas, seul une connexion réseau est possible, mais comme il n'y a pas de mot de passe initial pour root, on ne peut pas se connecter par ssh... ++++ détails des actions infructueuses pour Ångström| Ångström http://www.angstrom-distribution.org/ \\ téléchargé : - Angstrom-base-image-glibc-ipk-2007.12-ixp4xxbe.rootfs.tar.gz - Angstrom-base-image-glibc-ipk-2007.12-ixp4xxbe-nslu2.bin flashé la ROM du SLUG de cette façcon : imladris [5019] 21:46:57 (1) angstrom $ sudo upslug2 -d eth0 -i Angstrom-base-image-glibc-ipk-2007.12-ixp4xxbe-nslu2.bin NSLU2 00:14:bf:65:a5:b1 Product ID: 1 Protocol ID: 0 Firmware Version: R23V63 [0x2363] Upgrading LKG65A5B1 00:14:bf:65:a5:b1 . original flash contents * packet timed out ! being erased - erased u being upgraded U upgraded v being verified V verified Display:
+ Status: * timeout occured + sequence error detected c04ff+000000 ...UUUu--------------------------------------------------------- Réglage par défaut de angstrom : le machin fait une requete DHCP. Donc, sur mon pc : apt-get install dhcp3-server et réglage du dhcp comme suit dans ''/etc/dhcp3/dhcpd.conf'' subnet 192.168.1.0 netmask 255.255.255.0 { # range 192.168.1.80 192.168.1.120; option domain-name-servers 192.168.1.1; option domain-name "internal.example.org"; option routers 192.168.1.1; option broadcast-address 192.168.1.255; default-lease-time 600; max-lease-time 7200; host monslug { hardware ethernet 00:14:bf:65:a5:b1; fixed-address 192.168.1.77; } } puis redémarrage . OK mais mot de passe root est vide, donc on ne peut pas se connecter par ssh, car dropbear-ssh refuse les mots de passe vides. Donc abandon de angstrom On pourrait re builder tout Angstrom depuis les sources, juste en ajoutant un password à root. Voir la page http://www.angstrom-distribution.org/building-angstrom pour comment tout construire et obtenir une image machintruc-chose.bin. C'est horriblement long et compliqué. Il faut chercher autre chose. ++++ ==== SLUGOS BE (ex openslug) ==== Finalement c'est ce que j'ai installé. J'en suis content. Si le disque dur/clef usb meurt, le système sur la flash est toujours capable de booter et d'offrir un serveur ssh avec compte root. c'est pas vilain comme comportement, même si ça me servira jamais à rien. Si y'a une merde disque, j'arrête le bidule et travaille à partir de mon pc sous linux de toutes façons. Suivre les liens de http://www.nslu2-linux.org/wiki/SlugOS/SlugOSBE amène ici pour télécharger les binaires de SLUGOS/BE : http://www.slug-firmware.net/s-dls.php . Choisir de télécharger SlugOSBE-5.3-beta-firmware.zip, cocher la case "accepter les termes et conditions d'utilisations", puis ouvrir le zip et y trouver le précieux fichier ''slugosbe-5.3-beta-nslu2.bin'' que l'on va flasher sur le SLUG. === Préparation du slug === Avant tout, il faut passer le slug en mode « prèt à être flashé »((CF plus haut)). Ensuite, j'ai flashé ''slugosbe-4.8-beta-nslu2.bin'' et puis en fait plus tard (au moins un an et demi) ''slugosbe-5.3-beta-nslu2.bin''. (C'est la même chose, seule la version change). Si pas de dhcp présent, l'adresse par défaut du slug sera ''192.168.1.77''. imladris [8904] 22:15:38 (0) slugosbe $ sudo upslug2 -d eth0 -i slugosbe-5.3-beta-nslu2.bin NSLU2 00:14:bf:65:a5:b1 Product ID: 1 Protocol ID: 0 Firmware Version: R23V63 [0x2363] Upgrading LKG65A5B1 00:14:bf:65:a5:b1 . original flash contents * packet timed out ! being erased - erased u being upgraded U upgraded v being verified V verified etc... On peut alors démarrer le slug. Quand le slug est booté, connexion ssh avec le compte root. Le mot de passe initial pour root est l'un des deux suivants((je ne me souviens plus lequel a fonctionné et on trouve les deux dans les docs)): * ''opeNSLUg'' * ''OpenSlug'' pclinux$ ssh root@192.168.1.77 The authenticity of host '192.168.1.77 (192.168.1.77)' can't be established. RSA key fingerprint is a8:cc:c4:19:16:c5:69:2d:d5:ae:94:b8:88:87:5c:1f. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.1.77' (RSA) to the list of known hosts. root@192.168.1.77's password: Permission denied, please try again. root@192.168.1.77's password: root@slug # echo youpi youpi root@slug # La première chose à faire, avant tout autre est de changer le mot de passe du compte root et de configurer le slug. Tout se fait en deux commandes. root@slug # turnup init root@slug # turnup preserve === Préparation de la clef usb === Sous linux (mais on aurait pu faire sur le slug, seulement ça deviendrait trèèèèès long) : pour détails, voir la page : http://www.nslu2-linux.org/wiki/OpenSlug/InitialisingDisks préparer un disque ou une clef USB avec ''fdisk'', ''cfdisk'' ou tout autre programme de gestion de partition sous Linux. J'ai fait trois partitions : (500M racine, 512 swap, le reste pour ''/home'') pclinux# fdisk -l /dev/sdb Périphérique Amorce Début Fin Blocs Id Système /dev/sdb1 1 127 492094 83 Linux /dev/sdb2 128 257 503750 82 Linux swap / Solaris /dev/sdb3 258 8185 30721000 83 Linux pclinux# mkfs.ext3 -L racine-sch /dev/sdb1 pclinux# mkswap /dev/sdb2 pclinux# mkfs.ext3 -L home-sch /dev/sdb3 pclinux# tune2fs -L home-sch -c 250 -i 0 /dev/sdc3 pclinux# ++++details| pclinux# fdisk -l /dev/sdb Disque /dev/sdb: 32.5 Go, 32480690176 octets 125 têtes, 62 secteurs/piste, 8185 cylindres Unités = cylindres de 7750 * 512 = 3968000 octets Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Identifiant de disque : 0x0005e778 Périphérique Amorce Début Fin Blocs Id Système /dev/sdb1 1 127 492094 83 Linux /dev/sdb2 128 257 503750 82 Linux swap / Solaris /dev/sdb3 258 8185 30721000 83 Linux pclinux# mkfs.ext3 -L racine-sch /dev/sdb1 mke2fs 1.41.11 (14-Mar-2010) Étiquette de système de fichiers=racine-sch Type de système d'exploitation : Linux Taille de bloc=1024 (log=0) Taille de fragment=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 123464 i-noeuds, 492092 blocs 24604 blocs (5.00%) réservés pour le super utilisateur Premier bloc de données=1 Nombre maximum de blocs du système de fichiers=67633152 61 groupes de blocs 8192 blocs par groupe, 8192 fragments par groupe 2024 i-noeuds par groupe Superblocs de secours stockés sur les blocs : 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 Écriture des tables d'i-noeuds : complété Création du journal (8192 blocs) : complété Écriture des superblocs et de l'information de comptabilité du système de fichiers : complété Le système de fichiers sera automatiquement vérifié tous les 22 montages ou après 180 jours, selon la première éventualité. Utiliser tune2fs -c ou -i pour écraser la valeur. pclinux# mkswap /dev/sdb2 Configure l'espace d'échange (swap) en version 1, taille = 503744 Ko pas d'étiquette, UUID=0d721001-871f-4d36-9165-05718a1eca80 pclinux# mkfs.ext3 -L home-sch /dev/sdb3 mke2fs 1.41.11 (14-Mar-2010) Étiquette de système de fichiers=home-sch Type de système d'exploitation : Linux Taille de bloc=4096 (log=2) Taille de fragment=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 1921360 i-noeuds, 7680250 blocs 384012 blocs (5.00%) réservés pour le super utilisateur Premier bloc de données=0 Nombre maximum de blocs du système de fichiers=4294967296 235 groupes de blocs 32768 blocs par groupe, 32768 fragments par groupe 8176 i-noeuds par groupe Superblocs de secours stockés sur les blocs : 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Écriture des tables d'i-noeuds : complété Écriture des superblocs et de l'information de comptabilité du système de fichiers : complété Le système de fichiers sera automatiquement vérifié tous les 24 montages ou après 180 jours, selon la première éventualité. Utiliser tune2fs -c ou -i pour écraser la valeur. pclinux# tune2fs -L home-sch -c 250 -i 0 /dev/sdc3 pclinux# ++++ Pour ceux qui s'étonnent de voir un mkfs 1.41.11 du 14-Mar-2010 alors que le slug a été installé bien avant 2010, sachez que cette commande est la commande passée **par erreur** un jour où j'aurrais du écrire ''**fsck**'', pas ''mkfs''. :-( === installation du disque/de la clef sur le slug === Il suffit alors de brancher le disque sur le slug et de configurer ce dernier pour qu'il utilise le disque dur au prochain reboot. lorsqu'on branche la clef/le disque, le linux embarqué va monter les périphériques automatiquement. Je les démonte d'abord avec umount /dev/sda1 umount /dev/sda3 puis j'utilise turnup pour initialiser le périphérique qui va servir au prochain boot. Voir http://www.nslu2-linux.org/wiki/OpenSlug/InitialisingOpenSlug et http://www.nslu2-linux.org/wiki/OpenSlug/InitialisingDisks . root@slug # turnup disk -i /dev/sda1 -t ext3 ou, pour une clef usb root@slug # turnup memstick -i /dev/sda1 -t ext3 ++++détails| root@slug # turnup memstick -i /dev/sda1 -t ext3 /sbin/turnup: umounting any existing mount of /dev/mtdblock4 turnup: copying root file system 17158 blocks done rootdir=/tmp/rootfs.1236 table='/tmp/flashdisk.1236/etc/device_table' ++++ Puis reboot. au reboot, bonne surprise, la partition d'échange <> est prise en compte sans avoir rien à faire. === Montage de la partition /dev/sda3 sur /home === Après ce beau reboot, on se connecte et un df indique la chose suivante : root@slug # df -h Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 6400 5476 924 86% /initrd /dev/sda1 285155 25223 245209 9% / /dev/sda1 285155 25223 245209 9% /dev/.static/dev udev 2048 44 2004 2% /dev /dev/sda3 3547124 72636 3294304 2% /media/sda3 tmpfs 15120 28 15092 0% /var/volatile tmpfs 15120 0 15120 0% /dev/shm root@slug # La partition /dev/sda3 a été montée automatiquement. On ne veut pas de ça. Donc Pour indiquer de n pas monter automatiquement la partition sd3 dans /media, il faut ajouter une ligne à ''/etc/udev/mount.blacklist'' root@slug # echo /dev/sda3 >> /etc/udev/mount.blacklist Et, pour indiquer où monter la partition au prochain boot root@slug # echo '/dev/sda3 /home ext3 noatime 0 2' >>/etc/fstab Pour l'instant, il y a une bricole dans ''/home'', copions là dans le futur ''/home'', c'est à dire l'actuel ''/media/sda3/'' root@slug # ls -l /home/ lrwxrwxrwx 1 root root 7 Sep 26 05:30 root -> ../root root@slug # ls -l /media/sda3 drwx------ 2 root root 16384 Sep 26 20:53 lost+found root@slug # cp -a /home/. /media/sda3/. root@slug # ls -l /media/sda3 drwx------ 2 root root 16384 Sep 26 20:53 lost+found lrwxrwxrwx 1 root root 7 Sep 29 22:07 root -> ../root root@slug # rm /home/root root@slug # reboot Après le reboot, voilà ce qu'on obtient : root@schpluntz:~# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 6400 5476 924 86% /initrd /dev/sda1 285155 25223 245209 9% / /dev/sda1 285155 25223 245209 9% /dev/.static/dev udev 2048 44 2004 2% /dev /dev/sda3 3547124 72636 3294304 2% /home tmpfs 15120 24 15096 0% /var/volatile tmpfs 15120 0 15120 0% /dev/shm === Gestion des paquets === Contrairement à ce qui est dit sur les pages openslug, la commande ''ipkg'' n'existe pas. Il faut utiliser ''opkg''. Cette commande est une sorte de mix de ''dpkg'' et ''apt-get''. Une seule commande pour faire les deux. On rajoute des paquets, comprendre, on installe des logiciels avec la commande ''opkg''. Premier truc à faire : root@slug # opkg update root@slug # opkg upgrade ++++détails| root@slug # opkg update Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/Packages.gz Inflating http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/Packages.gz Updated list of available packages in /usr/lib/opkg/lists/cross Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/native/5.3-beta/Packages.gz wget: server returned error: HTTP/1.1 404 Not Found Collected errors: * Failed to download http://ipkg.nslu2-linux.org/feeds/slugosbe/native/5.3-beta/Packages.gz, error 1 root@slug # opkg upgrade ++++ Les paquets sont dans des //feeds//. On peut donc ajouter des //feeds// pour obtenir une plus grande variété de logiciels. Ajout de //feeds// non officiels : cf http://www.nslu2-linux.org/wiki/Optware/Slugosbe . J'ai fait presque pareil, mais le //feed// rajouté est %%http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable%% . Il y a une ou deux différences par rapport à la page car j'utilise la version slugosbe 5.3 et la page est faite pour slugosbe 4.8. Je veux ces machins car il y a PHP((pas que je sois un grand fan de cette chose, mais j'ai besoin de certaine applications écrites dans ce langage, comme par exemple dokuwiki.))... Les composants ajoutés par ce //feed// iront dans ''/opt/'', et ne se mélangeront donc pas avec les //feeds// officiels. C'est un monde bien tenu, on le voit et c'est très bien comme ça. root@slug # feed=http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable root@slug # ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'` root@slug # wget $feed/$ipk_name root@slug # tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf - root@slug # sed -i -e 's|/stable|/unstable|' /opt/etc/ipkg.conf root@slug # sed -i -e '/^src/s/^/# /' /opt/etc/ipkg.conf root@slug # echo 'src optnslu2 http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable' >>/opt/etc/ipkg.conf ++++détails| root@slug # feed=http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unsta ble root@slug # ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {pri nt $2}'` root@slug # wget $feed/$ipk_name Connecting to ipkg.nslu2-linux.org (140.211.169.161:80) ipkg-opt_0.99.163-10 100% |*******************************| 74603 00:00:00 ETA root@slug # tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf - ./ ./opt/ ./opt/bin/ ./opt/bin/ipkg ./opt/bin/ipkg-opt ./opt/bin/update-alternatives ./opt/etc/ ./opt/etc/ipkg.conf ./opt/lib/ ./opt/lib/libipkg.so ./opt/lib/libipkg.so.0 ./opt/lib/libipkg.so.0.0.0 ./opt/share/ ./opt/share/ipkg/ ./opt/share/ipkg/intercept/ ./opt/share/ipkg/intercept/depmod ./opt/share/ipkg/intercept/ldconfig ./opt/share/ipkg/intercept/update-modules ++++ Il faut alors rajouter ''/opt/bin'' dans le ''PATH'' de root. root@slug # echo 'PATH=$PATH:/opt/bin' >>/root/.profile déconnexion et reconnexion pour prendre en compte ces changements. On peut maintenant utiliser la commande ''ipkg-opt'' ou ''ipkg'' pour installer les paquets faisant partie de ce //feed//. root@slug # ipkg-opt update root@slug # ipkg-opt list ===== (NON)-Installation d'un système complet ===== Normalement, à ce stade, on installe un vrai système sur la clef/le disque. Ça veut dire qu'on se passe de busybox et qu'on met des //vrais// outils sur la partitions système. Mais, je suis convaincu que ces outils consomment plus de mémoire que busybox. D'autre part, busybox est, pour mes besoins, largement suffisant. Donc, j'ai décidé de ne pas suivre les recommendations de la section __//Installing the SPS (Standard Package Set)//__ de la page http://www.nslu2-linux.org/wiki/SlugOS/InstallandTurnupABasicSlugOSSystem ===== trucs et astuces ===== ==== activer les journaux (logs) ==== Par défaut, syslogd enregistre le journal dans un tampon circulaire. on lit le journal avec root@slug # logread Si c'est pas suffisant, démarrer l'enregistrement des journaux systèmes : root@slug # touch /var/log/messages root@slug # sed -i -e 's/="[^"]*"/="file"/' /etc/syslog.conf root@slug # /etc/init.d/syslog restart Quand on a compris le problème, arrêter l'enregistrement des journaux systèmes. root@slug # rm /var/log/messages root@slug # sed -i -e 's/="[^"]*"/="buffer"/' /etc/syslog.conf root@slug # /etc/init.d/syslog restart ==== setuid/setgid busybox ==== Certaines commandes auront besoin d'être setuid ou setgid ou les deux. Or, si ces commandes sont remplies par busybox, il n'y a qu'un seul utilitaire ''/bin/busybox'' et donc il est ou n'est pas setuid/setgid et toujours pour le même utilisateur... He ben, justement les gens de chez busybox ont pensé à ce problème et ont résolu le truc de cette manière. Si ''/bin/busybox'' est setuid/setgid, alors, pour chaque applet donnée busybox consulte le fichier ''/etc/busybox.conf'' et agit en fonction de ce qui est écrit là. S'il n'y a rien c'est le comportement par défaut de l'applet qui l'emporte. Donc, on n'est même pas obligé de mettre des choses dans ce fichier. Si on souhaite le comportement normal des applets busybox on n'a rien à faire. Si on veut, on peut restreindre certaines applets à partir du moment où on a activé les bits setuid/setgid sur le binaire, mais c'est pas malin. On peut se contenter de - chmod u+s /bin/busybox chmod g+s /bin/busybox - touch /etc/busybox.conf Pour info, le fichier ''/etc/busybox.conf'' est un fichier ini, où il faut définir une section ''[SUID]'' à l'intérieur de laquelle on indique les modes des applets busybox. # '#' est un commentaire. # Format : # applet = drapeaux user.groupe # drapeau est (x ou s) 3 fois. Penser comme si on avait un ls -l # -rwxr-xr-x 1 root root 7 Sep 26 05:26 busybox # -rwsr-xs-x 1 root root 7 Sep 26 05:26 busybox # pour interdire ping : [SUID] ping = xxx 0.0 ping6 = xxx 0.0 ++++Détails dans ce message de http://lists.busybox.net/pipermail/busybox/2004-May/011551.html| [BusyBox] Got /etc/busybox.conf SUI SGID working at last gerald.bonne at axa.be gerald.bonne at axa.be Fri May 7 04:03:32 MDT 2004 * Previous message: [BusyBox] gateway and telnet * Next message: [BusyBox] Re: Cross compiling * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] I searched for a long time to get this working and found by experimenting all kinds of combinations. You need to compile BB with the support for SUID SGID at first. Then after make install chmod the busybox executable to 4755. The fear to have now suid root for everything is wrong (I tried it with some commands not in /etc/busybox.conf, I also tried to vi and save a root writeable file only too and it fails beautifully with another user as expected). I think that the SUID SGID support does the trick on this. The chmod u+s is needed so that BB can do the SUID SGID changes when needed without that any properly configured command in /etc/busybox.conf will still fail with a message saying that the suid (or sgid) failed. How to configure /etc/busybox.conf properly: The doc is almost right and almost clear on this. You need a line [SUID] followed by the config lines (anything after a # is disregarded as comments). then the configured command followed by = then the flags and then the user dot group that should be switched to during the command execution (/bin/busybox should remain 4755 root root and not be configured in here). Look at the make menuconfig help for the SUID SGID support for more details. The doc is only unclear about the user.group... These are the user.group that is switched to during suid sgid (i.e. this is as if the real command file would be owned by user:group) and both are mandatory (the default empty that results in root.root does not work and result in an errorr in BB 1.0 pre9). Additional comment: I had to add more in it too! Else "more" results in access denied on /dev/console. Example working /etc/busybox.conf > ------------------------------< [SUID] su = ssx root.root passwd = ssx root.root more = ssx root.root > ------------------------------< Note that though passwd is configured to suid and sguid to root:root and though /bin/busybox is -rwsr-xr-x root root that an ordinary user will still not be able to passwd on anyone else but himself, will still be forced to use safe passswords etc... This is (I think but Erik has to confim) because BB is compiled with the option for SUID SGID support. I hope this will help many to resolve their embedded system's gremlins. -----Disclaimer----- This message may contain confidential information intended solely for the use of the named addressee. If you are not the intended recipient, you should not read, use, disclose or reproduce the content of this message. If you have received this message by mistake, please notify the sender immediately. Any views or opinions presented in this message are solely those of the author and do not necessarily represent those of AXA Belgium, AXA Bank Belgium, AXA Tech Belgium GIE - ESV or any other entity of the AXA Group, unless otherwise stated by the sender and duly authorized by the said companies. --------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://busybox.net/lists/busybox/attachments/20040507/c2f90fdb/attachment.htm ++++ ==== Démarrer le planificateur de tâches (cron) ==== cron est composé de deux système : le démon crond et la commande crontab. crond ne demande qu'à démarrer, il s'agit du busybox-cron, bien suffisant pour ce genre de machine. pour qu'il démarre, il suffit de lui donner un répertoire de crontabs: root@schpluntz:~# mkdir -p /etc/cron/crontabs root@schpluntz:~# /etc/init.d/busybox-cron start ++++détails| root@schpluntz:~# /etc/init.d/busybox-cron start starting Busybox Periodic Command Scheduler: crond... done. root@schpluntz:~# ps w | grep cron 1399 root 2012 S grep cron root@schpluntz:~# logread Sep 27 06:17:28 schpluntz syslog.info syslogd started: BusyBox v1.13.2 Sep 27 06:17:29 schpluntz user.notice kernel: klogd started: BusyBox v1.13.2 (2009-03-07 03:12:14 UTC) Sep 27 06:22:44 schpluntz cron.err crond[1396]: chdir(/etc/cron/crontabs): No such file or directory root@schpluntz:~# mkdir -p /etc/cron/crontabs root@schpluntz:~# /etc/init.d/busybox-cron start starting Busybox Periodic Command Scheduler: crond... done. root@schpluntz:~# logread Sep 27 06:17:28 schpluntz syslog.info syslogd started: BusyBox v1.13.2 Sep 27 06:17:29 schpluntz user.notice kernel: klogd started: BusyBox v1.13.2 (2009-03-07 03:12:14 UTC) Sep 27 06:22:44 schpluntz cron.err crond[1396]: chdir(/etc/cron/crontabs): No such file or directory Sep 27 06:26:59 schpluntz cron.err crond[1404]: crond (busybox 1.13.2) started, log level 8 root@schpluntz:~# ps w | grep cron 1404 root 2008 S /usr/sbin/crond -c /etc/cron/crontabs 1407 root 2012 S grep cron ++++ crontab doit être en accord avec cron sur l'endroit où on range les tâches planifiées. Ce n'est pas le cas par défaut. Un lien symbolique résout le problème. root@schpluntz:~# ln -s ../../etc/cron /var/spool/cron ++++détails| root@schpluntz:~# crontab -l crontab: chdir(/var/spool/cron/crontabs): No such file or directory root@schpluntz:~# ln -s ../../etc/cron /var/spool/cron root@schpluntz:~# crontab -l crontab: can't open 'root': No such file or directory root@schpluntz:~# ++++ Démarrer cron à chaque boot du slug : root@schpluntz:~# update-rc.d busybox-cron defaults Adding system startup for /etc/init.d/busybox-cron. root@schpluntz:~# ==== montage noatime ==== Si on n'a pas utilisé ''turnup memstick...'' alors il peut être intéressant de désactiver manuellement l'option noatime pour les montages de partitions. Par défaut, les machines unix notent la date de dernière lecture d'un fichier lorsqu'on y accède et aussi d'un dossier quand on en liste le contenu... Cela provoque une écriture même quand on ne fait des lectures. J'ai donc décidé d'utiliser l'option ''noatime'' qui inhibe cette fonctionnalité pour tous les systèmes de fichiers montés sur le SLUG. Éditer le fichier ''/etc/fstab'' et ajouter l'option ''noatime'' aux lignes concernées /dev/sda1 / ext3 defaults,noatime 1 1 /dev/sda3 /home ext3 defaults,noatime 1 2 ==== Réglage de la date ==== La date interne est toujours réglée sur l'heure UTC. Pour avoir une date qui respecte l'horaire de votre région, il faut : - S'assurer qu'il n'y a aucune variable d'environnement qui change le réglage qu'on va faire, - installer les fichiers de fuseaux horaires, - faire un lien symbolique((ou hard mais que se passe-t-il en cas de mise à jour des //timezone//s)) de ''/etc/localtime'' vers le fichier de fuseau horaire adéquat. Une fois le fuseau horaire correctement installé, on peut aussi ajouter openntpd. Voir [[http://www.nslu2-linux.org/wiki/OpenSlug/InstallOpenNtpd]]. Cette page est un peu vieille, mais grosso modo, on s'y retrouve. On peut également, si on a activé le planificateur de tâches (cron, CF plus haut) se contenter de ntpdate. C'est la solution que j'ai choisie (CF plus bas) === Étape 1 : variable d'environnement === root@slug # echo "$TZ" UTC root@slug # echo "Aie ! Juste ce qu'on ne veut pas" Aie ! Juste ce qu'on ne veut pas root@slug # grep -C 2 TZ /etc/profile if [ ! -e /etc/localtime ]; then TZ="UTC" # Time Zone. Look at http://theory.uwinnipeg.ca/gnu/glibc/libc_303.html # for an explanation of how to set this to your local timezone. export TZ fi Bon, c'est parfait. Quand on aura installé une fichier de fuseau horaire ''/etc/localtime'', la variable d'environnement ''TZ''((TZ = //**T**ime**Z**one//, fuseau horaire en anglais)) ne sera plus employée, du moins pour les connexions suivantes… Pour l'instant, on va juste enlever cette variable. root@slug # unset TZ === Étape 2 installer les fichiers de fuseaux horaires === root@slug # opkg list '*tz*' lcdd-driver-cfontz - 0.5.1-r3 - LCDproc is a client/Server suite to drive all kinds of LCD (-like) devices. The client shipped with this package can be used to tzdata - 2007k-r4 - Timezone data tzdata-africa - 2007k-r4 - Timezone data tzdata-americas - 2007k-r4 - Timezone data tzdata-antarctica - 2007k-r4 - Timezone data tzdata-arctic - 2007k-r4 - Timezone data tzdata-asia - 2007k-r4 - Timezone data tzdata-atlantic - 2007k-r4 - Timezone data tzdata-australia - 2007k-r4 - Timezone data tzdata-dbg - 2007k-r4 - Timezone data tzdata-europe - 2007k-r4 - Timezone data tzdata-misc - 2007k-r4 - Timezone data tzdata-pacific - 2007k-r4 - Timezone data tzdata-posix - 2007k-r4 - Timezone data tzdata-right - 2007k-r4 - Timezone data root@slug # opkg install tzdata-europe Installing tzdata-europe (2007k-r4) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/tzdata-europe_2007k-r4_armv5teb.ipk Configuring tzdata-europe root@slug # === Étape 3 : Choix du fuseau horaire === Les descriptions des fuseaux horaires sont installées dans ''/usr/share/zoneinfo/**Continent**%%/%%**Ville**''. Trouvons le fuseau pour la France, à priori ''Europe/Paris'' root@slug # ls /usr/share/zoneinfo/Europe Amsterdam Copenhagen Ljubljana Riga Tiraspol Andorra Dublin Luxembourg Rome Uzhgorod Athens Gibraltar Madrid Samara Vaduz Belfast Guernsey Malta San_Marino Vatican Belgrade Helsinki Mariehamn Sarajevo Vienna Berlin Isle_of_Man Minsk Simferopol Vilnius Bratislava Istanbul Monaco Skopje Volgograd Brussels Jersey Nicosia Sofia Warsaw Bucharest Kaliningrad Oslo Stockholm Zagreb Budapest Kiev Podgorica Tallinn Zaporozhye Chisinau Lisbon Prague Tirane Zurich root@slug # echo "Bou... Y'a pas Paris…" Bou... Y'a pas Paris… root@slug # Tant pis, Je vais choisir Madrid à la place. Cela dit, je ne sais pas si les règles de changement d'heure (heure d'été/heure d'hiver) sont identiques entre les deux pays. Alternativement, on peut installer les autres fichiers de fuseaux horaires et vérifier si l'un d'eux contient Paris. root@slug # date Fri Apr 1 04:38:40 UTC 2011 root@slug # ln -s ../usr/share/zoneinfo/Europe/Madrid /etc/localtime root@slug # date Fri Apr 1 06:39:05 CEST 2011 ==== Maintenir le slug à l'heure ==== root@schpluntz:~# opkg install ntpdate ntpdate installe une tâche planifiée de mise à jour de la date. toutes les demi-heures, ntpdate ajustera l'heure depuis les serveurs de temps de pool.ntp.org. **Le planificateur de tâche** doit être en fonction **avant** d'installer ntpdate. ++++details| root@schpluntz:~# opkg install ntpdate Installing ntpdate (4.2.2p3-r1) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/ntpdate_4.2.2p3-r1_armv5teb.ipk ntpdate: unsatisfied recommendation for iana-etc Configuring ntpdate grep: /etc/cron/crontabs/root: No such file or directory adding crontab System startup links for /etc/init.d/busybox-cron already exist. restarting Busybox Periodic Command Scheduler: crond... stopping Busybox Periodic Command Scheduler: crond... stopped crond (pid 1167) done. starting Busybox Periodic Command Scheduler: crond... done. done. Adding system startup for /etc/init.d/ntpdate. Running ntpdate to synchronize clock. root@schpluntz:~# crontab -l 30 * * * * /usr/bin/ntpdate -s -u pool.ntp.org root@schpluntz:~# ++++ ==== Accès à la flash interne ==== La flash est montée en permanence, mais est montée en lecture seule. Pour remonter la flash interne en lecture/écriture : root@slug # mount -t jffs2 -o remount,rw /dev/mtdblock4 /initrd ==== Création d'utilisateurs, réglages ssh ==== On peut utiliser ''adduser'' pour créer des utilisateurs ou bien alors faire à la main, c'est comme on veut. Si on crée les utilisateurs à la main la technique est : - Éditer ''/etc/passwd'', rajouter une ligne du genre toto:x:1023:100:toto le heros:/home/toto:/bin/sh où * ''x'' signifie : mot de passe bloqué. on verra plus tard. * ''1023'' est l'identifiant numérique //''uuid''//. Il doit être unique et dans le fichier /etc/passwd et être > 500. * ''100'' est l'identifiant numérique du groupe //''gid''//. Plusieurs utilisateurs peuvent avoir le même. 100 est l'identifiant du groupe //users//. - Créer alors le home de la personne :mkdir -p ~toto - y mettre les fichiers nécessaire :cp -a /etc/skel/. /home/toto/ - Donner à toto ce qui appartient à toto :chown -R toto:100 /home/toto - Changer le mot de passe de l'utilisateur :passwd toto Et voilà ! Plus qu'à se connecter sous le nom de l'utilisateur toto par ssh : user@monpc $ ssh slug Warning: No xauth data; using fake authentication data for X11 forwarding. Using fallback suid method Using fallback suid method user@slug $ Pour enlever le bazar de //''Using fallback suid method''// La solution est root@slug # touch /etc/busybox.conf ++++Voilà tout un ensemble de messages échangés qu'on peut retrouver ici et qui explique ce qui se passe| Using fallback suid method Click to flag this post by CORNELIU DOBAN Jun 05, 2009; 07:03pm :: Rate this Message: - Use ratings to moderate (?) Reply | Print | View Threaded | Show Only this Message Hi, I'm getting the following message every time I login on the SugOS 5.3: Using fallback suid method. Also the following 2 errors are logged: Jun 1 19:19:01 slugos sshd[1276]: error: Could not get shadow information for Jun 1 19:19:01 slugos sshd[1280]: error: setlogin failed: Function not implemented I don't remember seeing this after installing the SlugOS, so I might have caused it. Is any of you seeing it, or you might know the fix? Thanks, Corneliu Re: Using fallback suid method Click to flag this post by Mike Westerhof (mwester) Jun 05, 2009; 09:47pm :: Rate this Message: - Use ratings to moderate (?) Reply | Print | View Threaded | Show Only this Message Corneliu Doban wrote: > Hi, > > I'm getting the following message every time I login on the SugOS 5.3: Using fallback suid method. This was discussed on the mailing list earlier -- search the archives on yahoo and you should find the details. It's a busybox thing, and IIRC one simply has to create a file in /etc with the appropriate suid information (an empty file is all it needs to behave like a normal Linux system). Of course, if you check the busybox website and archives for info on this feature, you might find that feature to be useful (I thought it might be, which is why it's enabled in the first place (although it would have been nice if the default image had the config file created, at least as an empty file)). > > Also the following 2 errors are logged: > Jun 1 19:19:01 slugos sshd[1276]: error: Could not get shadow information for SlugOS does not implement a shadow password. Off the top of my head I don't recall if one can disable SSHD's checking for the shadow passwd file, but the message is quite benign so nobody has ever worried about it. I'd recommend ignoring it as well. > Jun 1 19:19:01 slugos sshd[1280]: error: setlogin failed: Function not implemented This is due to something in libc -- again I don't recall the details, you will find it discussed in the archives for the mailing lists on yahoo. Or you can search the sshd mailing list archives; this message is not unique to SlugOS. It too can be safely ignored; it has to do with unimplemented logging stuff, if memory serves. > > I don't remember seeing this after installing the SlugOS, so I might have caused it. > Is any of you seeing it, or you might know the fix? No fix required. The only common thing is the creation of the empty file in /etc that's described either on the wiki or in the mailing list archives, but that doesn't change any behavior, it just gets rid of that annoying message. > Thanks, > Corneliu Mike (mwester) Re: Using fallback suid method Click to flag this post by Neil Shephard Jun 30, 2009; 11:10am :: Rate this Message: - Use ratings to moderate (?) Reply | Print | View Threaded | Show Only this Message --- In nslu2-linux@..., "Mike Westerhof (mwester)" wrote: > > Corneliu Doban wrote: > > Hi, > > > > I'm getting the following message every time I login on the SugOS 5.3: Using fallback suid method. > > This was discussed on the mailing list earlier -- search the archives on > yahoo and you should find the details. It's a busybox thing, and IIRC > one simply has to create a file in /etc with the appropriate suid > information (an empty file is all it needs to behave like a normal Linux > system). > > Of course, if you check the busybox website and archives for info on > this feature, you might find that feature to be useful (I thought it > might be, which is why it's enabled in the first place (although it > would have been nice if the default image had the config file created, > at least as an empty file)). > ... [show rest of quote] I've just encountered this in my upgrade to 5.3 after having created a new user account (messages reported when first logging in). I searched the nslu2-linux archives (on nabble and yahoo and couldn't find anything other than this) and busybox archives and found this pointer --> http://lists.busybox.net/pipermail/busybox/2003-November/009851.html Downloaded the source and 'make menuconfig' to get into the help which reads as follows (posting here so that the solution can, hopefully, be found in the archives here)... CONFIG_FEATURE_SUID_CONFIG: Allow the SUID / SGID state of an applet to be determined at runtime by checking /etc/busybox.conf. (This is sort of a poor man's sudo.) The format of this file is as follows: = [Ssx-][Ssx-][x-] (|).(|) An example might help: [SUID] su = ssx root.0 # applet su can be run by anyone and runs with # euid=0/egid=0 su = ssx # exactly the same │ mount = sx- root.disk # applet mount can be run by root and members # of group disk and runs with euid=0 cp = --- # disable applet cp for everyone The file has to be owned by user root, group root and has to be writeable only by root:│ (chown 0.0 /etc/busybox.conf; chmod 600 /etc/busybox.conf) The busybox executable has to be owned by user root, group root and has to be setuid root for this to work: (chown 0.0 /bin/busybox; chmod 4755 /bin/busybox) Robert 'sandman' Griebl has more information here: . I created the file (leaving it blank) and changed ownership and permissions as per above instructions, but no joy (yet), haven't tried rebooting yet though (will have to wait till I get home). Will update if I get it resolved. Neil Re: Using fallback suid method Click to flag this post by Neil Shephard Jul 02, 2009; 03:55pm :: Rate this Message: - Use ratings to moderate (?) Reply | Print | View Threaded | Show Only this Message --- In nslu2-linux@..., "slackline" wrote: > > I've just encountered this in my upgrade to 5.3 after having created a new user account (messages reported when first logging in). > > I searched the nslu2-linux archives (on nabble and yahoo and couldn't find anything other than this) and busybox archives and found this pointer --> http://lists.busybox.net/pipermail/busybox/2003-November/009851.html > > Downloaded the source and 'make menuconfig' to get into the help which reads as follows (posting here so that the solution can, hopefully, be found in the archives here)... > > CONFIG_FEATURE_SUID_CONFIG: > > Allow the SUID / SGID state of an applet to be determined at runtime > by checking /etc/busybox.conf. (This is sort of a poor man's sudo.) > The format of this file is as follows: > > = [Ssx-][Ssx-][x-] (|).(|) > > An example might help: > > [SUID] > su = ssx root.0 # applet su can be run by anyone and runs with > # euid=0/egid=0 > su = ssx # exactly the same > │ > mount = sx- root.disk # applet mount can be run by root and members > # of group disk and runs with euid=0 > > cp = --- # disable applet cp for everyone > > The file has to be owned by user root, group root and has to be > writeable only by root:│ > (chown 0.0 /etc/busybox.conf; chmod 600 /etc/busybox.conf) > The busybox executable has to be owned by user root, group > root and has to be setuid root for this to work: > (chown 0.0 /bin/busybox; chmod 4755 /bin/busybox) > > Robert 'sandman' Griebl has more information here: > . > > > I created the file (leaving it blank) and changed ownership and permissions as per above instructions, but no joy (yet), haven't tried rebooting yet though (will have to wait till I get home). Will update if I get it resolved. > ... [show rest of quote] Ok, I seem to have solved this using the solution suggested at http://lists.busybox.net/pipermail/busybox/2003-March/008115.html Basically I needed to change the busybox binary such that the user or group ID is set on execution... chmod +s /bin/busybox Will find out later if this has resolved the permissions on mounting but suspect the suggested UUID approach is preferable (see http://tech.groups.yahoo.com/group/nslu2-linux/message/23830 ) Neil Re: Using fallback suid method Click to flag this post by pasques Sep 05, 2011; 07:12pm :: Rate this Message: - Use ratings to moderate (?) Reply | Print | View Threaded | Show Only this Message touch /etc/busybox.conf (run as root) http://www.jamison.org/2010/12/21/fix-the-using-fallback-suid-method-error-message-on-busybox-nslu2/ ++++ ==== Installation de samba (partage windows) ==== [[wpfr>Samba_(informatique)|Samba]] est le nom de l'ensemble logiciel qui cause windows, et permet de partager pour les ordinateurs windows des dossiers et des imprimantes. Il y a plusieurs paquets samba. Celui qui est le plus simple et qui fonctionne par conséquent le mieux est samba-essential. root@slug # opkg install samba-essential Une fois installé, se connecter via samba en invité sur le slug et lire les instructions en anglais qui sont dans le fichier Managing-Samba.txt Ce qui y est dit est simple : - Créez si ce n'est déjà fait des comptes unix pour les utilisateursroot@slug # adduser utildetest Changing password for utildetest Enter the new password (minimum of 5, maximum of 8 characters) Please use a combination of upper and lower case letters and numbers. Enter new password: Re-enter new password: Password changed. root@slug # Notez que le mot de passe unix saisi ne sera **pas** le mot de passe de samba, samba utilise des mots de passe windows, à définir ultérieurement, - pour chaque compte unix qui va utiliser un partage de dossier samba, créer un mot de passe windowsroot@slug # smbpasswd -a utildetest New SMB password: Retype new SMB password: Added user utildetest. root@slug # - Éventuellement, modifier le fichier ''/etc/samba/smb.conf'' pour enlever les trucs quine servent à rien. J'ai enlevé la section ''[sdb1]'' qui représente un hypothétique périphérique sdb1, ainsi que la section ''[Samba-Help]'' qui partage un dossier contenant le message d'aide initial... ++Voilà le fichier /etc/samba/smb.conf qui me reste| # SlugOS "Samba Essentials" configuration file [global] workgroup = SLUGOS server string = SlugOS Samba Server security = user load printers = no ; guest account = pcguest log file = /var/log/smblog.%m max log size = 50 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 dns proxy = yes #============================ Share Definitions ============================== [homes] comment = Home Directory for %U browseable = no writable = yes follow symlinks = yes ; include = /etc/test.%U [printers] comment = All Printers path = /usr/spool/samba guest ok = no writable = no printable = yes browseable = no ;[sdb1] ; comment = USB Storage Device ; path = /media/sdb1 ; writable = yes ; printable = no ; public = yes ; ;[Samba-Help] ; comment = How to configure Samba ; path = /usr/share/samba/help ; writable = no ; public = yes ; printable = no ++ - redémarrer le service sambaroot@slug # /etc/init.d/samba restart ++++Fichier Managing-Samba.txt| This device is running a bare-bone Samba server which allows easy transfer of files and directories between any networked desktop PC and your networked SlugOS system. Since it is generally a bad idea to allow everyone read and write access to your server, you will have to configure at least one user to get access to any shared folder. How to create a Samba user with password: - If you haven't already created a non-root user, do so now: root@slug:/usr/bin# adduser utildetest Changing password for utildetest Enter the new password (minimum of 5, maximum of 8 characters) Please use a combination of upper and lower case letters and numbers. Enter new password: Bad password: too short. Warning: weak password (continuing). Re-enter new password: Password changed. root@slug:/usr/bin# - Note that the password you entered will _not_ be your samba password. Samba uses its own password database. - Add a Samba password for your user: root@slug:/usr/bin# smbpasswd -a utildetest New SMB password: Retype new SMB password: Added user utildetest. root@slug:/usr/bin# - After you have added your new samba user, you'll have to restart the samba server by running "/etc/init.d/samba restart" or by rebooting the device - Use the newly created username / password combination to access your network shares. Please note the the Samba username must also exist as a unix username! ++++ ==== installation de cups ==== Cups est le système de gestion des imprimantes qui va permettre de partager par réseau une imprimante installée sur le pot usb du NSLU2. Au départ, c'est facile root@slug # opkg install cups Et puis, il faut déjà corriger le script de démarrage de cups ''/etc/init.d/cups''. À la ligne 172, remplacer, dans le cas d'un système linux, la commande qui permet d'obtenir le pid du daemon cups. voilà le diff root@schpluntz:/etc/init.d# diff -Naur /tmp/cups cups --- /tmp/cups Fri Nov 4 06:12:16 2011 +++ cups Fri Nov 4 06:13:31 2011 @@ -169,7 +169,7 @@ pid=`ps -e | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'` ;; Linux* | *BSD* | Darwin*) - pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'` + pid=`busybox ps w | awk '$5 ~ /\/cupsd$/ { print $1 }'` ;; *) pid="" On peut maintenant démarrer le service d'impression cups : /etc/init.d/cups start Ensuite, il faut configurer un peu cups. En effet, par défaut, les imprimantes gérées par cups ne sont pas partagées sur le réseau !! Pour changer cela, il faut un navigateur (ou savoir éditer le fichier ''/etc/cups/cupsd.conf''). Mais l'interface web est elle aussi restreinte au NSLU2. Donc pas moyen de configurer cups sauf à avoir un navigateur en local sur le slug avec affichage distant... Un peu lourd. Solution : Depuis mon PC sous linux, je créee un tunnel ssh du port 1631 vers le port local 631 de cups. Ensuite depuis mon PC sous linux, j'utilise un navigateur pointé vers ''%%http://127.0.0.1:1631/%%'' pour entrer en contact avec le cups du slug. Là, dans l'interface d'administration je règle le partage d'imprimante. Quand cups demande un nom et un mote de passe, il faut mettre ''root'' et le mot de passe de root. Le navigateur est ensuite redirigé vers un URL foireux. C'est pas grave, le boulot est fait, et on peut toujours revenir à cups par l'URL indiqué plus haut... * moi@monpc ~ $ ssh -L 1631:127.0.0.1:631 slug * \\ {{:nslu2:nslu2-config-cups.png?direct&300|}} * \\ {{:nslu2:nslu2-config-cup-admin-share-printer.png?direct&300|}} * \\ {{:nslu2:nslu2-config-cups-root-pasword.png?direct&300|}} * ++fichier «/etc/cups/cupsd.conf» qui en résulte| LogLevel info SystemGroup sys root # Allow remote access Port 631 Listen /var/run/cups/cups.sock # Share local printers on the local network. Browsing On BrowseOrder allow,deny BrowseAddress @LOCAL DefaultAuthType Basic # Allow shared printing... Order allow,deny Allow @LOCAL Encryption Required Order allow,deny Allow localhost AuthType Basic Require user @SYSTEM Order allow,deny Allow localhost Require user @OWNER @SYSTEM Order deny,allow AuthType Basic Require user @SYSTEM Order deny,allow Require user @OWNER @SYSTEM Order deny,allow Order deny,allow ++ * permissions du fichier root@slug:/etc/cups # ll cupsd.conf -rw-r----- 1 root lp 1482 Aug 12 11:51 cupsd.conf root@slug:/etc/cups # chown root:lp /etc/cups/cupsd.conf root@slug:/etc/cups # chmod 640 /etc/cups/cupsd.conf root@slug:/etc/cups # /etc/init.d/cups restart /etc/init.d/cups: line 232: echo_success: not found cups: restarted scheduler. schpluntz:/etc/cups# === Installation d'une imprimante === Ensuite, il faut installer une imprimante... Comme cette imprimante sera reliée par usb, il faut avant tout s'assurer que le noyau a bien le pilote (comprendre le module) permettant de causer aux imprimantes usb. root@slug # opkg install kernel-module-usblp Maintenant, on peut connecter l'imprimante et la mettre en marche, on doit trouver ce genre de messages dans les journaux système et ceux du noyau : root@slug # dmesg | tail usb 2-1: new full speed USB device using ohci_hcd and address 11 usb 2-1: configuration #1 chosen from 1 choice usblp0: USB Bidirectional printer dev 11 if 0 alt 1 proto 2 vid 0x03F0 pid 0x1D17 root@slug # logread | tail Aug 4 21:43:36 (none) user.info kernel: usb 2-1: new full speed USB device using ohci_hcd and address 11 Aug 4 21:43:36 (none) user.info kernel: usb 2-1: configuration #1 chosen from 1 choice Aug 4 21:43:36 (none) user.info kernel: usblp0: USB Bidirectional printer dev 11 if 0 alt 1 proto 2 vid 0x03F0 pid 0x1D17 Maintenant, il nous faut savoir comment cups va nommer le canal de communication vers cette imprimante. C'est facile, on n'a qu'à lui demander. root@slug # /usr/lib/cups/backend/usb direct usb://HP/LaserJet%201320%20series "hp LaserJet 1320 series" "hp LaserJet 1320 series USB #1" "MFG:Hewlett-Packard;CMD:PJL,MLC,BIDI-ECP,PCL,POSTSCRIPT,PCLXL;MDL:hp LaserJet 1320 series;CLS:PRINTER;DES:Hewlett-Packard LaserJet 1320 series;MEM:9MB;COMMENT:RES=1200x1;" root@slug # Et voilà ! cups causera avec l'imprimante par le canal nommé ''%%usb://HP/LaserJet%201320%20series%%'' Ayant récupéré le PPD de l'iprimante sur http://www.cups.org/, je le francise en indiquant que la taille par défaut est A4 et pas letter. Mon imprimante et réglée comme ça d'ailleurs... Voilà la commande à passer pour modifier le fichier ppd. Cette commande devrait fonctionner pour à peu près n'importe quel fichier PPD. root@slug # sed -i -e '/Default.*: *LETTER/s/LETTER/A4/' \ -e '/Default.*: *Letter/s/Letter/A4/' \ -e '/Default.*: *letter/s/letter/a4/' \ /tmp/HP_LaserJet_1320_series.ppd Et voilà le résultat : --- hpc1320s.ppd Sat Aug 11 23:12:35 2012 +++ HP_LaserJet_1320_series.ppd Sat Aug 11 23:18:01 2012 @@ -155,7 +155,7 @@ *%------------------------------------------------------------------ *OpenUI *PageSize: PickOne *OrderDependency: 30 AnySetup *PageSize -*DefaultPageSize: LETTER +*DefaultPageSize: A4 *PageSize LETTER/Letter: " <> setpagedevice" *End @@ -268,7 +268,7 @@ *%------------------------------------------------------------------ *OpenUI *PageRegion: PickOne *OrderDependency: 30 AnySetup *PageRegion -*DefaultPageRegion: LETTER +*DefaultPageRegion: A4 *PageRegion LETTER/Letter: " <> setpagedevice" *End @@ -369,7 +369,7 @@ *%-------------------------------------------------------------------------- *% The following entries provide information about specific paper keywords. *%-------------------------------------------------------------------------- -*DefaultImageableArea: LETTER +*DefaultImageableArea: A4 *ImageableArea LETTER/Letter: "12.00 12.12 599.88 779.90" *ImageableArea EXECUTIVE/Executive: "12.00 12.12 509.88 743.90" *ImageableArea LEGAL/Legal: "12.00 12.12 599.88 995.90" @@ -406,7 +406,7 @@ *%-------------------------------------------------------------------------- *% These provide the physical dimensions of the paper (by keyword) *%-------------------------------------------------------------------------- -*DefaultPaperDimension: LETTER +*DefaultPaperDimension: A4 *PaperDimension LETTER/Letter: "612 792" *PaperDimension EXECUTIVE/Executive: "522 756" *PaperDimension LEGAL/Legal: "612 1008" Je peux maintenant installer l'imprimante de cette manière : root@slug # lpadmin -p "lj1320" -E \ > -v "usb://HP/LaserJet%201320%20series" \ > -L "dans mon bureau" \ > -P /tmp/HP_LaserJet_1320_series.ppd \ > -D "HP LaserJet N&B recto/verso" \ > -o printer-is-shared=true root@slug # accept lj1320 root@slug # cupsenable lj1320 ==== installation d'un compilateur ==== Pour compiler une bricole ou deux pour le slug, pas besoin d'installer tout un environnement de cross compilation sur un linux. On peut installer quelques paquets de développement sur le slug. mais c'est vraiment pour de petites choses (normalement). * Le minimum pour développer en C root@schpluntz:~# opkg install gcc gcc-symlinks libc6-dev cpp cpp-symlinks binutils-dev * Et pour développer en C+%%+%% root@schpluntz:~# opkg install g++ g++-symlinks libstdc++-dev ++++Détails| root@schpluntz:~# opkg install gcc Installing gcc (4.2.4-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/gcc_4.2.4-r3_armv5teb.ipk Configuring gcc root@schpluntz:~# opkg install gcc-symlinks Installing gcc-symlinks (4.2.4-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/gcc-symlinks_4.2.4-r3_armv5teb.ipk Configuring gcc-symlinks root@schpluntz:~# opkg install libc6-dev Installing libc6-dev (2.6.1-r15) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/libc6-dev_2.6.1-r15_armv5teb.ipk libc6-dev: unsatisfied recommendation for localedef-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-kw-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-6-dev libc6-dev: unsatisfied recommendation for glibc-charmap-utf-8-dev libc6-dev: unsatisfied recommendation for glibc-localedata-pl-pl-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-2-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fr-be+euro-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-15-dev libc6-dev: unsatisfied recommendation for glibc-localedata-yi-us-dev libc6-dev: unsatisfied recommendation for glibc-charmap-cp1255-dev libc6-dev: unsatisfied recommendation for glibc-localedata-be-by+latin-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fa-ir-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-do-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-1-dev libc6-dev: unsatisfied recommendation for glibc-localedata-wa-be+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fr-ca-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-mx-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-de-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fr-ch-dev libc6-dev: unsatisfied recommendation for glibc-localedata-tg-tj-dev libc6-dev: unsatisfied recommendation for glibc-charmap-koi8-t-dev libc6-dev: unsatisfied recommendation for glibc-localedata-an-es-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-lu-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ko-kr-dev libc6-dev: unsatisfied recommendation for glibc-charmap-euc-kr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-us-dev libc6-dev: unsatisfied recommendation for glibc-localedata-pa-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ky-kg-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ur-pk-dev libc6-dev: unsatisfied recommendation for glibc-localedata-rw-rw-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-de+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-ph-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-uy-dev libc6-dev: unsatisfied recommendation for glibc-localedata-gl-es-dev libc6-dev: unsatisfied recommendation for glibc-localedata-oc-fr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-lb-dev libc6-dev: unsatisfied recommendation for glibc-localedata-wa-be-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-au-dev libc6-dev: unsatisfied recommendation for glibc-localedata-dz-bt-dev libc6-dev: unsatisfied recommendation for glibc-localedata-pt-br-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-gt-dev libc6-dev: unsatisfied recommendation for glibc-localedata-aa-dj-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ga-ie-dev libc6-dev: unsatisfied recommendation for glibc-localedata-bn-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fr-be-dev libc6-dev: unsatisfied recommendation for glibc-localedata-crh-ua-dev libc6-dev: unsatisfied recommendation for glibc-localedata-nl-be+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-hk-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-sy-dev libc6-dev: unsatisfied recommendation for glibc-localedata-el-gr-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-7-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-ie+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fi-fi+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-uk-ua-dev libc6-dev: unsatisfied recommendation for glibc-charmap-koi8-u-dev libc6-dev: unsatisfied recommendation for glibc-localedata-nl-be-dev libc6-dev: unsatisfied recommendation for glibc-localedata-it-it-dev libc6-dev: unsatisfied recommendation for glibc-localedata-so-dj-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-ly-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-sa-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ts-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-qa-dev libc6-dev: unsatisfied recommendation for glibc-localedata-af-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-nr-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-so-ke-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-iq-dev libc6-dev: unsatisfied recommendation for glibc-localedata-it-ch-dev libc6-dev: unsatisfied recommendation for glibc-localedata-pa-pk-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-be-dev libc6-dev: unsatisfied recommendation for glibc-localedata-zh-cn-dev libc6-dev: unsatisfied recommendation for glibc-charmap-gb2312-dev libc6-dev: unsatisfied recommendation for glibc-charmap-gbk-dev libc6-dev: unsatisfied recommendation for glibc-charmap-gb18030-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-bo-dev libc6-dev: unsatisfied recommendation for glibc-localedata-nl-nl+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-br-fr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fy-nl-dev libc6-dev: unsatisfied recommendation for glibc-localedata-zu-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fo-fo-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-ae-dev libc6-dev: unsatisfied recommendation for glibc-localedata-mt-mt-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-3-dev libc6-dev: unsatisfied recommendation for glibc-localedata-zh-tw-dev libc6-dev: unsatisfied recommendation for glibc-charmap-big5-dev libc6-dev: unsatisfied recommendation for glibc-charmap-euc-tw-dev libc6-dev: unsatisfied recommendation for glibc-localedata-pt-pt+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-tn-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-sv-dev libc6-dev: unsatisfied recommendation for glibc-localedata-km-kh-dev libc6-dev: unsatisfied recommendation for glibc-localedata-bg-bg-dev libc6-dev: unsatisfied recommendation for glibc-charmap-cp1251-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-gb-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ne-np-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-es-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sl-si-dev libc6-dev: unsatisfied recommendation for glibc-localedata-lt-lt-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-13-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ja-jp-dev libc6-dev: unsatisfied recommendation for glibc-charmap-euc-jp-dev libc6-dev: unsatisfied recommendation for glibc-localedata-kn-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-st-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-hi-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-ec-dev libc6-dev: unsatisfied recommendation for glibc-localedata-az-az-dev libc6-dev: unsatisfied recommendation for glibc-localedata-kk-kz-dev libc6-dev: unsatisfied recommendation for glibc-charmap-pt154-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ca-es-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-be+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-jo-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-bh-dev libc6-dev: unsatisfied recommendation for glibc-localedata-zh-sg-dev libc6-dev: unsatisfied recommendation for glibc-localedata-be-by-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-sd-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-ye-dev libc6-dev: unsatisfied recommendation for glibc-localedata-eu-es+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-nso-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-nz-dev libc6-dev: unsatisfied recommendation for glibc-localedata-mr-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-vi-vn-dev libc6-dev: unsatisfied recommendation for glibc-charmap-tcvn5712-1-dev libc6-dev: unsatisfied recommendation for glibc-localedata-mi-nz-dev libc6-dev: unsatisfied recommendation for glibc-localedata-pt-pt-dev libc6-dev: unsatisfied recommendation for glibc-localedata-id-id-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ve-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-as-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-lo-la-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-ch-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-dk-dev libc6-dev: unsatisfied recommendation for glibc-localedata-nb-no-dev libc6-dev: unsatisfied recommendation for glibc-localedata-tl-ph-dev libc6-dev: unsatisfied recommendation for glibc-localedata-gu-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-uz-uz+cyrillic-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-hn-dev libc6-dev: unsatisfied recommendation for glibc-localedata-si-lk-dev libc6-dev: unsatisfied recommendation for glibc-localedata-se-no-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-om-dev libc6-dev: unsatisfied recommendation for glibc-localedata-kl-gl-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ms-my-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sv-fi+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-gl-es+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sq-al-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-es+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-tt-ru+iqtelif-dev libc6-dev: unsatisfied recommendation for glibc-localedata-uz-uz-dev libc6-dev: unsatisfied recommendation for glibc-localedata-nn-no-dev libc6-dev: unsatisfied recommendation for glibc-localedata-da-dk-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ru-ua-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ca-it-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-ca-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ru-ru-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-5-dev libc6-dev: unsatisfied recommendation for glibc-charmap-koi8-r-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-at-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-cr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-cl-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sr-rs+latin-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-co-dev libc6-dev: unsatisfied recommendation for glibc-localedata-lg-ug-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-10-dev libc6-dev: unsatisfied recommendation for glibc-localedata-so-so-dev libc6-dev: unsatisfied recommendation for glibc-localedata-tt-ru-dev libc6-dev: unsatisfied recommendation for glibc-localedata-iw-il-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-8-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ro-ro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-el-cy-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ca-es+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-pa-dev libc6-dev: unsatisfied recommendation for glibc-localedata-lv-lv-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-us-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-pe-dev libc6-dev: unsatisfied recommendation for glibc-localedata-nl-nl-dev libc6-dev: unsatisfied recommendation for glibc-localedata-hsb-de-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-py-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sr-rs-dev libc6-dev: unsatisfied recommendation for glibc-localedata-et-ee-dev libc6-dev: unsatisfied recommendation for glibc-localedata-csb-pl-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fi-fi-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fr-fr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sr-me-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-pr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ku-tr-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-9-dev libc6-dev: unsatisfied recommendation for glibc-localedata-it-it+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-he-il-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-zw-dev libc6-dev: unsatisfied recommendation for glibc-localedata-hy-am-dev libc6-dev: unsatisfied recommendation for glibc-charmap-armscii-8-dev libc6-dev: unsatisfied recommendation for glibc-localedata-eu-es-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ml-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sv-se-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-lu+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-tn-dev libc6-dev: unsatisfied recommendation for glibc-localedata-bs-ba-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ast-es-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-ma-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ca-fr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ga-ie+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-ie-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sk-sk-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fr-lu-dev libc6-dev: unsatisfied recommendation for glibc-localedata-cs-cz-dev libc6-dev: unsatisfied recommendation for glibc-localedata-gd-gb-dev libc6-dev: unsatisfied recommendation for glibc-localedata-cy-gb-dev libc6-dev: unsatisfied recommendation for glibc-charmap-iso-8859-14-dev libc6-dev: unsatisfied recommendation for glibc-localedata-or-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-hr-hr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-dz-dev libc6-dev: unsatisfied recommendation for glibc-localedata-zh-hk-dev libc6-dev: unsatisfied recommendation for glibc-charmap-big5-hkscs-dev libc6-dev: unsatisfied recommendation for glibc-localedata-is-is-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ar-eg-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ca-ad-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fr-fr+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-ar-dev libc6-dev: unsatisfied recommendation for glibc-localedata-br-fr+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-gv-gb-dev libc6-dev: unsatisfied recommendation for glibc-localedata-hu-hu-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ka-ge-dev libc6-dev: unsatisfied recommendation for glibc-charmap-georgian-ps-dev libc6-dev: unsatisfied recommendation for glibc-localedata-fr-lu+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-sv-fi-dev libc6-dev: unsatisfied recommendation for glibc-localedata-tr-cy-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-ve-dev libc6-dev: unsatisfied recommendation for glibc-localedata-om-ke-dev libc6-dev: unsatisfied recommendation for glibc-localedata-mai-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-mk-mk-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ss-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-th-th-dev libc6-dev: unsatisfied recommendation for glibc-charmap-tis-620-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ta-in-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-sg-dev libc6-dev: unsatisfied recommendation for glibc-localedata-mg-mg-dev libc6-dev: unsatisfied recommendation for glibc-localedata-xh-za-dev libc6-dev: unsatisfied recommendation for glibc-localedata-en-bw-dev libc6-dev: unsatisfied recommendation for glibc-localedata-kw-gb-dev libc6-dev: unsatisfied recommendation for glibc-localedata-de-at+euro-dev libc6-dev: unsatisfied recommendation for glibc-localedata-es-ni-dev libc6-dev: unsatisfied recommendation for libsegfault-dev libc6-dev: unsatisfied recommendation for glibc-extra-nss-dev libc6-dev: unsatisfied recommendation for glibc-thread-db-dev libc6-dev: unsatisfied recommendation for virtual-locale-be-dev libc6-dev: unsatisfied recommendation for virtual-locale-ca-dev libc6-dev: unsatisfied recommendation for virtual-locale-cs-dev libc6-dev: unsatisfied recommendation for virtual-locale-da-dev libc6-dev: unsatisfied recommendation for virtual-locale-de-dev libc6-dev: unsatisfied recommendation for virtual-locale-el-dev libc6-dev: unsatisfied recommendation for virtual-locale-en-gb-dev libc6-dev: unsatisfied recommendation for virtual-locale-es-dev libc6-dev: unsatisfied recommendation for virtual-locale-fi-dev libc6-dev: unsatisfied recommendation for virtual-locale-fr-dev libc6-dev: unsatisfied recommendation for virtual-locale-gl-dev libc6-dev: unsatisfied recommendation for virtual-locale-hr-dev libc6-dev: unsatisfied recommendation for virtual-locale-hu-dev libc6-dev: unsatisfied recommendation for virtual-locale-it-dev libc6-dev: unsatisfied recommendation for virtual-locale-ja-dev libc6-dev: unsatisfied recommendation for virtual-locale-ko-dev libc6-dev: unsatisfied recommendation for virtual-locale-locale.alias-dev libc6-dev: unsatisfied recommendation for virtual-locale-nb-dev libc6-dev: unsatisfied recommendation for virtual-locale-nl-dev libc6-dev: unsatisfied recommendation for virtual-locale-pl-dev libc6-dev: unsatisfied recommendation for virtual-locale-pt-br-dev libc6-dev: unsatisfied recommendation for virtual-locale-ru-dev libc6-dev: unsatisfied recommendation for virtual-locale-rw-dev libc6-dev: unsatisfied recommendation for virtual-locale-sk-dev libc6-dev: unsatisfied recommendation for virtual-locale-sv-dev libc6-dev: unsatisfied recommendation for virtual-locale-tr-dev libc6-dev: unsatisfied recommendation for virtual-locale-zh-cn-dev libc6-dev: unsatisfied recommendation for virtual-locale-zh-tw-dev libc6-dev: unsatisfied recommendation for glibc-gconv-dev libc6-dev: unsatisfied recommendation for glibc-gconv-libgb-dev libc6-dev: unsatisfied recommendation for glibc-gconv-libjisx0213-dev libc6-dev: unsatisfied recommendation for glibc-gconv-libjis-dev libc6-dev: unsatisfied recommendation for glibc-gconv-libksc-dev libc6-dev: unsatisfied recommendation for glibc-gconv-libcns-dev libc6-dev: unsatisfied recommendation for glibc-gconv-libisoir165-dev libc6-dev: unsatisfied recommendation for glibc-localedata-iso14651-t1-dev libc6-dev: unsatisfied recommendation for glibc-localedata-i18n-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-combining-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ti-er-dev libc6-dev: unsatisfied recommendation for glibc-localedata-aa-et-dev libc6-dev: unsatisfied recommendation for glibc-localedata-aa-er-dev libc6-dev: unsatisfied recommendation for glibc-localedata-am-et-dev libc6-dev: unsatisfied recommendation for glibc-localedata-ti-et-dev libc6-dev: unsatisfied recommendation for glibc-localedata-tr-tr-dev libc6-dev: unsatisfied recommendation for glibc-localedata-bn-bd-dev libc6-dev: unsatisfied recommendation for glibc-localedata-gez-er-dev libc6-dev: unsatisfied recommendation for glibc-localedata-gez-er+abegede-dev libc6-dev: unsatisfied recommendation for glibc-localedata-gez-et-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-neutral-dev libc6-dev: unsatisfied recommendation for glibc-localedata-iso14651-t1-common-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-cjk-variants-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-hangul-dev libc6-dev: unsatisfied recommendation for glibc-localedata-om-et-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-circle-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-cjk-compat-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-compat-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-font-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-fraction-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-narrow-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-small-dev libc6-dev: unsatisfied recommendation for glibc-localedata-translit-wide-dev libc6-dev: unsatisfied recommendation for glibc-localedata-iso14651-t1-pinyin-dev Installing linux-libc-headers-dev (2.6.23-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/linux-libc-headers-dev_2.6.23-r3_armv5teb.ipk Installing glibc-extra-nss (2.6.1-r15) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/glibc-extra-nss_2.6.1-r15_armv5teb.ipk Installing libthread-db1 (2.6.1-r15) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/libthread-db1_2.6.1-r15_armv5teb.ipk Configuring glibc-extra-nss Configuring libc6-dev Configuring libthread-db1 Configuring linux-libc-headers-dev root@schpluntz:~# opkg install cpp Installing cpp (4.2.4-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/cpp_4.2.4-r3_armv5teb.ipk Configuring cpp root@schpluntz:~# opkg install cpp-symlinks Installing cpp-symlinks (4.2.4-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/cpp-symlinks_4.2.4-r3_armv5teb.ipk Configuring cpp-symlinks root@schpluntz:~# opkg install binutils-dev Installing binutils-dev (2.18.50.0.7-r6) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/binutils-dev_2.18.50.0.7-r6_armv5teb.ipk binutils-dev: unsatisfied recommendation for libgcc-dev Installing binutils (2.18.50.0.7-r6) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/binutils_2.18.50.0.7-r6_armv5teb.ipk Configuring binutils Configuring binutils-dev root@schpluntz:~# ++++ ==== netfilter iptables etc... ==== Mon nouvel opérateur ADSL ne m'offre qu'une pauvre DMZ. Par rapport à ce que j'avais avant -- un filtrage/routage port par port sur la box -- c'est la misère. Il a bien fallu protéger un peu mon serveur chéri. donc installation d'iptables. Pour commencer l'objectif est d'obtenir une configuration simple : - Tout ce qui est interne passe (mon réseau interne est 192.168.0.0/16) - Tout de qui vient de la boucle locale passe (127.0.0.1/16) - seuls 2 ou trois ports de l'extérieurs passent. Je laisse rentrer ssh (22) et https (443) - les paquets réseau en rapport avec une connexion connue peuvent passer. Ça permet d'ouvrir des connexions depuis la machine vers l'extérieur. sans cette règle on ne peut plus se connecter à quoi que ce soit vers l'extérieur. - tout le reste est poubellé. (On pourrait être plus souple, notament avec [[wpfr>Internet_Control_Message_Protocol|ICMP]], histoire de répondre aux //ping//s de l'extérieur par exemple) Ça se fait assez rapidement. Pour réussir, il faut avoir téléchargé et installé tous les modules iptables nécessaires. Sinon on courre le risque de faire comme moi : installation de quelques règles, puis : mince, il me faut un module en plus, mais je ne peux pas le télécharger. D'où suppression des règles, téléchargement des modules nécessaires et réinstallation des règles. Avoir tous les composants installés avant de commencer la configuration est plus simple tout de même non ? installation des paquets iptables nécessaires root@slug # opkg install iptables iptables-utils root@slug # opkg install kernel-module-xt-multiport root@slug # opkg install kernel-module-xt-state Bon, ben voilà, maintenant y'a plus qu'à saisir les commandes prévues root@slug # iptables -A INPUT -s 192.168.0.0/16 -j ACCEPT root@slug # iptables -A INPUT -s 127.0.0.1/16 -j ACCEPT root@slug # iptables -A INPUT -p tcp -m multiport --dports 22,443 -j ACCEPT root@slug # iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT root@slug # iptables -A INPUT -j DROP === Sauvegarder iptables pour les prochains boots === Maintenant reste à sauvegarder tout ça. de manière à ce que cela ne soit pas oublié au prochain reboot. Comme il n'y a pas, il me semble de bidule de sauvegarde/rechargement des //iptables// je m'en fabrique un vite-fait. Je crée un simple script ''iptables-load.sh'', capable de relire et de recharger les règles iptables sauvegardées par la commande ''iptables-save''. Ensuite, il faut installer ce script dans la séquence d'amorçage du SLUG, et puis, il faut faire une sauvegarde des règles actuellement en place. et c'est tout. root@slug # cat >/etc/init.d/iptables-load.sh <<'EOH' #!/bin/sh # # iptables-load.sh # # Version: @(#)iptables-load.sh 0.01 29-Jan-2011 schplurtz AT laposte.net # # Ce script recharge les regles iptable | This script reloads iptables rules # sauvegardees avec | that were saved with # iptables-save >/etc/iptables.saved # if test -f /etc/iptables.saved -a -x /usr/sbin/iptables-restore then /usr/sbin/iptables-restore Et Voilà ! Pour sauvegarder les iptables, il ne reste qu'à faire la commande suivante, à chaque fois qu'on modifie les iptables. root@slug # iptables-save >/etc/iptables.saved === Journal complèt de l'installation === root@slug # opkg install iptables Installing iptables (1.3.8-r4) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/iptables_1.3.8-r4_armv5teb.ipk Installing kernel-module-ip-tables (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-ip-tables_2.6.27.8+svnr1085-r3_nslu2be.ipk Installing kernel-module-x-tables (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-x-tables_2.6.27.8+svnr1085-r3_nslu2be.ipk Installing kernel-module-iptable-nat (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-iptable-nat_2.6.27.8+svnr1085-r3_nslu2be.ipk Installing kernel-module-nf-nat (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-nf-nat_2.6.27.8+svnr1085-r3_nslu2be.ipk Installing kernel-module-nf-conntrack-ipv4 (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-nf-conntrack-ipv4_2.6.27.8+svnr1085-r3_nslu2be.ipk Installing kernel-module-nf-conntrack (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-nf-conntrack_2.6.27.8+svnr1085-r3_nslu2be.ipk Installing kernel-module-iptable-filter (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-iptable-filter_2.6.27.8+svnr1085-r3_nslu2be.ipk Installing kernel-module-ipt-masquerade (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-ipt-masquerade_2.6.27.8+svnr1085-r3_nslu2be.ipk Configuring iptables Configuring kernel-module-ip-tables Configuring kernel-module-ipt-masquerade Configuring kernel-module-iptable-filter Configuring kernel-module-iptable-nat Configuring kernel-module-nf-conntrack Configuring kernel-module-nf-conntrack-ipv4 Configuring kernel-module-nf-nat Configuring kernel-module-x-tables root@slug # opkg install kernel-module-xt-multiport Installing kernel-module-xt-multiport (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-xt-multiport_2.6.27.8+svnr1085-r3_nslu2be.ipk Configuring kernel-module-xt-multiport root@slug # opkg install kernel-module-xt-state Installing kernel-module-xt-state (2.6.27.8+svnr1085-r3) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/kernel-module-xt-state_2.6.27.8+svnr1085-r3_nslu2be.ipk Configuring kernel-module-xt-state root@slug # opkg install iptables-utils Installing iptables-utils (1.3.8-r4) to root... Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/iptables-utils_1.3.8-r4_armv5teb.ipk Configuring iptables-utils root@slug # opkg files iptables-utils Package iptables-utils (1.3.8-r4) is installed on root and has the following files: /usr/sbin/iptables-restore /usr/sbin/iptables-save root@slug # iptables -A INPUT -s 192.168.0.0/16 -j ACCEPT root@slug # iptables -A INPUT -s 127.0.0.1/16 -j ACCEPT root@slug # iptables -A INPUT -p tcp -m multiport --dports 22,443 -j ACCEPT root@slug # iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT root@slug # iptables -A INPUT -j DROP root@slug # cat >/etc/init.d/iptables-load.sh <<'EOH' #!/bin/sh # # iptables-load.sh # # Version: @(#)iptables-load.sh 0.01 29-Jan-2011 schplurtz AT laposte.net # # Ce script recharge les regles iptable | This script reloads iptables rules # sauvegardees avec | that were saved with # iptables-save >/etc/iptables.saved # if test -f /etc/iptables.saved -a -x /usr/sbin/iptables-restore then /usr/sbin/iptables-restore /etc/iptables.saved root@slug # ==== Changer le port de sshd ==== Pour se protéger un peu plus((enfin pas vraiment, mais pour éviter les attaques des bourrins.)), on peut encore changer le port d'écoute de sshd, ça évitera d'avoir des journaux qui grandissent à cause des attaques stupides au dictionnaire. Voir ce [[http://www.bortzmeyer.org/sshd-port-alternatif.html|billet de stéphane bortzmeyer]]. Pour ma part, j'en avais marre d'avoir ce genre de choses dans mes journaux : Jan 27 05:44:20 (none) auth.info sshd[1842]: Failed password for root from 63.216.14.150 port 41859 ssh2 Jan 27 05:44:22 (none) auth.info sshd[1846]: Failed password for root from 63.216.14.150 port 42129 ssh2 Jan 27 05:44:24 (none) auth.info sshd[1850]: Failed password for root from 63.216.14.150 port 42418 ssh2 Jan 27 05:44:27 (none) auth.info sshd[1854]: Failed password for root from 63.216.14.150 port 42678 ssh2 Jan 27 05:44:29 (none) auth.info sshd[1858]: Failed password for root from 63.216.14.150 port 42963 ssh2 Jan 27 05:44:32 (none) auth.info sshd[1862]: Failed password for root from 63.216.14.150 port 43221 ssh2 Jan 27 05:44:34 (none) auth.info sshd[1866]: Failed password for root from 63.216.14.150 port 43487 ssh2 Jan 27 05:44:36 (none) auth.info sshd[1870]: Failed password for root from 63.216.14.150 port 43770 ssh2 Jan 27 05:44:39 (none) auth.info sshd[1874]: Failed password for root from 63.216.14.150 port 44044 ssh2 Jan 27 05:44:41 (none) auth.info sshd[1878]: Failed password for root from 63.216.14.150 port 44324 ssh2 Jan 27 05:44:44 (none) auth.info sshd[1882]: Failed password for root from 63.216.14.150 port 44596 ssh2 Jan 27 05:44:46 (none) auth.info sshd[1886]: Failed password for root from 63.216.14.150 port 44863 ssh2 Donc, C'est parti ! Je vais modifier un peu les règles iptables pour qu'elle ne laisse plus passer le port 22, mais le port 6547. ensuite, il faut prévenir sshd qu'il doit écouter sur les ports 22 et 6547. De mon réseau local, je continue d'utiliser le port 22, mais de l'extérieur, j'utiliserai le port 6547. sur chaque poste hors de mon réseau, je rajoute les lignes de configuration suivantes dans mon fichier ''.ssh/config'' host monslug.mondomaine.fr port 6547 Comme je fais cela à distance, je commence par sshd, puis je mets les nouvelles règles iptables, sous peine d'être verrouillé dehors dès que la règle iptables est passée, et de devoir attendre mon retour pour redémarrer le SLUG. Remarquez qu'on peut parfaitement redémarrer sshd en étant connecté par ssh et sans perdre la connexion existante. Voilà donc le plan d'action : - Édition de ''/etc/ssh/sshd_config'' : Ajout vers le début des deux lignes Port 22 Port 6547 On peut le faire comme ça root@slug # sed -i -e '/Port 22/{ > s/.*/Port 22/ > a\ > Port 6547 > }' /etc/ssh/sshd_config root@slug # - redémarrage de sshd - Ajout d'une règle iptables qui laisse passer le port 6547 juste avant la règle qui laisse passer le port 22 - Retrait de l'ancienne règle iptable qui laisse passer le port 22, - sauvegarde des règles iptables pour un prochain reboot. Et voilà le journal, avec plein de vérifications et de commandes pour vérifier que tout va bien, avant et après les modifications. Notez que ce qui n'est pas montré dans ce journal c'est qu'au moment ou je retire la règle laissant passer le port 22, je perd la connexion, il me faut alors une nouvelle connexion ssh sur le port 6547 pour terminer. root@slug # ps w | grep bin/ssh 1435 root 1187 S /usr/sbin/sshd root@slug # netstat -tln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:631 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN netstat: /proc/net/tcp6: No such file or directory root@slug # vi /etc/ssh/sshd_config ... bla bla bla éditer le machin... ..... ZZ root@slug # head -n 15 /etc/ssh/sshd_config # $OpenBSD: sshd_config,v 1.59 2002/09/25 11:17:16 markus Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options change a # default value. Port 22 Port 6547 root@slug # /etc/init.d/sshd restart Restarting OpenBSD Secure Shell server: sshdstopped /usr/sbin/sshd (pid 1187) . root@slug # ps w | grep bin/ssh 1435 root 3564 S /usr/sbin/sshd 1441 root 2012 S grep bin/ssh root@slug # netstat -tln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:6547 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:631 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN netstat: /proc/net/tcp6: No such file or directory root@slug # iptables-save # Generated by iptables-save v1.3.8 on Sun Mar 6 15:33:43 2011 *filter :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [112:12903] -A INPUT -s 192.168.1.0/255.255.255.0 -j ACCEPT -A INPUT -p tcp -m multiport --dports 22,443 -j ACCEPT -A INPUT -m state --state ESTABLISHED -j ACCEPT -A INPUT -j DROP COMMIT # Completed on Sun Mar 6 15:33:43 2011 root@slug # iptables -I INPUT 2 -p tcp -m multiport --dports 6547,443 -j ACCEPT root@slug # iptables-save # Generated by iptables-save v1.3.8 on Sun Mar 6 15:34:17 2011 *filter :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [205:23102] -A INPUT -s 192.168.1.0/255.255.255.0 -j ACCEPT -A INPUT -p tcp -m multiport --dports 6547,443 -j ACCEPT -A INPUT -p tcp -m multiport --dports 22,443 -j ACCEPT -A INPUT -m state --state ESTABLISHED -j ACCEPT -A INPUT -j DROP COMMIT # Completed on Sun Mar 6 15:34:18 2011 root@slug # iptables -D INPUT 3 root@slug # iptables-save # Generated by iptables-save v1.3.8 on Sun Mar 6 15:34:27 2011 *filter :INPUT DROP [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [223:25574] -A INPUT -s 192.168.1.0/255.255.255.0 -j ACCEPT -A INPUT -p tcp -m multiport --dports 6547,443 -j ACCEPT -A INPUT -m state --state ESTABLISHED -j ACCEPT -A INPUT -j DROP COMMIT # Completed on Sun Mar 6 15:34:27 2011 root@slug # iptables-save >/etc/iptables.saved root@slug # ==== configuration de lighttpd et php ==== php est lancé par [[http://www.lighttpd.net/|lighttpd]], en mode [[wp>fastcgi]]. Pour que php soit exécuté par lighttpd, j'ai créé un lien symbolique de ''/etc/lighttpd-php-fcgi.conf'' vers le fichier installé par le paquet php-fcgi : ''/opt/etc/lighttpd/conf.d/10-php-fcgi.conf''. Puis j'ai fait un include de ''/etc/lighttpd-php-fcgi.conf'' dans le fichier ''/etc/lighttpd.conf'' root@slug # opkg install lighttpd lighttpd-module-access lighttpd-module-accesslog lighttpd-module-dirlisting lighttpd-module-fastcgi lighttpd-module-indexfile lighttpd-module-rewrite lighttpd-module-staticfile root@slug # opkg list_installed lighttpd\* lighttpd - 1.4.18-r3 - lighttpd-module-access - 1.4.18-r3 - lighttpd-module-accesslog - 1.4.18-r3 - lighttpd-module-dirlisting - 1.4.18-r3 - lighttpd-module-fastcgi - 1.4.18-r3 - lighttpd-module-indexfile - 1.4.18-r3 - lighttpd-module-rewrite - 1.4.18-r3 - lighttpd-module-staticfile - 1.4.18-r3 - root@slug # ipkg install php php-fcgi php-gd php-mbstring root@slug # ln -s /opt/etc/lighttpd/conf.d/10-php-fcgi.conf /etc/lighttpd-php-fcgi.conf root@slug # ll /etc/*lighttpd* lrwxrwxrwx 1 root root 41 Oct 24 23:10 /etc/lighttpd-php-fcgi.conf -> /opt/etc/lighttpd/conf.d/10-php-fcgi.conf -rwxr-xr-x 1 root root 11519 Apr 16 00:16 /etc/lighttpd.conf -rwxr-xr-x 1 root root 11456 Oct 23 11:31 /etc/lighttpd.conf.org root@slug # grep -C 2 lighttpd-php-fcgi.conf /etc/lighttpd.conf # ) # ) include "lighttpd-php-fcgi.conf" #### CGI module root@slug # /etc/init.d/lighttpd stop root@slug # /etc/init.d/lighttpd start root@slug # Le fichier ''/opt/etc/lighttpd/conf.d/10-php-fcgi.conf'' server.modules += ( "mod_fastcgi" ) fastcgi.server = ( ".php" => ( "localhost" => ( "socket" => "/tmp/php-fcgi.sock", "bin-path" => "/opt/bin/php-fcgi", "max-procs" => 1, "bin-environment" => ( "PHP_FCGI_CHILDREN" => "2", "PHP_FCGI_MAX_REQUESTS" => "1000" ) ) ) ) === Réglages de lighttpd === == utilisateur www-data:www-data == Par défaut, lighttpd tourne sous le compte root. Inacceptable d'autant plus que je vais faire fonctionner des trucs en PHP. Donc, création d'un compte ''www-data:www-data'', ''33:33'' comme sous Debian/Ubuntu nslu2:/root# grep www-data /etc/passwd /etc/group /etc/passwd:www-data:*:33:33:www-data:/var/www:/bin/sh /etc/group:www-data:*:33: nslu2:/root# ll -d /var/www ls: /var/www: No such file or directory nslu2:/root# Oui, oui, le home de www-data est ''/var/www'' et ce répertoire existe même pas... Pas grave, voire encore mieux. Ensuite ce genre de messages arrive dans ''/www/logs/lighttpd.error.log'' 2012-04-16 23:16:30: (mod_fastcgi.c.2570) FastCGI-stderr: PHP Warning: session_start() [function.session-start]: open(/opt/var/lib/php/session/sess_1b0afec0e069b7607deaed8460d80398, O_RDWR) failed: Permission denied (13) in /www/pages/latestdw/inc/init.php on line 145 PHP Warning: session_write_close() [function.session-write-close]: open(/opt/var/lib/php/session/sess_1b0afec0e069b7607deaed8460d80398, O_RDWR) failed: Permission denied (13) in /www/pages/latestdw/lib/exe/ajax.php on line 12 PHP Warning: session_write_close() [function.session-write-close]: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/opt/var/lib/php/session) in /www/pages/latestdw/lib/exe/ajax.php on line 12 Il faut régler ça en changeant le propriétaire du répertoire de session nslu2:/root# ll -d /opt/var/lib/php/session drwxrwxrwx 2 root root 4096 Apr 16 00:23 /opt/var/lib/php/session nslu2:/root# ll /opt/var/lib/php/session -rw------- 1 root root 590 Apr 15 20:54 sess_1b0afec0e069b7607deaed8460d80398 -rw------- 1 root root 470 Feb 9 05:07 sess_21fd751df2b57c4fb710d25726946ee4 -rw------- 1 root root 470 Jan 10 09:17 sess_3ed2a6ea2769c16e84c0df1724f22111 -rw------- 1 www-data www-data 640 Apr 16 01:41 sess_6c3ea031137aa2f394d647533e4e699c -rw------- 1 root root 56 Feb 20 21:33 sess_85459b528bf3a26be1dae4ffbbc0fbde -rw------- 1 root root 56 Jan 11 17:56 sess_ae1dd1bea9b2b04bebad7cd8acbb2d9f -rw------- 1 root root 502 Jan 11 17:54 sess_f134a3dd2738e458aac253afbe98fe59 nslu2:/root# rm -rf /opt/var/lib/php/session/sess_* nslu2:/root# find /opt/var/lib/php/session /opt/var/lib/php/session nslu2:/root# chown -R www-data:www-data /opt/var/lib/php/session nslu2:/root# chmod 700 /opt/var/lib/php/session ls -la /opt/var/lib/php/session drwx------ 2 www-data www-data 4096 Apr 16 23:30 . drwxr-xr-x 3 root root 4096 Feb 23 23:56 .. nslu2:/root# === Réglages de php === == Quantité de mémoire == changé une ligne dans ''/opt/etc/php.ini'' pour passer la mémoire disponible por un script de 8Mo (ce qui est insuffisant pour dokuwiki) à 18Mo, ce qui permet d'afficher les pages que je crée. memory_limit = 18M ; Maximum amount of memory a script may consume (8MB) == Chargement d'extension sqlite == Pour utiliser le module [[doku>plugin:data]], il faut le module [[doku>plugin:sqlite]]. Le module sqlite, réclame à son tour l'extension sqlite de php. Pour charger cette extension, il faut créer un fichier ''/opt/etc/php.d/sqlite.ini'' qui contient ceci : extension=pdo.so extension=sqlite.so ==== Installation de dokuwiki ==== Créer un fichier de config pour lighttpd. Sachant qu'on atteindra le wiki //via// cet URL : ''%%http://bloink.homelinux.net/latestdw/%%'', et que je veux de beaux URL, donc [[doku>fr:config:userewrite]]=1, voilà le fichier ''/etc/lighttpd-doku.conf'' nécessaire : #dokuWiki configuration # We assume here that the wiki is accessible via http://wiki.example.com/latestdw/ var.dokuurl = "/latestdw" # deny access completely to these, although .ht* or _ht* are NOT used by lighttpd $HTTP["url"] =~ "/(\.|_)ht" { url.access-deny = ( "" ) } $HTTP["url"] =~ "^" + var.dokuurl + "/(bin|data|inc|conf)/" { url.access-deny = ( "" ) } # rewrites for dokuwiki $HTTP["url"] =~ "^" + var.dokuurl { index-file.names = ("doku.php") } url.rewrite = ( "^" + var.dokuurl + "/lib/.*$" => "$0", "^" + var.dokuurl + "/_media/(.*)?\?(.*)$" => var.dokuurl + "/lib/exe/fetch.php?media=$1&$2", "^" + var.dokuurl + "/_media/(.*)$" => var.dokuurl + "/lib/exe/fetch.php?media=$1", "^" + var.dokuurl + "/_detail/(.*)?\?(.*)$" => var.dokuurl + "/lib/exe/detail.php?media=$1&$2", "^" + var.dokuurl + "/_detail/(.*)?$" => var.dokuurl + "/lib/exe/detail.php?media=$1", "^" + var.dokuurl + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokuurl + "/doku.php?do=export_$1&id=$2&$3", "^" + var.dokuurl + "/_export/([^/]+)/(.*)" => var.dokuurl + "/doku.php?do=export_$1&id=$2", "^" + var.dokuurl + "/install.php.*" => "$0", "^" + var.dokuurl + "/doku.php.*" => "$0", "^" + var.dokuurl + "/feed.php.*" => "$0", "^" + var.dokuurl + "/(.*)\?(.*)" => var.dokuurl + "/doku.php?id=$1&$2", "^" + var.dokuurl + "/(.*)" => var.dokuurl + "/doku.php?id=$1" ) Il faut alors, rajouter une ligne ''include "lighttpd-doku.conf"'' dans le fichier ''/etc/lighttpd.conf''. juste avant la fin du fichier de config root@nslu2# tail -n 3 /etc/lighttpd.conf include "lighttpd-doku.conf" root@nslu2# /etc/init.d/lighttpd stop root@nslu2# /etc/init.d/lighttpd start ===== incidents ===== Liste des incidents sur **mon** slug. Il y en a bien peu, mais quand on ajoute à un incident, la bêtise du réparateur (moi, hélas), ça peut faire des dégats, malgré tout. ==== dimanche 25 septembre 2011, 21:37:27 (UTC+0200) ==== Alors que je suis connecté, en train de scripter une bricole pour les mises à jour automatiques de mon dokuwiki, problème avec la clef USB : Les filesystems se mettent en vrac. D'abord / (''/dev/sda1'') qui passe tout seul en lecture seul. Je tente alors d'écrire le résultat de ''dmesg'' vers /home, mais un autre message d'erreur m'indique que ce n'est pas possible. Copier/Coller et j'ai le résultat de dmesg das un fichier sur mon ordinateur portable. Je fais un ''su -'' et remonte alors le disque /home du slug en lecture seule. Arrêt du slug avec halt. et montage de la cles usb sur le portable pour y faire tourner ''fsck''; Malheureusement, et c'est là qu'on voit la bêtise de l'opérateur : si je fais bien un ''fsck /dev/sda1''n je fais en revanche un **''mkfs /dev/sda3''**. Ô stupidité sans fin, merci de m'avoir inspiré ce jour ! Putain de merde ! C'est pas grave, tout ce qui est sur le slug est aussi ailleurs, c'est son but, centraliser mes multiples copies, mais quand même ça fait chier. Je perds une heure ou deux de progrmmation((en fait non, j'ai fait une image de la clef par ''dd'' et puis un gros grep sur l'image en prenant plein de lignes de contexte. J'ai retrouvé l'essentiel)) moi@slug $ dmesg Linux version 2.6.27.8 (slug@builder) (gcc version 4.2.4) #1 Sat Mar 7 02:47:23 UTC 2009 CPU: XScale-IXP42x Family [690541f1] revision 1 (ARMv5TE), cr=000039ff Machine: Linksys NSLU2 Memory policy: ECC disabled, Data cache writeback On node 0 totalpages: 8192 free_area_init_node: node 0, pgdat c0235f84, node_mem_map c0248000 DMA zone: 8128 pages, LIFO batch:0 CPU0: D VIVT undefined 5 cache CPU0: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets CPU0: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128 Kernel command line: console=ttyS0,115200n8 root=/dev/mtdblock4 rootfstype=jffs2 rw init=/linuxrc noirqdebug IRQ lockup detection disabled PID hash table entries: 128 (order: 7, 512 bytes) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory: 32MB = 32MB total Memory: 30148KB available (2056K code, 146K data, 92K init) Calibrating delay loop... 266.24 BogoMIPS (lpj=1331200) Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok net_namespace: 756 bytes NET: Registered protocol family 16 IXP4xx: Using 16MiB expansion bus window size NSLU2: Using MAC address 00:14:bf:65:a5:b1 for port 0 PCI: IXP4xx is host PCI: IXP4xx Using direct access for memory space PCI: 0000:00:01.0 reg 10 32bit mmio: [0, fff] pci 0000:00:01.0: supports D1 pci 0000:00:01.0: supports D2 pci 0000:00:01.0: PME# supported from D0 D1 D2 D3hot pci 0000:00:01.0: PME# disabled PCI: 0000:00:01.1 reg 10 32bit mmio: [0, fff] pci 0000:00:01.1: supports D1 pci 0000:00:01.1: supports D2 pci 0000:00:01.1: PME# supported from D0 D1 D2 D3hot pci 0000:00:01.1: PME# disabled PCI: 0000:00:01.2 reg 10 32bit mmio: [0, ff] pci 0000:00:01.2: supports D1 pci 0000:00:01.2: supports D2 pci 0000:00:01.2: PME# supported from D0 D1 D2 D3hot pci 0000:00:01.2: PME# disabled PCI: bus0: Fast back to back transfers disabled pci 0000:00:01.0: dmabounce: registered device pci 0000:00:01.1: dmabounce: registered device pci 0000:00:01.2: dmabounce: registered device SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb NET: Registered protocol family 2 Switched to high resolution mode on CPU 0 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 1024 (order: 1, 8192 bytes) TCP bind hash table entries: 1024 (order: 0, 4096 bytes) TCP: Hash tables configured (established 1024 bind 1024) TCP reno registered NET: Registered protocol family 1 IXP4xx Queue Manager initialized. NetWinder Floating Point Emulator V0.97 (double precision) JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc. msgmni has been set to 58 io scheduler noop registered io scheduler deadline registered (default) Serial: 8250/16550 driver2 ports, IRQ sharing disabled serial8250.0: ttyS0 at MMIO 0xc8000000 (irq = 15) is a XScale console [ttyS0] enabled serial8250.0: ttyS1 at MMIO 0xc8001000 (irq = 13) is a XScale brd: module loaded eth0: MII PHY 1 on NPE-B Driver 'sd' needs updating - please use bus_type methods IXP4XX-Flash.0: Found 1 x16 devices at 0x0 in 16-bit bank IXP4XX-Flash.0: Found an alias at 0x800000 for the chip at 0x0 Intel/Sharp Extended Query Table at 0x0031 Using buffer write method cfi_cmdset_0001: Erase suspend on write enabled erase region 0: offset=0x0,size=0x20000,blocks=64 Searching for RedBoot partition table in IXP4XX-Flash.0 at offset 0x7e0000 6 RedBoot partitions found on MTD device IXP4XX-Flash.0 Creating 6 MTD partitions on "IXP4XX-Flash.0": 0x00000000-0x00040000 : "RedBoot" 0x00040000-0x00060000 : "SysConf" 0x00060000-0x00080000 : "Loader" 0x00080000-0x001a0000 : "Kernel" 0x001a0000-0x007e0000 : "Flashdisk" 0x007e0000-0x00800000 : "FIS directory" Initializing USB Mass Storage driver... usbcore: registered new interface driver usb-storage USB Mass Storage support registered. input: ixp4xx beeper as /class/input/input0 i2c /dev entries driver rtc-x1205 0-006f: chip found, driver version 1.0.8 rtc-x1205 0-006f: rtc core: registered rtc-x1205 as rtc0 i2c-gpio i2c-gpio.0: using pins 7 (SDA) and 6 (SCL) Registered led device: nslu2:green:ready Registered led device: nslu2:red:status Registered led device: nslu2:green:disk-1 Registered led device: nslu2:green:disk-2 TCP cubic registered NET: Registered protocol family 17 XScale DSP coprocessor detected. rtc-x1205 0-006f: setting system clock to 2011-09-15 12:35:19 UTC (1316090119) VFS: Mounted root (jffs2 filesystem). Freeing init memory: 92K PCI: enabling device 0000:00:01.2 (0140 -> 0142) ehci_hcd 0000:00:01.2: EHCI Host Controller ehci_hcd 0000:00:01.2: new USB bus registered, assigned bus number 1 ehci_hcd 0000:00:01.2: irq 26, io mem 0x48002000 ehci_hcd 0000:00:01.2: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 5 ports detected ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver PCI: enabling device 0000:00:01.0 (0140 -> 0142) ohci_hcd 0000:00:01.0: OHCI Host Controller ohci_hcd 0000:00:01.0: new USB bus registered, assigned bus number 2 ohci_hcd 0000:00:01.0: irq 28, io mem 0x48000000 usb 1-2: new high speed USB device using ehci_hcd and address 2 usb usb2: configuration #1 chosen from 1 choice hub 2-0:1.0: USB hub found hub 2-0:1.0: 3 ports detected usb 1-2: configuration #1 chosen from 1 choice scsi0 : SCSI emulation for USB Mass Storage devices PCI: enabling device 0000:00:01.1 (0140 -> 0142) ohci_hcd 0000:00:01.1: OHCI Host Controller ohci_hcd 0000:00:01.1: new USB bus registered, assigned bus number 3 ohci_hcd 0000:00:01.1: irq 27, io mem 0x48001000 usb-storage: device found at 2 usb-storage: waiting for device to settle before scanning usb usb3: configuration #1 chosen from 1 choice hub 3-0:1.0: USB hub found hub 3-0:1.0: 2 ports detected scsi 0:0:0:0: Direct-Access Corsair Voyager GTR 0.00 PQ: 0 ANSI: 2 sd 0:0:0:0: [sda] 63438848 512-byte hardware sectors (32481 MB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00 sd 0:0:0:0: [sda] Assuming drive cache: write through sd 0:0:0:0: [sda] 63438848 512-byte hardware sectors (32481 MB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00 sd 0:0:0:0: [sda] Assuming drive cache: write through sda: sda1 sda2 sda3 sd 0:0:0:0: [sda] Attached SCSI removable disk usb-storage: device scan complete kjournald starting. Commit interval 5 seconds EXT3 FS on sda1, internal journal EXT3-fs: recovery complete. EXT3-fs: mounted filesystem with ordered data mode. FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive! Adding 503740k swap on /dev/sda2. Priority:-1 extents:1 across:503740k kjournald starting. Commit interval 5 seconds EXT3 FS on sda3, internal journal EXT3-fs: recovery complete. EXT3-fs: mounted filesystem with ordered data mode. firmware: requesting NPE-B NPE-B: firmware functionality 0x0, revision 0x2:1 eth0: link down ip_tables: (C) 2000-2006 Netfilter Core Team nf_conntrack version 0.5.0 (1024 buckets, 4096 max) CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Plase use nf_conntrack.acct=1 kernel paramater, acct=1 nf_conntrack module option or sysctl net.netfilter.nf_conntrack_acct=1 to enable it. eth0: link up, 100Mbps, full-duplex, lpa 0x45E1 usb 2-1: new full speed USB device using ohci_hcd and address 2 usb 2-1: configuration #1 chosen from 1 choice usblp0: USB Bidirectional printer dev 2 if 0 alt 1 proto 2 vid 0x03F0 pid 0x1D17 usbcore: registered new interface driver usblp usb 2-1: USB disconnect, address 2 usblp0: removed device eth0 entered promiscuous mode device eth0 left promiscuous mode attempt to access beyond end of device sda1: rw=17, want=4294967296, limit=984188 Buffer I/O error on device sda1, logical block 4294967295 lost page write due to I/O error on sda1 Aborting journal on device sda1. ext3_abort called. EXT3-fs error (device sda1): ext3_journal_start_sb: Detected aborted journal Remounting filesystem read-only EXT3-fs error (device sda3): ext3_add_entry: bad entry in directory #188417: directory entry across blocks - offset=0, inode=4294967295, rec_len=65536, name_len=255 EXT3-fs error (device sda3): ext3_add_entry: bad entry in directory #188417: directory entry across blocks - offset=0, inode=4294967295, rec_len=65536, name_len=255 EXT3-fs error (device sda3): ext3_add_entry: bad entry in directory #188417: directory entry across blocks - offset=0, inode=4294967295, rec_len=65536, name_len=255 EXT3-fs error (device sda3): ext3_add_entry: bad entry in directory #188417: directory entry across blocks - offset=0, inode=4294967295, rec_len=65536, name_len=255 EXT3-fs error (device sda3): ext3_add_entry: bad entry in directory #188417: directory entry across blocks - offset=0, inode=4294967295, rec_len=65536, name_len=255 EXT3-fs error (device sda3): ext3_add_entry: bad entry in directory #188417: directory entry across blocks - offset=0, inode=4294967295, rec_len=65536, name_len=255 cmartin@schpluntz:~/Replicated/crontabs (0) $ Le lendemain, après réinstallation, même erreur. La clef est bien défectueuse. C'est pas le slug qui s'est pris les pieds dans le tapis. Va falloir remettre la main sur la facture de la clef maintenant... Quelques jours ont passé et voilà les vraies bad news : - La clef n'est plus sous garantie :-( - La boutique internet où je l'avais acheté a coulé de toutes façons :-( \\ Détail des ioerrors et erreurs alors que je suis en pleine ré-installation : - Tout fonctionne : ''sed -i -e ....'' ne génère aucune erreur - Patatra : ''echo ... >>/opt/etc/ipkg.conf'' : Erreur : système en lecture seule. root@slug # sed -i -e 's|/stable|/unstable|' /opt/etc/ipkg.conf root@slug # sed -i -e '/^src/s/^/# /' /opt/etc/ipkg.conf root@slug # echo 'src optnslu2 http://ipkg.nslu2-linux.org/feeds/optware/slugos5 be/cross/unstable' >>/opt/etc/ipkg.conf -sh: can't create /opt/etc/ipkg.conf: Read-only file system root@slug # mount rootfs on / type rootfs (rw) /dev/root on /initrd type jffs2 (ro) /dev/sda1 on / type ext3 (ro,noatime,errors=continue,data=ordered) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) /dev/sda1 on /dev/.static/dev type ext3 (ro,noatime,errors=continue,data=ordered) udev on /dev type tmpfs (rw,size=2048k,mode=755) tmpfs on /var/volatile type tmpfs (rw,mode=755) tmpfs on /dev/shm type tmpfs (rw,mode=777) usbfs on /proc/bus/usb type usbfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) root@slug # dmesg | tail sda1: rw=17, want=4294967296, limit=984188 Buffer I/O error on device sda1, logical block 4294967295 lost page write due to I/O error on sda1 Aborting journal on device sda1. EXT3-fs error (device sda1) in ext3_reserve_inode_write: Journal has aborted EXT3-fs error (device sda1) in ext3_orphan_add: Journal has aborted EXT3-fs error (device sda1) in ext3_rename: Journal has aborted ext3_abort called. EXT3-fs error (device sda1): ext3_journal_start_sb: Detected aborted journal Remounting filesystem read-only root@slug # dmesg Linux version 2.6.27.8 (slug@builder) (gcc version 4.2.4) #1 Sat Mar 7 02:47:23 UTC 2009 CPU: XScale-IXP42x Family [690541f1] revision 1 (ARMv5TE), cr=000039ff Machine: Linksys NSLU2 Memory policy: ECC disabled, Data cache writeback On node 0 totalpages: 8192 free_area_init_node: node 0, pgdat c0235f84, node_mem_map c0248000 DMA zone: 8128 pages, LIFO batch:0 CPU0: D VIVT undefined 5 cache CPU0: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets CPU0: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128 Kernel command line: console=ttyS0,115200n8 root=/dev/mtdblock4 rootfstype=jffs2 rw init=/linuxrc noirqdebug IRQ lockup detection disabled PID hash table entries: 128 (order: 7, 512 bytes) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory: 32MB = 32MB total Memory: 30148KB available (2056K code, 146K data, 92K init) Calibrating delay loop... 266.24 BogoMIPS (lpj=1331200) Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok net_namespace: 756 bytes NET: Registered protocol family 16 IXP4xx: Using 16MiB expansion bus window size NSLU2: Using MAC address 00:14:bf:65:a5:b1 for port 0 PCI: IXP4xx is host PCI: IXP4xx Using direct access for memory space PCI: 0000:00:01.0 reg 10 32bit mmio: [0, fff] pci 0000:00:01.0: supports D1 pci 0000:00:01.0: supports D2 pci 0000:00:01.0: PME# supported from D0 D1 D2 D3hot pci 0000:00:01.0: PME# disabled PCI: 0000:00:01.1 reg 10 32bit mmio: [0, fff] pci 0000:00:01.1: supports D1 pci 0000:00:01.1: supports D2 pci 0000:00:01.1: PME# supported from D0 D1 D2 D3hot pci 0000:00:01.1: PME# disabled PCI: 0000:00:01.2 reg 10 32bit mmio: [0, ff] pci 0000:00:01.2: supports D1 pci 0000:00:01.2: supports D2 pci 0000:00:01.2: PME# supported from D0 D1 D2 D3hot pci 0000:00:01.2: PME# disabled PCI: bus0: Fast back to back transfers disabled pci 0000:00:01.0: dmabounce: registered device pci 0000:00:01.1: dmabounce: registered device pci 0000:00:01.2: dmabounce: registered device SCSI subsystem initialized usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb NET: Registered protocol family 2 Switched to high resolution mode on CPU 0 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 1024 (order: 1, 8192 bytes) TCP bind hash table entries: 1024 (order: 0, 4096 bytes) TCP: Hash tables configured (established 1024 bind 1024) TCP reno registered NET: Registered protocol family 1 IXP4xx Queue Manager initialized. NetWinder Floating Point Emulator V0.97 (double precision) JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc. msgmni has been set to 58 io scheduler noop registered io scheduler deadline registered (default) Serial: 8250/16550 driver2 ports, IRQ sharing disabled serial8250.0: ttyS0 at MMIO 0xc8000000 (irq = 15) is a XScale console [ttyS0] enabled serial8250.0: ttyS1 at MMIO 0xc8001000 (irq = 13) is a XScale brd: module loaded eth0: MII PHY 1 on NPE-B Driver 'sd' needs updating - please use bus_type methods IXP4XX-Flash.0: Found 1 x16 devices at 0x0 in 16-bit bank IXP4XX-Flash.0: Found an alias at 0x800000 for the chip at 0x0 Intel/Sharp Extended Query Table at 0x0031 Using buffer write method cfi_cmdset_0001: Erase suspend on write enabled erase region 0: offset=0x0,size=0x20000,blocks=64 Searching for RedBoot partition table in IXP4XX-Flash.0 at offset 0x7e0000 6 RedBoot partitions found on MTD device IXP4XX-Flash.0 Creating 6 MTD partitions on "IXP4XX-Flash.0": 0x00000000-0x00040000 : "RedBoot" 0x00040000-0x00060000 : "SysConf" 0x00060000-0x00080000 : "Loader" 0x00080000-0x001a0000 : "Kernel" 0x001a0000-0x007e0000 : "Flashdisk" 0x007e0000-0x00800000 : "FIS directory" Initializing USB Mass Storage driver... usbcore: registered new interface driver usb-storage USB Mass Storage support registered. input: ixp4xx beeper as /class/input/input0 i2c /dev entries driver rtc-x1205 0-006f: chip found, driver version 1.0.8 rtc-x1205 0-006f: rtc core: registered rtc-x1205 as rtc0 i2c-gpio i2c-gpio.0: using pins 7 (SDA) and 6 (SCL) Registered led device: nslu2:green:ready Registered led device: nslu2:red:status Registered led device: nslu2:green:disk-1 Registered led device: nslu2:green:disk-2 TCP cubic registered NET: Registered protocol family 17 XScale DSP coprocessor detected. rtc-x1205 0-006f: setting system clock to 2011-09-25 19:42:22 UTC (1316979742) VFS: Mounted root (jffs2 filesystem). Freeing init memory: 92K PCI: enabling device 0000:00:01.2 (0140 -> 0142) ehci_hcd 0000:00:01.2: EHCI Host Controller ehci_hcd 0000:00:01.2: new USB bus registered, assigned bus number 1 ehci_hcd 0000:00:01.2: irq 26, io mem 0x48002000 ehci_hcd 0000:00:01.2: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 5 ports detected ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver PCI: enabling device 0000:00:01.0 (0140 -> 0142) ohci_hcd 0000:00:01.0: OHCI Host Controller ohci_hcd 0000:00:01.0: new USB bus registered, assigned bus number 2 ohci_hcd 0000:00:01.0: irq 28, io mem 0x48000000 usb 1-2: new high speed USB device using ehci_hcd and address 2 usb usb2: configuration #1 chosen from 1 choice hub 2-0:1.0: USB hub found hub 2-0:1.0: 3 ports detected PCI: enabling device 0000:00:01.1 (0140 -> 0142) ohci_hcd 0000:00:01.1: OHCI Host Controller ohci_hcd 0000:00:01.1: new USB bus registered, assigned bus number 3 ohci_hcd 0000:00:01.1: irq 27, io mem 0x48001000 usb usb3: configuration #1 chosen from 1 choice hub 3-0:1.0: USB hub found hub 3-0:1.0: 2 ports detected usb 1-2: configuration #1 chosen from 1 choice scsi0 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 2 usb-storage: waiting for device to settle before scanning scsi 0:0:0:0: Direct-Access Corsair Voyager GTR 0.00 PQ: 0 ANSI: 2 sd 0:0:0:0: [sda] 63438848 512-byte hardware sectors (32481 MB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00 sd 0:0:0:0: [sda] Assuming drive cache: write through sd 0:0:0:0: [sda] 63438848 512-byte hardware sectors (32481 MB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00 sd 0:0:0:0: [sda] Assuming drive cache: write through sda: sda1 sda2 sda3 sd 0:0:0:0: [sda] Attached SCSI removable disk usb-storage: device scan complete kjournald starting. Commit interval 5 seconds EXT3 FS on sda1, internal journal EXT3-fs: mounted filesystem with ordered data mode. EXT3-fs error (device sda3): ext3_check_descriptors: Block bitmap for group 0 not in group (block 4294967295)! EXT3-fs: group descriptors corrupted! EXT2-fs error (device sda3): ext2_check_descriptors: Block bitmap for group 0 not in group (block 4294967295)! EXT2-fs: group descriptors corrupted! FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive! FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive! EXT3-fs error (device sda3): ext3_check_descriptors: Block bitmap for group 0 not in group (block 4294967295)! EXT3-fs: group descriptors corrupted! Adding 503740k swap on /dev/sda2. Priority:-1 extents:1 across:503740k firmware: requesting NPE-B NPE-B: firmware functionality 0x0, revision 0x2:1 eth0: link down eth0: link up, 100Mbps, full-duplex, lpa 0x45E1 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len % 4 != 0 - offset=8192, inode=1651076159, rec_len=27951, name_len=111 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: directory entry across blocks - offset=7168, inode=16783472, rec_len=18216, name_len=125 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len is smaller than minimal - offset=11264, inode=4097, rec_len=4, name_len=8 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len % 4 != 0 - offset=8192, inode=1651076159, rec_len=27951, name_len=111 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len % 4 != 0 - offset=8192, inode=1651076159, rec_len=27951, name_len=111 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len is smaller than minimal - offset=11264, inode=4097, rec_len=4, name_len=8 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: directory entry across blocks - offset=7168, inode=16783472, rec_len=18216, name_len=125 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len % 4 != 0 - offset=8192, inode=1651076159, rec_len=27951, name_len=111 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len % 4 != 0 - offset=8192, inode=1651076159, rec_len=27951, name_len=111 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: directory entry across blocks - offset=7168, inode=16783472, rec_len=18216, name_len=125 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len % 4 != 0 - offset=8192, inode=1651076159, rec_len=27951, name_len=111 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len % 4 != 0 - offset=8192, inode=1651076159, rec_len=27951, name_len=111 EXT3-fs error (device sda1): ext3_dx_find_entry: bad entry in directory #6190: rec_len % 4 != 0 - offset=8192, inode=1651076159, rec_len=27951, name_len=111 attempt to access beyond end of device sda1: rw=1, want=4294967296, limit=984188 attempt to access beyond end of device sda1: rw=1, want=4294967296, limit=984188 attempt to access beyond end of device sda1: rw=17, want=4294967296, limit=984188 Buffer I/O error on device sda1, logical block 4294967295 lost page write due to I/O error on sda1 Aborting journal on device sda1. EXT3-fs error (device sda1) in ext3_reserve_inode_write: Journal has aborted EXT3-fs error (device sda1) in ext3_orphan_add: Journal has aborted EXT3-fs error (device sda1) in ext3_rename: Journal has aborted ext3_abort called. EXT3-fs error (device sda1): ext3_journal_start_sb: Detected aborted journal Remounting filesystem read-only root@slug # halt # y'a plus rien d'autre a faire === Réinstallation temporaire sur clef 4Go === préparation de la clef root@imladris:~# fdisk /dev/sdc WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Commande (m pour l'aide): p Disque /dev/sdc: 4051 Mo, 4051697664 octets 125 têtes, 62 secteurs/piste, 1021 cylindres Unités = cylindres de 7750 * 512 = 3968000 octets Taille de secteur (logique / physique) : 512 octets / 512 octets taille d'E/S (minimale / optimale) : 512 octets / 512 octets Identifiant de disque : 0x00004a17 Périphérique Amorce Début Fin Blocs Id Système /dev/sdc1 1 76 294469 83 Linux /dev/sdc2 77 91 58125 82 Linux swap / Solaris /dev/sdc3 92 1021 3603750 83 Linux Commande (m pour l'aide): q root@imladris:~# fdisk /dev/sdc WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Commande (m pour l'aide): w La table de partitions a été altérée! Appel de ioctl() pour relire la table de partitions. Synchronisation des disques. root@imladris:~# mkfs.ext3 -L racine-sch /dev/sdc1 mke2fs 1.41.14 (22-Dec-2010) Étiquette de système de fichiers=racine-sch Type de système d'exploitation : Linux Taille de bloc=1024 (log=0) Taille de fragment=1024 (log=0) « Stride » = 0 blocs, « Stripe width » = 0 blocs 73728 i-noeuds, 294468 blocs 14723 blocs (5.00%) réservés pour le super utilisateur Premier bloc de données=1 Nombre maximum de blocs du système de fichiers=67633152 36 groupes de blocs 8192 blocs par groupe, 8192 fragments par groupe 2048 i-noeuds par groupe Superblocs de secours stockés sur les blocs : 8193, 24577, 40961, 57345, 73729, 204801, 221185 Écriture des tables d'i-noeuds : complété Création du journal (8192 blocs) : complété Écriture des superblocs et de l'information de comptabilité du système de fichiers : complété Le système de fichiers sera automatiquement vérifié tous les 36 montages ou après 180 jours, selon la première éventualité. Utiliser tune2fs -c ou -i pour écraser la valeur. root@grumpf:~# mkfs.ext3 -L home-sch -M /home /dev/sdc3 mke2fs 1.41.11 (14-Mar-2010) Étiquette de système de fichiers=home-sch Type de système d'exploitation : Linux Taille de bloc=4096 (log=2) Taille de fragment=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 962880 i-noeuds, 3849216 blocs 192460 blocs (5.00%) réservés pour le super utilisateur Premier bloc de données=0 Nombre maximum de blocs du système de fichiers=3942645760 118 groupes de blocs 32768 blocs par groupe, 32768 fragments par groupe 8160 i-noeuds par groupe Superblocs de secours stockés sur les blocs : 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208 Écriture des tables d'i-noeuds : complété Création du journal (32768 blocs) : complété Écriture des superblocs et de l'information de comptabilité du système de fichiers : complété Le système de fichiers sera automatiquement vérifié tous les 27 montages ou après 180 jours, selon la première éventualité. Utiliser tune2fs -c ou -i pour écraser la valeur. root@grumpf:~# tune2fs -L home-sch -c 0 -i 0 /dev/sdc3 tune2fs 1.41.14 (22-Dec-2010) Initialisation du nombre maximal de montages à 0 Initialisation de l'intervalle de vérification à 0 secondes root@imladris:~# mkswap /dev/sdc2 Configure l'espace d'échange (swap) en version 1, taille = 58120 Ko pas d'étiquette, UUID=ba710ff9-22c6-4e2a-b709-fbb1fc6581bf root@imladris:~# ==== samedi 11 août 2012, 10:05:12 (UTC+0200) ==== rebelotte, la clef qui se met en botte. le nslu2 se bloque soudainement en pleine synchro unison. reboot, et la, seul le système de la flash est en marche il refuse de monter la clef. tout ça va finir avec un vrai petit disque dur. les clefs usb, même de bonne marque sont pas faites pour tant d'IO. La clef n'est pas réutilisable, les données dessus sont définitivement perdues. Ça ne me gène pas de perdre les données dessus, car ce ne sont que des copies. mais ça fait du boulot pour réinstaller... En branchant cette clef sur un pc sous linux, j'essaye de faire quelque chose. elle s'appelle ce jour là ''/dev/sdc''. ''sdc1'' est la racine, ''sdc2'' du swap, et ''sdc3'' est ''/home''. sdc1 peut-être lue mais pas écrite. ''sdc3'' n'est qu'à moité lisible. erreur à 8,8G sur les 15 de la clef... root@fangorn:~ (0) # mount -r /dev/sdc1 /mnt mount : mauvais type de système de fichiers, option erronée, superbloc erroné sur /dev/sdc1, page de code ou aide manquante, ou autre erreur Dans quelques cas certaines informations sont utiles dans syslog - essayez dmesg | tail ou quelque chose du genre root@fangorn:~ (32) # dmesg | tail [36347.698734] sd 8:0:0:0: [sdc] No Caching mode page present [36347.698738] sd 8:0:0:0: [sdc] Assuming drive cache: write through [36347.700360] sdc: sdc1 sdc2 sdc3 [36347.703484] sd 8:0:0:0: [sdc] No Caching mode page present [36347.703487] sd 8:0:0:0: [sdc] Assuming drive cache: write through [36347.703491] sd 8:0:0:0: [sdc] Attached SCSI removable disk [36347.966487] EXT3-fs (sdc1): error: no journal found [36411.970010] EXT3-fs (sdc1): recovery required on readonly filesystem [36411.970013] EXT3-fs (sdc1): write access will be enabled during recovery [36411.970500] EXT3-fs (sdc1): error: no journal found root@fangorn:~ (0) # dd if=/dev/sdc1 of=schpluntz.sdc1 586746+0 enregistrements lus 586746+0 enregistrements écrits 300413952 octets (300 MB) copiés, 8,75525 s, 34,3 MB/s root@fangorn:~ (0) # dd if=schpluntz.sdc1 of=/dev/sdc1 dd: écriture vers «/dev/sdc1»: Erreur d'entrée/sortie 20251+0 enregistrements lus 20250+0 enregistrements écrits 10368000 octets (10 MB) copiés, 10,1891 s, 1,0 MB/s root@fangorn:~ (1) # dd if=/dev/sdc3 of=schpluntz.sdc3 dd: lecture de «/dev/sdc3»: Erreur d'entrée/sortie 17227744+0 enregistrements lus 17227744+0 enregistrements écrits 8820604928 octets (8,8 GB) copiés, 484,309 s, 18,2 MB/s root@fangorn:~ (1) # fsck /dev/sdc1 fsck de util-linux 2.20.1 e2fsck 1.42 (29-Nov-2011) le superbloc a un journal invalide (i-noeud 8). Effacer? oui *** ext3 journal has been deleted - filesystem is now ext2 only *** /dev/sdc1 n'a pas été démonté proprement, vérification forcée. Passe 1 : vérification des i-noeuds, des blocs et des tailles l'i-noeud racine n'est pas un répertoire. Effacer? non Passe 2 : vérification de la structure des répertoires Passe 3 : vérification de la connectivité des répertoires l'i-noeud racine n'est pas alloué. Allouer? non Ne peut procéder sans un i-noeud racine. /dev/sdc1: ***** LE SYSTÈME DE FICHIERS A ÉTÉ MODIFIÉ ***** /dev/sdc1 : **AVERTISSEMENT : le système de fichiers contient encore des erreurs** Recréer le journal? non e2fsck: arrêté /dev/sdc1: ***** LE SYSTÈME DE FICHIERS A ÉTÉ MODIFIÉ ***** /dev/sdc1 : **AVERTISSEMENT : le système de fichiers contient encore des erreurs** root@fangorn:~ (12) # fsck /dev/sdc3 fsck de util-linux 2.20.1 e2fsck 1.42 (29-Nov-2011) fsck.ext2 : Superbloc invalide, tentons d'utiliser les blocs de sauvetage... fsck.ext2: Numéro magique invalide dans le super-bloc lors de la tentative d'ouverture de /dev/sdc3 Le superbloc n'a pu être lu ou ne contient pas un système de fichiers ext2 correct. Si le périphérique est valide et qu'il contient réellement un système de fichiers ext2 (et non pas de type swap, ufs ou autre), alors le superbloc est corrompu, et vous pourriez tenter d'exécuter e2fsck avec un autre superbloc : e2fsck -b 8193 root@fangorn:~ (8) #