mercredi 31 décembre 2014

How to use pulseaudio for network stream with Raspbmc (Kodi)?


I am using Raspbmc (with Kodi 14) on my Raspberry Pi. Now I would like to set up pulseaudio to be able to stream music from all my Linux computers easily to the Raspberry pi. My problem is, that I am not able to get pulseaudio running on the Raspberry Pi. I tried the following steps:


1. Install pulseaudio



sudo apt-get install pulseaudio pulseaudio-module-zeroconf


2. Setting up pulseaudio



sudo nano /etc/pulse/default.pa


I added the following lines:


load-module module-native-protocol-unix auth-anonymous=1



load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.1.0/24 auth-anonymous=1
load-module module-zeroconf-publish


3. Start pulseaudio


First I tried to start pulse as daemon:



pulseaudio -D


I also tried to start it system wide:



sudo pulseaudio --system


But pulse does not show up on my other machines at all (it is configured correctly there as they find each other). What is wrong here?



Plesk reporting CPU load as 2, SSH reports as 0.3


I have a dedicated server running a plesk control panel and a wordpress website.


The wordpress website is running woocommerce and is very CPU intensive as its constantly polling different suppliers for data and importing and updating the database...


The script thats doing this importing is running very slowly, and plesk is reporting the CPU load of the server as 2.0ish, but when I login to the terminal the CPU load is reported as 0.3.


Is it possible that plesk / wordpress is not using the full power of the server?


The server has Xeon(R) CPU E3-1225 V2 @ 3.20GHz x 4 and 32GB RAM. Really wordpress should be flying.


Thanks



How to hint font dejavu sans mono on OpenBSD


The default DejaVu Sans Mono font in OpenBSD xterm looks too fat. Settings in ~/.Xdefaults are: xtermfaceName: DejaVu Sans Mono xtermfaceSize: 12 How to hint this font on OpenBSD (e.g. by changes in /etc/fonst)?



How to run root commands?


I install CentOS 6.5, during the installation it asks me to define a new user, I define sampleUser and a password for it. Then, after installation, I log in into my account and open terminal. But when I do the following:



sudo do --something


It throws an error:



sampleUser is not in the sudoers file. This incident will be reported.


What should I do ? (Currently I solve the problem by logging as root user which seems a little odd).



what is the directory structure for removable media and what are their differences according to FHS?


In FHS-2.3, we have /media that holds mount points for removable media such as CD-ROMs and we have /mnt that holds temporarily mounted filesystems.


On the other hand, we have /run/media and /run/mount. For me, the CDs and USBs are mounted on /run/media.


I don't see any clear distinction between them(/media, /mnt, /run/mount) . What are their differences?




I have seen similar trend (mount on /run/media) in fedora 20 - GNOME 3.10.4 and ubuntu 14.04.1 (installed on virtual box) with GNOME 3.10.4. But when I plugged in a USB flash (with auto-mounter script) on a system with Centos 6 and GNOME 2.28.2 it was mounted on /media



How can I make text in meld readable?


A few months ago, meld started behaving oddly. Common lines are almost unreadable, and shown as dark grey text on a black background.


meld fails


Oddly enough, running it as root is fine (with kdesudo meld), although the theme is less pretty.


root meld works


How can I specify the text's colour options for meld?


I'm using:



  • Arch Linux

  • KDE 4.14.3 (also seen in 4.14.2)

  • meld 3.12.2 (also seen in 3.12.1)

  • gtk3 3.14.6 (also seen in 3.14.5)


Troubleshooting


KDE system settings


meld uses GTK3, so I fiddled with System Settings > Common Appearance and Behaviour > Application Appearance > GTK > Select a GTK3 Theme. This change was reflected in meld, but none of the three options I selected changed the text. (The available options were Default, Emacs, and oxygen-gtk; the latter is used in the screenshot above.)


Manually modifying config files


I looked in ~ for files with gtk in their name.



~/.gtkrc-2.0
~/.gtkrc-2.0-kde4
~/.config/gtk-2.0
~/.config/gtk-3.0
~/.kde4/share/config/gtkrc
~/.kde4/share/config/gtkrc-2.0


Interestingly, there is nothing with gtk in its name in /root. Hence, I tried deleting some of the ~ files, to see if I could get the same effect for my user. I presume all the gtkrc-2.0 files are irrelevant to meld.


Firstly, I deleted ~/.config/gtk-3.0, but this had no effect, and was recreated when I opened meld.


The only other option appeared to be ~/.kde4/share/config/gtkrc, so deleted this and started meld, which was unaffected. However, the file was not recreated, and it contains some possibly pertinent lines (e.g. text[ACTIVE] = { 1.000, 1.000, 1.000 }). I'm unsure if the (missing) file was loaded at all. I tried kbuildsycoca4 ; kquitapp plasma-desktop ; sleep 2 ; kstart plasma-desktop, but this had no effect. Do I need to manually reload the gtkrc? And why is this file not being affected/rewritten by the system settings?


(Also, FWIW, I removed ~/.gtkrc-2.0-kde4, which was actually a symlink to ~/.gtkrc-2.0, and I also removed the target itself, but that didn't help. Again, I didn't reload gtk (I'm not sure if this is necessary, or possible), and the files weren't re-created when I tried running meld again.)


Possibly pertinent environment variables



$ export | grep -i gtk
declare -x GTK2_RC_FILES="/etc/gtk-2.0/gtkrc:/home/sparhawk/.gtkrc-2.0:/home/sparhawk/.kde4/share/config/gtkrc-2.0"
declare -x GTK_IM_MODULE="xim"
declare -x GTK_MODULES="canberra-gtk-module"
declare -x GTK_RC_FILES="/etc/gtk/gtkrc:/home/sparhawk/.gtkrc:/home/sparhawk/.kde4/share/config/gtkrc"




(Disclosure: I've previously asked this question on the KDE forums, but didn't come to a solution.)



Black screen after resume?


I have an Asus laptop (Cr400) running Mint 17.1. If the machine is put into sleep and then resumed, I get a black screen. I can use Ctrl-Opt-F1 to switch to a command line, but that hangs at a flashing cursor before asking for a password. Switching back to F7 gives a flashing cursor. I can no longer SSH into the machine. Is there a solution?



how to print ps header when using pipe in linux


how to print ps header when using pipe in linux


this normal ps output



$ ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 17:00 ? 00:00:02 /usr/lib/systemd/systemd


but below ps command output without header



$ ps -ef | grep systemd
root 1 0 0 17:00 ? 00:00:02 /usr/lib/systemd/systemd


how do i print ps header for second command?


thx



For loop brackets - C like syntax


When i am using the below syntax to iterate why two brackets are needed ?



for (( expr1; expr2; expr3 ))
do
command1
command2
..
done


and the below code doesn't work ? and throws error "syntax error near unexpected token `('"



for ( expr1; expr2; expr3 )
do
command1
command2
..
done


bash shell - how to do nested loop without "syntax error: operand expected"


I am trying



for i in {4..100}
do
is_prime=true
a=$(($i-1))
for divider in {2..$a}
do
b=$(($i % $divider)) # <-- line 9
[ $b -eq 0 ] && echo 'y' #is_prime=false
done
[ is_prime == true ] && print "${i} is prime!"
done


but I get



$ ./3_largest_prime.sh
./3_largest_prime.sh: line 9: 4 % {2..3}: syntax error: operand expected
(error token is "{2..3}")


Using | pipe character from a $variable makes it treat as just another argument in bash; how to escape it?


I have a bash script like this



export pipedargument="| sort -n"
ls $pipedargument


But it gives the error



ls: |: No such file or directory
ls: sort: No such file or directory


It seems to be treating the contents of "| sort -n" as just an argument passed to ls.


How can I escape it so that it's treated as a regular piped command?


I'm trying to conditionally set the $pipedargument. I guess I could just conditionally execute different versions of the command but still wondering if there's a way to make this work like above?



Unable to create a configuration directory for [FishShell] Please set the $XDG_CONFIG_HOME variable


stackexchange!


I'm getting this error when starting fishshell




melanie:~ melanie$ fish


fish: Unable to create a configuration directory for fish. Your personal settings will not be saved. Please set the $XDG_CONFIG_HOME variable to a directory where the current user has write access.


Welcome to fish, the friendly interactive shell


Type help for instructions on how to use fish


melanie@melanie ~>




so, I've been searching everywhere and I just can't seem to figure out how exactly to set this variable. please help!


thanks :D



What are "boot files"?


What do boot files mean?



  • all the files under /boot, or

  • all the files belonging to a boot loader (e.g. GRUB)?


Also I think it can apply to Windows and any OS too, or independent of OSes? So I am asking for the general meaning of the term.



Installed coreutils on CentOS for sort --human-readable flag but it still doesn't work


I'm trying to do du -h | sort -h , but my CentOS 5.7 doesn't have -h flag for sort. So I installed coreutils




Updated:
coreutils.x86_64 0:5.97-34.el5_8.1
Complete!


yet sort still doesn't have the -h flag. Am I not doing something,or doing something wrong? I'm fairly new to *nix.



From Mysql query output to retrieve files in the file system and rename the files


I have to call a SQL query from bash that outputs 1000 rows of two columns i) File_Path (Eg., /opt/files/dest/2.bin ii) Name_of_the_file(Eg., fax attachment.pdf, invoice.docx yes there are spaces). The file name in the server file system is in different naming format eg: 1.bin, 22.bin. There are <1000 unique files exactly as some are missing.


As a first step, I gathered all those files and put it in a temporary folder.


But I couldn't able to rename the files as I have to lookup the 'Name of the file' with corresponding 'File Path'. Is there any way I can perform the job?



why can't I receive mail send via mailx? [on hold]


As a new Linux user, I would like to send out emails using a software called bsd-mailx under debian terminal mode. I just installed bsd-mailx on my Debian Wheezy pogoplug box, and wrote out a test message to my Hotmail address as the following:



mailx recipient_user_name@hotmail.com


... control+ D


After that, I constantly check the incoming folder of my hotmail box and I still can't find any email in my Hotmail incoming folder. Why is that? What's wrong with mailx. Do I need to set up SMTP in mailx's configuration file? How can I use my local Debian machine as the SMTP server?



How can I programmatically access the contents of Dovecot Maildir in CentOS 7?


I just set up postfix and dovecot on a CentOS 7 server using this tutorial. I am able to successfully create a mail record using echo "TEST" | mail -s "testmail" youruser@localhost && tail -f /var/log/maillog. But how can I access and work with the resulting email files?


I need to configure a java program to process incoming email, including decomposing and processing attachment files. This could be done using either mysql or simply raw files. But I need to know where to have the java program look for the mail.


As per the tutorial, I set mail_location = maildir:~/Maildir in /etc/dovecot/conf.d/10-mail.conf. But when I type cd /home/youruser/Maildir, the terminal replies with -bash: cd: Maildir: Permission denied. Similarly, sudo cd /home/youruser/Maildir simply results in the terminal ignoring the command and remaining in whatever directory it was previously in.



Convert to WAV using FFMPEG for pipe into LAME?


I'm trying to convert an AAC file into WAV in order to pipe the output into LAME. I'm looking to do this, specifically:



find . -maxdepth 1 -type f -iname "*.m4a" | sort | while read file; do
ffmpeg -i "$file" -acodec pcm_s16le -ac 2 - | lame -b 256 -m s -q 0 - output.mp3
done


I get the following error:



Unable to find a suitable output format for 'pipe:'
Warning: unsupported audio format


Is there a way to specify the -acodec for the output? Reading the manpage now.


I know that I can convert to MP3 within FFMPEG, but that's not what I want to do ;)



Searching through C++ STL man pages without having to add "std::" every time


I have installed libstdc++6-4.7-doc on a machine with Ubuntu, so I could look up for things like std::pair from the command line.


Is there a way to search for the same std:: entries without specifying it? E.g. by typing man pair I would like to open the same man pages as typing man std::pair would open but only when there would no other man pages for these keyword.



Terminal output to file > NOT valid UTF-8 encoding


Redirecting text with special characters and accents from the Terminal to a file produces an invalid UTF-8 encoding and i have a problem when attempting to display these characters with a text editor.


for example:



$ echo ééé > test


img UTF-8 encoding



$ cat test


img UTF-8 encoding


I am using Manjaro xfce 0.8.11 / x86_64 and my locale.conf is LANG=fr_FR.UTF-8


When displaying other locales, such as Arabic or Chinese characters, I don't have this issue!


A similar issue from a user on the manjaro.fr forums : Problème encodage UTF-8 NON valide


any idea ?



Side buttons for mouse -- how to enable -- logs included


I have a mouse with two side buttons.


I've posted the output from xev and evtest for both buttons:


xev



EnterNotify event, serial 37, synthetic NO, window 0x4600001,
root 0x306, subw 0x0, time 5663259, (11,69), root:(799,121),
mode NotifyNormal, detail NotifyInferior, same_screen YES,
focus YES, state 0

KeymapNotify event, serial 37, synthetic NO, window 0x0,
keys: 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

---------------------------------------------------------------------------
---------------------------------------------------------------------------

EnterNotify event, serial 37, synthetic NO, window 0x4600001,
root 0x306, subw 0x4600002, time 5662311, (30,60), root:(818,112),
mode NotifyUngrab, detail NotifyVirtual, same_screen YES,
focus YES, state 0

KeymapNotify event, serial 37, synthetic NO, window 0x0,
keys: 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


evtest:



Event: time 1420063746.029705, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
Event: time 1420063746.029705, type 1 (EV_KEY), code 276 (BTN_EXTRA), value 1
Event: time 1420063746.029705, -------------- SYN_REPORT ------------
Event: time 1420063746.165669, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90005
Event: time 1420063746.165669, type 1 (EV_KEY), code 276 (BTN_EXTRA), value 0

------------------------------------------------------------------------------
------------------------------------------------------------------------------

Event: time 1420063746.165669, -------------- SYN_REPORT ------------
Event: time 1420063747.373693, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90004
Event: time 1420063747.373693, type 1 (EV_KEY), code 275 (BTN_SIDE), value 1
Event: time 1420063747.373693, -------------- SYN_REPORT ------------
Event: time 1420063747.533689, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90004
Event: time 1420063747.533689, type 1 (EV_KEY), code 275 (BTN_SIDE), value 0


How would one approach mapping these buttons to some virtual keys? For example, how would one map these buttons to act as back and forward ?



how to pass a password with a cron job safely?


I have a site map generator script placed in this URL



http://ift.tt/1zxIPEt


However this URL is protected with an username and a password in auth_type basic method.


I need to place a cron to access this URL once a week. So I've decided to use the curl command and placed the cron like below.



curl -u username:mypassword http://ift.tt/1zxIPEt


I'm aware that sending a password through http is insecure, however at least I'm trying to hide the password from server/hosting panel users from this curl command.


1) Are there any methods to hide the password in this curl command? I read something about placing a plain text file with the password in server and use it with the -k option. However I'm not in to place the password in a plain text file either.


2) Are there any other commands than curl to use for this specific purpose?



Crouton with more than one OS


ChromeOS


http://ift.tt/X9lnNC


Using sudo sh ~/Downloads/crouton -t xfce -r utopic I can install ubuntu 14.10 with the xfce interface, it says I can load it up on chromeos by running sudo startxfce4 . But if I want to install another version, sudo sh ~/Downloads/crouton -t xfce -r kali , it gives me the same exact command to run that. I can install as many OS's as I want, but how do you run the others if you install 2 OS's with xfce for example? Since I installed utopic first, that's the only one that opens.



Hard-drive errors


My /home file system is JFS, it got to RO mode several times already, so I had to reboot/remount it. I saw this at '/var/log/messages`:



Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925711] ata2.00: configured for UDMA/133
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925755] sd 1:0:0:0: [sda] Unhandled sense code
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925759] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925763] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925770] 72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925778] 0e 5a b2 b8
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925782] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925785] sd 1:0:0:0: [sda] CDB:
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925815] sd 1:0:0:0: [sda] Unhandled sense code
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925817] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925820] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925825] 72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925833] 00 00 00 00
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925836] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925839] sd 1:0:0:0: [sda] CDB:
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925863] sd 1:0:0:0: [sda] Unhandled sense code
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925865] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925868] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925872] 72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925879] 00 00 00 00
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925882] sd 1:0:0:0: [sda]
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925885] sd 1:0:0:0: [sda] CDB:
Dec 31 10:12:49 uvv-laptop-y570 kernel: [ 983.925908] ata2: EH complete

And smartctl -a /dev/sda gave me this:



SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x002f 200 200 051 Pre-fail Always - 0
3 Spin_Up_Time 0x0027 179 174 021 Pre-fail Always - 2008
4 Start_Stop_Count 0x0032 099 099 000 Old_age Always - 1005
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
7 Seek_Error_Rate 0x002e 200 200 000 Old_age Always - 0
9 Power_On_Hours 0x0032 082 082 000 Old_age Always - 13675
10 Spin_Retry_Count 0x0032 100 100 000 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 100 100 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 998
192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 37
193 Load_Cycle_Count 0x0032 001 001 000 Old_age Always - 810861
194 Temperature_Celsius 0x0022 106 091 000 Old_age Always - 41
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 1
198 Offline_Uncorrectable 0x0030 100 253 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0008 200 200 000 Old_age Offline - 0

Hard-drive model:



Model Family: Western Digital Scorpio Blue Serial ATA (Adv. Format)
Device Model: WDC WD7500BPVT-24HXZT3
Serial Number: WD-WX91A91R4010
LU WWN Device Id: 5 0014ee 601b831c9
Firmware Version: 03.01A03

Upd: I started another self-test (the first one I did several months ago) and got some updates:



SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Completed: read failure 90% 13680 229857912
# 2 Extended offline Completed without error 00% 9661 -
# 3 Extended offline Completed: read failure 90% 9654 96004576
# 4 Extended offline Completed: read failure 90% 9653 96004576

lines from #2 to #4 I already had before. I followed these guides: Badblock HOWTO and Debug the Filesystem. It seems the block is not reported as erroneous anymore, but it's not in Relocated blocks are not increased as well. The only thing that have been increased is Raw_Read_Error_Rate after I wrote zero to a bad block.


The questions is should I consider ordering a new hard-drive?



what is dhcpv6-client service in firewalld, and can i safely remove it?


In a CentOS 7 server, I type in firewall-cmd --list-all, and it gives me the following:



public (default, active)
interfaces: enp3s0
sources:
services: dhcpv6-client https ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:


What is the dhcpv6-client service? What does it do? And what are the implications of removing it?


I read the wikipedia page for dhcpv6, but it does not tell me specifically what this service on CentOS 7 Firewalld does.


This server is accessible via https and email via mydomain.com, but it is a private server that can only be accessed via https by a list of known ip addresses. In addition, this server can receive email from a list of known email addresses. Is the dhcpv6-client service required to reconcile the domain addresses from the known ip https requests and for exchanging the email with known email addresses?



iptables DNAT reply translation query


I'm confused while trying to understand the DNAT mechanism under below circumstance.


My understanding:


DNAT -> Destination Network Address Translation - Functionality which translates the dst address of the incoming packets --to--destination x.


I am facing difficulty in understanding the DNAT reply path.


For E.G


I have a machine (A) with an IP of x1 and wanted all connections/packets coming to this machine (dest y1) to get rerouted to another machine (B) with an IP address of z1.


So I added a new NAT rule as below:


iptables -t nat -A PREROUTING -s x1 -d y1 -j DNAT --to-destination z1.


Test on MACHINE A >ping -I x1 y1


if I run "tcpdump -i eth6 icmp" on machine A then getting an reply from IP "y1" instead z1?? or it is something that the un-NAT is performed based on the subnet mask ?


And when I monitored "tcpdump -i eth6 host z1" there isn't any incoming ping or packet.


Could someone clarify this scenario and my understanding ?


And also, is there anyway we can make this tcpdump if the packet is locally translated ?


Thanks in Advance.



adding a console target to GDM


In KDM, KDE's display manager, there's an option to exit the DM and login at the terminal. Gnome's display manager does not have this option.


Here's the entry for Cinnamon:



[Desktop Entry]
Name=Cinnamon
Comment=This session logs you into Cinnamon
Exec=cinnamon-session-cinnamon
TryExec=/usr/bin/cinnamon
Icon=
Type=Application


I think it should be easy enough to create a console entry, but what would or should I place in the Exec or TryExec fields of the entry?


I tried to google for how to do this, but this is all I got: but the post listed has no answers.


Does anyone know how to do this? I tried checking to see if there was a dedicated file for KDM where the console fall-back session mode was defined, but I didn't find any.



Permissions for dovecot and postfix in CentOS 7


I am using this tutorial to set up Postfix and Dovecot on a CentOS 7 web server. But when I try to send a test email using sudo echo "TEST" | mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillog, I get an error indicating that Dovecot does not have permissions to create the directory for storing the email. How do I go about setting up permissions for Dovecot and Postfix to be able to work properly in CentOS 7?


I am new to linux. I know about adduser, chmod, chown, octal permissions, and other commands, but I do not know how they all apply to this specific requirement, and I do not want to create ineffective things by experimenting without understanding.


Here is the most relevant part of the error message:



Error: user import: Initialization failed: Namespace '':
mkdir(/home/import/Maildir) failed:
Permission denied (euid=1001(import) egid=1001(import)
missing +w perm: /home/import, UNIX perms appear ok (ACL/MAC wrong?))


Here is the complete error message:



Dec 30 19:03:42 mydomain postfix/pickup[8093]: A22E78221C13: uid=1000 from=<anotherusername>
Dec 30 19:03:42 mydomain postfix/cleanup[8121]: A22E78221C13: message-id=<20141231000342.A22E78221C13@mydomain.com>
Dec 30 19:03:42 mydomain postfix/qmgr[8094]: A22E78221C13: from=<anotherusername@mydomain.com>, size=463, nrcpt=1 (queue active)
Dec 30 19:03:42 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, dir owned by 0:0 mode=0755)
Dec 30 19:03:42 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 19:03:42 mydomain postfix/local[8123]: A22E78221C13: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=0.15, delays=0.06/0.02/0/0.07, dsn=4.3.0, status=deferred (temporary failure)


EDIT#1:


I then ran sudo chown -R newusername:newusername /home/newusername and then again repeated sudo echo "TEST" | mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillog but still got the following error:



Dec 30 20:22:29 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:22:29 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:22:29 mydomain postfix/local[8450]: A22E78221C13: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=4727, delays=4727/0/0/0.08, dsn=4.3.0, status=deferred (temporary failure)
Dec 30 20:24:08 mydomain postfix/pickup[8093]: E0DF28221C14: uid=1000 from=<anotherusername>
Dec 30 20:24:08 mydomain postfix/cleanup[8491]: E0DF28221C14: message-id=<20141231012408.E0DF28221C14@mydomain.com>
Dec 30 20:24:08 mydomain postfix/qmgr[8094]: E0DF28221C14: from=<anotherusername@mydomain.com>, size=463, nrcpt=1 (queue active)
Dec 30 20:24:08 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:24:08 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:24:09 mydomain postfix/local[8450]: E0DF28221C14: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=0.13, delays=0.07/0/0/0.06, dsn=4.3.0, status=deferred (temporary failure)


Note that the preceding log leaves the terminal in an un-returnable state. I try :q and Ctrl-X, but am not able to get another prompt, so I have to close the terminal window and log in again to be able to get another command prompt. Help fixing that would be much appreciated.


The output of dovecot -n is:



# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-123.13.1.el7.x86_64 x86_64 CentOS Linux release 7.0.1406 (Core)
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_location = maildir:~/Maildir
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
mbox_write_locks = fcntl
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
driver = pam
}
plugin {
sieve = ~/.dovecot.sieve
sieve_dir = ~/sieve
}
postmaster_address = me@someotherdomain.com
ssl = required
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
userdb {
driver = passwd
}


EDIT#2


Typing sudo echo "TEST" | sudo mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillog gave the following:



Dec 30 20:42:29 mydomain postfix/qmgr[8094]: E0DF28221C14: from=<anotherusername@mydomain.com>, size=463, nrcpt=1 (queue active)
Dec 30 20:42:29 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:42:29 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:42:29 mydomain postfix/local[8531]: E0DF28221C14: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=1101, delays=1101/0.02/0/0.06, dsn=4.3.0, status=deferred (temporary failure)
Dec 30 20:45:40 mydomain postfix/pickup[8529]: CF3CB80B33C4: uid=0 from=<root>
Dec 30 20:45:40 mydomain postfix/cleanup[8551]: CF3CB80B33C4: message-id=<20141231014540.CF3CB80B33C4@mydomain.com>
Dec 30 20:45:40 mydomain postfix/qmgr[8094]: CF3CB80B33C4: from=<root@mydomain.com>, size=455, nrcpt=1 (queue active)
Dec 30 20:45:40 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:45:40 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:45:40 mydomain postfix/local[8553]: CF3CB80B33C4: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=0.15, delays=0.08/0.02/0/0.05, dsn=4.3.0, status=deferred (temporary failure)


What is the difference between letting nohup append to 'nohup.out' and explicitly redirecting it to a file?


Consider the following scenario:


tail.sh:



#!/bin/bash
tail -f test.txt


invoke.sh:



#!/bin/bash
nohup ./tail.sh &


invoke_explicitredirect.sh:



#!/bin/bash
nohup ./tail.sh > out.log &


Running both in a terminal has the same effect:



  • I regain control of the terminal after running ./tail.sh

  • No output from tail appears on the terminal


However, when running it using ssh (e.g. ssh <user>@<hostname> "<script>"):



  • invoke_explicitredirect.sh returns control to ssh (and terminates)

  • invoke.sh hangs until I send a SIGINT


man nohup states that nohup will automatically redirect output to 'nohup.out' if possible:



If standard output is a terminal, append output to 'nohup.out' if possible, '$HOME/nohup.out' otherwise.


What is the difference between letting nohup append to nohup.out and explicitly redirecting the output?



Building tree diagram [on hold]


Suppose I have a program P11 in a directory; it calls 2 other programs P21 & P22. Each of P21 & P22 call 2-2 other programs.


i.e.



Level-1: |--------------P11-------------|
Level-2: |--------P21----------| |----------P22----------|...
Level-3: P31 P32 P33 P34...
. . . .
. . . .


Just like a tree diagram having 100s of levels, 100s of nodes at each level and 1000s of nodes in total.


I need a shell script which will give me such a tree structure.


e.g. The shell script program is – ‘MYPGM.sh’.


It takes a parameter at runtime. We can provide a program name here e.g. P11. And the script gives such a tree diagram.


Not necessary that the output structure should be in such a diagram like format as given above. We can use indexing or anything you suggest. e.g. The output file could be as –



1. P11
1.1 P21 - 1.2 P22
1.1.1 P31 - 1.1.2 P32 – 1.2.1 P33 – 1.2.2 P34


i.e. Every program's index = it's parent's index + "." + its serial number in that parent program.


Just the thing is – the number of levels & number of nodes in each level is unknown, but very large.


The program syntax used to call another program is as below.:


CALL "CHILD_PGM_NAME"


Command to find the children programs in a given program is as below.:



egrep '^CALL| CALL ' $pgm_name > call_output | cut -d'"' -f2 call_output > call_output_cut | cat call_output_cut


I am stuck at - how to loop this command to get the above stated output file.


Can anybody suggest something?



Feed source command with a pipe


This might seem a really unqualified question but maybe that's because it is.


Previously I used source command like this:



source file_name


But what I'm trying to do is this:



echo something | source


Which doesn't work.



/etc/X11/xorg.conf.d missing?


Is xorg.conf.d no longer used by Arch Linux? If so, does anyone know where the configuration files that once lived under said directory now reside?



how to compile and correct this app.c [on hold]


this is not correct ,i do not why so please can you help me



#include<stdlib.h>
#include<stdio.h>
#include<unistd.h>
#include<semaphore.h>
#include<pthread.h>

sem_t mutex;
sem_t vide;
sem_t plein;
#define N 3
#define VRAI 1
pthread_t prod,cons;
int tampon[N];
int libre=0, prochain=0;
void*producteur(void*arg)
{
int objet;
while(VRAI){
objet=1+(int)(100.0*rand()/(RAND_MAX+1.0));
sem_wait(&vide);
sem_wait(&mutex);
tampon[libre]=objet;
printf("Prod:tampon[%d]=%d/n",libre,objet);
libre=(libre+1)%N;
sem_post(&mutex);
sem_post(&plein);
}
return(NULL);
}
void*consommateur(void*arg)
{
int objet;
while(VRAI){
sem_wait(&plein);
sem_wait(&mutex);
objet=tampon[prochain];
printf("Cons:tampon[%d]=%d/n",prochain,objet);
prochain=(prochain+1)%N;
sem_post(&mutex);
sem_post(&vide);
sleep(2);
}
return(NULL);
}
int main(int argc,char**argv)
{
sem_init(&mutex,0,1);
sem_init(&vide,0,N);
sem_init(&plein,0,0);
pthread_create(&prod,NULL,producteur,NULL);
pthread_create(&cons,NULL,consommateur,NULL);
pthread_join(&prod,NULL);
pthread_join(&cons,NULL);
return 0;
}


Wait for command line prompt in PHP


I am looking for a solution that allows a PHP script to send multiple commands when prompted. When the following code is executed from the shell:



root@host [~]# /usr/local/bin/grads-2.0.2/bin/grads -b


This output results:



Grid Analysis and Display System (GrADS) Version 2.0.2
Copyright (c) 1988-2011 by Brian Doty and the
Institute for Global Environment and Society (IGES)
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information

Config: v2.0.2 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn geotiff shapefile
Issue 'q config' command for more detailed configuration information
Landscape mode? ('n' for portrait):


As you can see, the script is waiting for y/n input. When y/n is typed, the following output results:



Landscape mode? ('n' for portrait): y
GX Package Initialization: Size = 11 8.5
Running in Batch mode
ga->


The script then waits for any further commands until it can be quit with the 'quit' command. 'quit' results in the following output:



ga-> quit
No hardcopy metafile open
GX package terminated
root@host [~]#


My issue arises however when I try to do this through PHP. My code is as follows:



$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
);
$cwd = '/';
$process = proc_open('/usr/local/bin/grads-2.0.2/bin/grads -b', $descriptorspec, $pipes, $cwd);
if (is_resource($process)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// Any error output will be appended to /tmp/error-output.txt
fwrite($pipes[0], 'y');
fclose($pipes[0]);
echo stream_get_contents($pipes[1]);
fclose($pipes[1]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
$return_value = proc_close($process);
}


However, this is the output all at once:



Grid Analysis and Display System (GrADS) Version 2.0.2
Copyright (c) 1988-2011 by Brian Doty and the
Institute for Global Environment and Society (IGES)
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information

Config: v2.0.2 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn geotiff shapefile
Issue 'q config' command for more detailed configuration information
Landscape mode? ('n' for portrait): GX Package Initialization: Size = 11 8.5
Running in Batch mode
ga-> [EOF]
No hardcopy metafile open
GX package terminated


As you can see, the script is racing along without waiting for input...what modifications do I need to make to the PHP code to fix this? Any help would be greatly appreciated...my commands work fine at the command line so this is the only thing holding my application back.



grep invading my ps


When I'm checking for some process, I usually write



ps aux | grep myprocess


And sometimes I get the output of



eimantas 11998 0.0 0.0 8816 740 pts/0 S+ 07:45 0:00 grep myprocess


if the process is not running.


Now I really wonder why grep is in the list of processes if it filters out the output of the ps command after ps has run?



Echoing stdin when running an ed(1) script


Given the following ed script,



$ cat helloworld
a
hello
world
.
,n
,s,o,O,g
,n
Q


I would like to obtain somehow the interactive output



$ ed
a
hello
world
.
,n
1 hello
2 world
,s,o,O,g
,n
1 hellO
2 wOrld
Q
$


instead of the expected



$ cat helloworld | ed
1 hello
2 world
1 hellO
2 wOrld
$


Is that possible, maybe using a third-party utility? Thanks in advance!


Edit: I guess I should add some motivation. I would like to produce some sample ed sessions, and probably save them with script(1). If this process is performed "live", any modifications would basically imply typing the whole tutorial again (bad) or alternatively "figuring out" the output, potentially based on a long editing session (worse).



terminal linux calendar specify used calendar file


I´m playing around with linux calendar


My aim is that all users can run a script which does nothing more than adding a givven argument in 10 days as cal item



// called like this: reminder "Meeting with Frank"
// will add a calendar item in 10 days


#!/bin/bash

remdate=$(date +"%m/%d" -d "10 days")
echo -e "$remdate\t$1" >> /etc/.calendar/calendar


All users have permissions for /etc/.calendar/calendar


The calendar will run by cron to inform about todays meetings:



calendar|mail -s "do not forget" xy@example.com
or
calendar -f /etc/.calendar/calendar |mail -s "do not forget" xy@example.com


But how do I tell calendar to not use the users calendar file (~/.calendar) or in /usr/share/calendar but the one I´m writing to? (tried -f and I´m confused with /usr/share/calendar and CALENDAR_DIR)


thanks



Protecting process's envvars from exposure


From I've read about current best practices for developing web applications (such as the Twelve Factor guide), the recommended approach for storing configuration data is within environment variables. This is specifically contrasted from keeping them inside configuration files, as those are often accidentally checked into the project's repository, breaking the "code/config" separation, and potentially exposing secrets (such as API keys, salts, etc.).


However, what I haven't seen addressed is the defense against accidental exposure. When using configuration files, one can set up file permissions accordingly, preventing anyone but specific users from reading the secret configuration. But Unix systems do not seem to offer such protection for the environment variables of a process -- even if the process is started by different user:



$ sudo -u root x=5 sleep 30
$ ps au -E | grep sleep # in different terminal
root 53814 s003 S+ 0:00.01 sudo -u root x=5 sleep 30


Should the x variable contain sensitive data, it would be possible to read it just by having login access to the machine, as any user (not necessarily as root, or the user who started the process we want to snoop on). Therefore, this approach to config seems less secure (from the defense-in-depth PoV; obviously, the machine should be protected from unauthorized access) than configuration files -- unless we can somehow protect the environment variables.


My question is thus: is there a way to prevent other users on the same Unix system from seeing the environment variables of a process (through ps a -E and any other possible means)?



PulseAudio does not recognise Bluetooth after discovery


I'm trying to use a Bluetooth speaker with my Lubuntu (Ubuntu 14.04.1 LTS).


The bluetooth device itself is connected and I get the following lines from pulseaudio in vvvv mode:



D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.AudioSink, path=/org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: Device /org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5 interface org.bluez.AudioSink property 'State' changed to value 'connecting'
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Audio, path=/org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: Device /org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5 interface org.bluez.Audio property 'State' changed to value 'connecting'
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Device, path=/org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.AudioSink, path=/org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.AudioSink, path=/org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: Device /org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5 interface org.bluez.AudioSink property 'State' changed to value 'connected'
D: [pulseaudio] bluetooth-util.c: dbus: interface=org.bluez.Audio, path=/org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5, member=PropertyChanged
D: [pulseaudio] bluetooth-util.c: Device /org/bluez/843/hci0/dev_0C_A6_94_B1_C1_C5 interface org.bluez.Audio property 'State' changed to value 'connected'


But nothing beyond this point happens. No output device appears in pavucontrol, system continues to use internal speaker as output and when I disconnect the bluetooth device I can see "Connected" status in the above log changes to "Disconnected".


pactl confirms that module-bluetooth-discover and module-bluetooth-policy (and for good measures module-switch-on-connect) are running and apt-get confirms that all of them are latest version.


Any help or clue would be appreciated.



capture tmux screen and process with shell command


is there a way to capture text currently on the screen of a tmux session and pipe it into a shell command then display the output?


I was hoping to use something like this with Oracles sqlplus to do keyword expansion. I only have access to tmux 1.5 and the stock sqlplus. I do have access to perl 5.14 and python 3.4


best regards,


Ty



How to PlayPause with dbus-send


How do I send a PlayPause() command to the whaterver mpris MediaPlayer2 instance is currently playing? I imagine there is some command for dbus-send. It's probably similar to this one which only works with Spotify:



dbus-send --print-reply \
--dest=org.mpris.MediaPlayer2.spotify \
/org/mpris/MediaPlayer2 \
org.mpris.MediaPlayer2.Player.PlayPause


Network through bridge in VM is pretty unstable


I install CentOS through VirtualBox and want to use bridge to use the network. But the network is pretty unstable and when I ping the gateway, the response is pretty slow. How can I improve this?



How to properly build a minimal FreeBSD kernel?


Is there any proper way to build a minimal kernel for FreeBSD? The FreeBSD Handbook has the lack of information about this. By default /boot/kernel directory has the pretty big size - around 450MB. I want to minimize kernel fingerprint and remove all unnecessary kernel modules and options. Should I use "NO_MODULES" option in /etc/make.conf? Or use C compilation flags?



CentOS 6.5 and Ubuntu 14.04 Vagrant VMs getting assigned domain name


I'm provisioning a CentOS 6.5 and Ubuntu 14.04.1 LTS VM with Vagrant running under VirtualBox. I'm using Vagrantfiles to set the hostnames and IPs, but when I boot them, for example, instead of server1 the FQDN becomes server1.domain.com. The host machine is a Windows Machine on an Active Directory domain (domain.com). I just want the FQDN to be server1 with no domain name. How can I achieve this, preferably using just the Vagrantfiles?


Here is one of the Vagrantfiles



Installing Arch on RAID, LUKS, LVM, Btrfs?


I am struggling with setting up an encrypted NAS for some days now. The basic plan is to have btrfs on lvm on luks on raid1 with lvmcache in writeback mode thrown in for the root partition to reduce disk access.


TL;DR:


After setting up the partitions and filesystems GRUB fails to install with:



grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..
grub-install: error: embedding is not possible, but this is required for RAID and LVM install.




Partitions


Following the Arch Wiki I start by setting up the partitions:


gdisk output for /dev/sda and /dev/sdb:



Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9EFA6587-E34F-4AC1-8B56-5262480A6C6A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number Start (sector) End (sector) Size Code Name
1 2048 4095 1024.0 KiB EF02 BIOS boot partition
2 4096 976773134 465.8 GiB 8300 Linux filesystem


Note the BIOS boot partition that is apparently required by GRUB when installing in BIOS/GPT mode.


MDADM


As I have two disk I want them in a RAID1 array:



mdadm --create --level=1 --raid-devices=2 /dev/md0 /dev/sda2 /dev/sdb2

root@archiso ~ # mdadm --detail --scan
ARRAY /dev/md0 metadata=1.2 name=archiso:0 UUID=bdfc3fea:f4a0ee6d:6ac08012:59ea384b

root@archiso ~ # cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb2[1] sda2[0]
488253440 blocks super 1.2 [2/2] [UU]
[>....................] resync = 2.0% (9832384/488253440) finish=96.6min speed=82460K/sec
bitmap: 4/4 pages [16KB], 65536KB chunk

unused devices: <none>


LUKS


Next I setup a LUKS volume on top of the RAID:



root@archiso ~ # cryptsetup luksFormat /dev/md0

WARNING!
========
This will overwrite data on /dev/md0 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter passphrase:
Verify passphrase:


root@archiso ~ # cryptsetup luksOpen /dev/md0 md0-crypt
Enter passphrase for /dev/md0:


LVM


Btrfs snapshots could be used instead of LVM, but as of writing this there is no way to add a SSD caching device to Btrfs. So I opted to use LVM and add the SSD via lvmcache later:


(Creating the volume group in one step:)



root@archiso ~ # vgcreate vg0 /dev/mapper/md0-crypt
Physical volume "/dev/mapper/md0-crypt" successfully created
Volume group "vg0" successfully created

root@archiso ~ # lvcreate -L 100M -C y vg0 -n boot
Logical volume "boot" created.
root@archiso ~ # lvcreate -L 20G vg0 -n root
Logical volume "root" created.
root@archiso ~ # lvcreate -L 10G vg0 -n var
Logical volume "var" created.
root@archiso ~ # lvcreate -L 6G -C y vg0 -n swap
Logical volume "swap" created.
root@archiso ~ # lvcreate -l +100%FREE vg0 -n home
Logical volume "home" created


Resulting in the following layout:



root@archiso ~ # lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
boot vg0 -wc-a----- 100.00m
home vg0 -wi-a----- 429.53g
root vg0 -wi-a----- 20.00g
swap vg0 -wc-a----- 6.00g
var vg0 -wi-a----- 10.00g


Btrfs/Filesystems


Creating the filesystems:



root@archiso ~ # mkfs.ext4 /dev/vg0/boot
root@archiso ~ # mkfs.btrfs /dev/vg0/home
root@archiso ~ # mkfs.btrfs /dev/vg0/root
root@archiso ~ # mkfs.btrfs /dev/vg0/var


(ext4 was chosen for boot because btrfs complains about the small partition size.)


Mounting the filesystems:



root@archiso ~ # swapon /dev/vg0/swap
root@archiso ~ # mount /dev/vg0/root /mnt/arch -o compress=lzo
root@archiso ~ # mount /dev/vg0/home /mnt/arch/home -o compress=lzo
root@archiso ~ # mount /dev/vg0/var /mnt/arch/var -o compress=lzo
root@archiso ~ # mount /dev/vg0/boot /mnt/arch/boot


Installing Arch


Actually I just copy the system from a previous backup:



root@archiso ~ # rsync -Pa /mnt/bkp/sda/* /mnt/arch


(coffee break)


Setting up mdadm.conf and fstab



root@archiso ~ # genfstab -U /mnt/arch > /mnt/arch/etc/fstab
root@archiso ~ # cat /mnt/arch/etc/fstab
# /dev/mapper/vg0-root
UUID=62ebf0c9-bb37-4b4e-87dd-eb8a4ace6a69 / btrfs rw,relatime,compress=lzo,space_cache 0 0

# /dev/mapper/vg0-home
UUID=53113e11-b663-452f-b4da-1443e470b065 /home btrfs rw,relatime,compress=lzo,space_cache 0 0

# /dev/mapper/vg0-var
UUID=869ffe10-7a1c-4254-9612-25633c7ae619 /var btrfs rw,relatime,compress=lzo,space_cache 0 0

# /dev/mapper/vg0-boot
UUID=d121a9df-8c03-4ad9-a6e0-b68739b1a358 /boot ext4 rw,relatime,data=ordered 0 2

# /dev/mapper/vg0-swap
UUID=29035eeb-540d-4437-861b-c30597bb7c16 none swap defaults 0 0

root@archiso ~ # mdadm --detail --scan >> /mnt/arch/etc/mdadm.conf
root@archiso ~ # cat /mnt/arch/etc/mdadm.conf
[...]
ARRAY /dev/md0 metadata=1.2 name=archiso:0 UUID=bdfc3fea:f4a0ee6d:6ac08012:59ea384b


Chrooting into the system



root@archiso ~ # arch-chroot /mnt/arch /bin/bash
[root@archiso /]#


mkinitcpio.conf


These hooks were added: mdadm_udev encrypt lvm2 btrfs



[root@archiso /]# mkinitcpio -p linux


Configuring GRUB


Now for the interesting (and failing) part, I chose GRUB as my bootloader as it should support all of the contraptions that I use.


References: * http://ift.tt/1uTkZon * http://ift.tt/1Bjoqpx


Changed parts in /etc/default/grub:



GRUB_CMDLINE_LINUX="cryptdevice=/dev/md0:vg0"
GRUB_ENABLE_CRYPTODISK=y


Installing grub:



[root@archiso /]# grub-install --target=i386-pc --recheck /dev/sda
Installing for i386-pc platform.
/run/lvm/lvmetad.socket: connect failed: No such file or directory
WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
/run/lvm/lvmetad.socket: connect failed: No such file or directory
WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
/run/lvm/lvmetad.socket: connect failed: No such file or directory
WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..
grub-install: error: embedding is not possible, but this is required for RAID and LVM install.


(--debug output available here)


Frankly ... I have no idea what's the problem here. In BIOS/GPT mode GRUB should embed it's core.img into the ef02/BIOS boot partition shouldn't it?


Edit


http://ift.tt/13SQkx6 doesn't apply here:



[root@archiso /]# btrfs fi show --all-devices
Label: none uuid: 62ebf0c9-bb37-4b4e-87dd-eb8a4ace6a69
Total devices 1 FS bytes used 965.77MiB
devid 1 size 20.00GiB used 3.04GiB path /dev/mapper/vg0-root

Label: none uuid: 869ffe10-7a1c-4254-9612-25633c7ae619
Total devices 1 FS bytes used 339.15MiB
devid 1 size 10.00GiB used 3.04GiB path /dev/mapper/vg0-var

Label: none uuid: 53113e11-b663-452f-b4da-1443e470b065
Total devices 1 FS bytes used 384.00KiB
devid 1 size 429.53GiB used 2.04GiB path /dev/mapper/vg0-home

Btrfs v3.17.3


How to install ALX drivers for an AR8171 network adaptor in OMV


I bought a shiny new ASRock FM2A88X Extreme4+ motherboard (which I chose specifically for the plentiful expansion slots) to run my shiny new file server. During the installation of Open Media Vault, the installer failed to identify the network adaptor (according to the ASRock website, a Qualcomm Atheros AR8171 ). Googling lead me to believe it uses the ALX driver. I selected the entry in the installer, however it failed to initialise. I decided to try a manual install of an updated driver, so downloaded the latest Backports Driver Pack for the ALX driver (via my desktop mackine onto a USB stick). However when I went to compile it on the OMV server, it complained saying MAKE isn't installed. To add salt to injury, when I tried to download MAKE, the installation instructions give direction to make MAKE (which I cannot do without MAKE installed).


For the life of me I cannot find a stand-alone installer (such as a .deb file) for the ALX driver. All other instructions I've found online need an internet connection to do (adding sources etc) which I cannot do without a working network adaptor!


Does anyone out there know how to fix this??



mardi 30 décembre 2014

Use curl to send binary file through POST with content-type multipart/form-data;


A post request is made to:



http://www.example.com/example/


and the post data is as follows:



------WebKitFormBoundaryB8NNdk2kNdndnnn
Content-Disposition: form-data; name="picture[uploaded_data]"; filename="picture.jpg"
Content-Type: image/jpeg

binarydatagoeshere
------WebKitFormBoundaryB8NNdk2kNdndnnn--


So my question is, how can i use curl to do this exact same thing with the binary data of picture.jpg? I know of --data-binary @myfile.bin, but this is completely different and in this case the string after Boundary e.g B8NNdk2kNdndnnn in this case needs to be valid for the request to go through. So how do i do all this using curl?



What is the /boot partition really for?


I'm reading a relatively old text on Linux partitions and file systems (the LPIC 1 Certification Bible). It says:



Some versions of the Linux boot loaders cannot access a kernel that is outside the first 1024 cylinders on a disk. By putting the /boot partition at the beginning of the drive you can be assured of not having a problem when accessing the kernel at boot. This problem shows itself most often in cases of dual booting Linux along with another operating system that is on the first partition.



Why would a Linux distribution have "no access to the kernel outside the first 1024 cylinders on a disk"?


Also, what does "putting the /boot partition at the beginning of the drive" mean?



What are the implications of using an inode_ratio of 16384 in terms of storage use on ext4?


I'm assuming that this means that if the average file stored (including directories etc) is less than 16384 bytes, it may be possible to run out of inodes before using the full storage capacity of the filesystem. However, should the files being stored consume over 16384 bytes, on average, a physical space storage limit should be reached before one would run out of inodes.



npm style OS package manager. Packages local to a directory


Is there any distro or package manager with the following npm-like characteristics?:




  • Packages are installed to their own directory, chosen by the user at install time. As opposed to packages spilling their stuff all over different directories (/bin /usr/bin /etc/ ...)




  • Dependencies are contained in the local environment of a package. Clearly this is strongly coupled with the resolution of resources at runtime, which in unix is given by $PATH and conventions. In node dependencies are contained in nested subdirectories under $PKGDIR/node_module/$DEPPKG. This is only sustainable because the packages are very small, but there is a feature to link packages to other places in the filesystem. This could be the default.




What attracts me most about npm's system is that everything is local, so it is easy to reason about in isolation. There is no implicit global environment to worry about. You get user level installations and multiple versions of the same package for free. It is interesting (and in my opinion a pitty) how the idea of encapsulation has clearly impacted programming practices, but not the environments in which applications will ultimately be run.


I realize this goes against half of what unix is currently: The FSH, $PATH and other enviroment variables as a way of setting the environment, etc. However, I would argue that it is closest to the Unix filosophy, in the sense that (in my opinion) it is simpler.


Note: I'm closer to the noob side in the noob->beard spectrum. This is based more on more speculation than experience. If you think the whole idea is stupid, or you see some fundamental problem with it, please tell me why. Thanks.


Edit: Sorry to broaden an already broad question, ignore this if you like: I know little about compilation, shared libraries, etc. Is this only possible for npm because javascript is interpreted? Are there any issues with compiled languages (C, most importantly) that would make this impossible or very hard?



How to install ALX drivers for an AR8171 network adaptor in OMV


I bought a shiny new ASRock FM2A88X Extreme4+ motherboard (which I chose specifically for the plentiful expansion slots) to run my shiny new file server. During the installation of Open Media Vault, the installer failed to identify the network adaptor (according to the ASRock website, a Qualcomm Atheros AR8171 ). Googling lead me to believe it uses the ALX driver. I selected the entry in the installer, however it failed to initialise. I decided to try a manual install of an updated driver, so downloaded the latest Backports Driver Pack for the ALX driver (via my desktop mackine onto a USB stick). However when I went to compile it on the OMV server, it complained saying MAKE isn't installed. To add salt to injury, when I tried to download MAKE, the installation instructions give direction to make MAKE (which I cannot do without MAKE installed).


For the life of me I cannot find a stand-alone installer (such as a .deb file) for the ALX driver. All other instructions I've found online need an internet connection to do (adding sources etc) which I cannot do without a working network adaptor!


Does anyone out there know how to fix this??



tails live usb, problem with french locale


This is my first linux distribution, I like this one because I can use it on any computer with live usb.


Problem is I cant make those characters ?./§%µ¨£1234567890°+, on a french keybord you use majLock or shift and the press a key in order to make those. However shift+key will only print the regular character.


shift is working since I can make < and > (> is done with shift+<).


I have no idea what to do. could you help me out?



Email using shell script using email address from external flat file


I'm using alexkowalski script from Email using shell script



MAILADDR=(mail1@example.com, mail2@example.com, mail3@example.com)
for i in "${MAILADDR[@]}"
do
echo "Mail test..." | mail -s "Mail test subject..." $i
done


My question is how to read MAILADDR array from an external flat file?


And how to insert an external flat file replacing the body of the email as in



echo"/home/user/information-for-any-user.txt" | mail -s "Mail test subject..." $i ??


Get password login for opensuse 13.2?


Hello I am using OpenSuse 13.2 KDE How to get login protected ie. Password when i switch on my system i go directly on on (without password vitrifaction )



Recover dokuwiki directory in debian


I accidentally deleted all the content of the dokuwiki directory and want to restore it not with a Linux (Debian) command. In the directory of dokuwiki far as i know mainly .txt files are located. How can I restore them?


I took a look to the scalpel and foremost but i don't know how to handle the .txt files in the configuration.


Thank you in advance for the help.


Regards couda



Problems booting Kali Linux 1.0.9a 64 bit on Macbook Pro


I have a mid 2009 Macbook Pro that I am trying to dual boot OS X and Kali Linux on. I replaced my optic drive with my old HDD and replaced my HDD with an SSD. OS X and my apps are running off of the SSD. My HDD is almost out of space, but my SSD has about 60GB free. I have installed rEFInd and I am using it to boot into Kali Linux by DVD. I am able to have it start to boot through the first Live option, but when it reaches the following line, it stops executing:


nouvea [DRM] mm: using CRYPT for buffer copies


I have partitioned my hard drive, formatted for MS-DOS, and I have tried re-downloading the .iso and burning it to another DVD. Neither method has worked. Any help would be greatly appreciated.



Warn about password expiration without forcing change


It's pretty simple. I would like to figure out what combination of changes in /etc/login.defs and/or /etc/pam.d/system-auth-ac I would need to perform to allow the following behavior:




  • I want a user's password to be valid for 60 days.




  • After 60 days, the system needs to yell at the user when they log in, telling them they need to change their password ASAP.




  • The system must not impede the user's access to the system.




  • This must apply to existing users (non-system accounts, UID >=500) as well as any newly-created users.




Rationale: Limited users will not be managing the system account passwords, only system admin(s). Therefore, users should not have their access to the system impeded because the admin missed a password change. The number of accounts is rather small (maybe 9 or 10), but we're all human and we forget to do stuff from time to time.


I'm not sure if login.defs or PAM offer this. The documentation leads me to believe that you can either have the system force the user to change their password when it expires, or you can have the password not age at all. A third option is to have the password age limit set to some huge amount, like 9,999 days, and then start warning the user that their password will expire in 9,936 days, but that's not really what I need either. I've done other kinds of PAM configuration, so it's not my first trip around the block. I'm just stuck on this problem.


So, can this be done with PAM/login.defs, or do I need another utility that can take their place?



seek function in unix


I try to understand the seek(2) function from Unix version 6.


This example:



seek(0,0,2)


So the first argument is the file descriptor. And 0 would be the standard input. The second argument is the offset, which is 0. And the third argument tells us according to man page "the pointer is set to the size of the file plus offset."


But why would you do this? Why would you point after the file?


The line is from the source code.



Error getting the string between two patterns


I want to get a string between two patterns. The pattern is the first environment <p> </p> in an html file.



<p>Sorcery,
R (1)
</p>
<p class="ctext"><b>As an additional cost to cast Goblin Grenade, sacrifice a Goblin.<br><br>Goblin Grenade deals 5 damage to target creature or player.</b></p>


<p><i>Don't underestimate the aerodynamic qualities of the common goblin.</i></p>
<p>Illus. Kev Walker</p>


That environment is the first of the file so I discard everything matched until the <p> and I want to delete everything after the </p>.



name="goblin grenade"
wget -O- http://magiccards.info/query?q="$name" | grep -oP '<p>\K[^<]+'


I don't know why it doesn't work properly. I get



Sorcery,
Illus. Kev Walker


How to influence the assignment of subordinate UIDs/GIDs when creating user accounts?


To my knowledge the subordinate UIDs and GIDs are assigned to accounts in such a manner that they form a contiguous range.


The range starts at 100000 by default and probably stretches to the theoretical maximum value for a UID/GID (even though I haven't found a way to query this from the shell, /etc/login.defs only lists the values allowed for the tools).


Now, it'd be a lot more convenient for me as a human if the ranges would start at a multiple of 100000, i.e. n*100000 with n being a positive integer (n>0), instead of 100000+n*65536. This way I'd be able to see immediately which file is owned by which host user.


Is there a way to influence the assignment of subordinate UIDs/GIDs in some way in modern enough shadow-utils to achieve a more human-readable assignment?


If not, is it alright to simply overwrite the files /etc/subuid and /etc/subgid with conforming data to get what I want?



How to install PyQT4 on FreeBSD?


I need to run an application that uses PyQT4 on FreeBSD 10. I searched ports, but could not identify any package for PYQT4. Which package will install this?



Why did Ubuntu 14.04 installation removed my Windows?


I was required to reinstall Ubuntu 14.04 on a dual-boot Lenovo laptop. During the install I choose the option 'remove Ubuntu 14.04.1 and install Ubuntu 14.04' which in the end removed my Windows installation.


Does the Ubuntu installer no longer check if something else is installed? How to recover my Windows now?



Why urxvtc doesn't accetp zsh functions when called with a "-c" argument?


In order to launch a new terminal and run a zsh function on it, I am trying to run the following command from within an urxvtc terminal (the urxvtd is running as a systemd service)



urxvtc -e zsh -c "my-zsh-defined-function"


which doesn't work as the function is unknown. I need to explicitly source my zshrc to make it work



urxvtc -e zsh -c "source ~/.zshrc; my-zsh-defined-function"


The problem is, I don't understand why. Shouldn't zsh source .zshrc as when I run urxvtc, and then I type my-zsh-defined-function ?



An existing mdadm RAID5 is not mounting, Either a problem drive or Superblock


I have 4 x 3TB NAS setup as RAID5 which has been working great for almost a year.


After a recent abrupt shutdown (had to hit the power button) the RAID will no longer mount on boot up.


I've run:


mdadm --examine /dev/sd[bcdefghijklmn]1 >> raid.status


The output is below:



/dev/sda:

Magic : a92b4efc

Version : 1.2

Feature Map : 0x0

Array UUID : 7d2a94ca:d9a42ca9:a4e6f976:8b5ca26b

Name : BruceLee:0 (local to host BruceLee)

Creation Time : Mon Feb 4 23:07:01 2013

Raid Level : raid5

Raid Devices : 4


Avail Dev Size : 5860271024 (2794.40 GiB 3000.46 GB)

Array Size : 8790405888 (8383.18 GiB 9001.38 GB)

Used Dev Size : 5860270592 (2794.39 GiB 3000.46 GB)

Data Offset : 262144 sectors

Super Offset : 8 sectors

State : active

Device UUID : 2c1e0041:21d926d6:1c69aa87:f1340a12


Update Time : Sat Dec 27 20:54:55 2014

Checksum : d94ccaf5 - correct

Events : 17012


Layout : left-symmetric

Chunk Size : 128K


Device Role : Active device 0

Array State : AAA. ('A' == active, '.' == missing)

/dev/sdb:

Magic : a92b4efc

Version : 1.2

Feature Map : 0x0

Array UUID : 7d2a94ca:d9a42ca9:a4e6f976:8b5ca26b

Name : BruceLee:0 (local to host BruceLee)

Creation Time : Mon Feb 4 23:07:01 2013

Raid Level : raid5

Raid Devices : 4


Avail Dev Size : 5860271024 (2794.40 GiB 3000.46 GB)

Array Size : 8790405888 (8383.18 GiB 9001.38 GB)

Used Dev Size : 5860270592 (2794.39 GiB 3000.46 GB)

Data Offset : 262144 sectors

Super Offset : 8 sectors

State : active

Device UUID : a0261c8f:8a2fbb93:4093753a:74e7c5f5


Update Time : Sat Dec 27 20:54:55 2014

Checksum : 7b84067b - correct

Events : 17012


Layout : left-symmetric

Chunk Size : 128K


Device Role : Active device 1

Array State : AAA. ('A' == active, '.' == missing)

/dev/sdc:

Magic : a92b4efc

Version : 1.2

Feature Map : 0x0

Array UUID : 7d2a94ca:d9a42ca9:a4e6f976:8b5ca26b

Name : BruceLee:0 (local to host BruceLee)

Creation Time : Mon Feb 4 23:07:01 2013

Raid Level : raid5

Raid Devices : 4


Avail Dev Size : 5860271024 (2794.40 GiB 3000.46 GB)

Array Size : 8790405888 (8383.18 GiB 9001.38 GB)

Used Dev Size : 5860270592 (2794.39 GiB 3000.46 GB)

Data Offset : 262144 sectors

Super Offset : 8 sectors

State : active

Device UUID : 9dc56e9e:d6b00f7a:71da67c7:38b7436c


Update Time : Sat Dec 27 20:54:55 2014

Checksum : 749b3dba - correct

Events : 17012


Layout : left-symmetric

Chunk Size : 128K


Device Role : Active device 2

Array State : AAA. ('A' == active, '.' == missing)

/dev/sdd:

Magic : a92b4efc

Version : 1.2

Feature Map : 0x0

Array UUID : 7d2a94ca:d9a42ca9:a4e6f976:8b5ca26b

Name : BruceLee:0 (local to host BruceLee)

Creation Time : Mon Feb 4 23:07:01 2013

Raid Level : raid5

Raid Devices : 4


Avail Dev Size : 5860271024 (2794.40 GiB 3000.46 GB)

Array Size : 8790405888 (8383.18 GiB 9001.38 GB)

Used Dev Size : 5860270592 (2794.39 GiB 3000.46 GB)

Data Offset : 262144 sectors

Super Offset : 8 sectors

State : clean

Device UUID : 81e5776f:2a466bee:399251a0:ab60e9a4


Update Time : Sun Nov 2 09:07:02 2014

Checksum : cb4aebaf - correct

Events : 159


Layout : left-symmetric

Chunk Size : 128K


Device Role : Active device 3

Array State : AAAA ('A' == active, '.' == missing)



When checking the Disks in Ubuntu Disk Manager sda/b/c are are showing as OK and sdd is showing as OK with 64 bad sectors


If I run fsck /dev/md0


It reads:



fsck.ext2: Invalid argument while trying to open /dev/md0


The superblock could not be read or does not describe a valid ext2/ext3/ext4

filesystem. If the device is valid and it really contains an ext2/ext3/ext4

filesystem (and not swap or ufs or something else), then the superblock

is corrupt, and you might try running e2fsck with an alternate superblock:

e2fsck -b 8193 <device>

or

e2fsck -b 32768 <device>



Lastly if I run


mdadm --examine /dev/sd[a-d] | egrep 'Event|/dev/sd'


I get:


/dev/sda:

Events : 17012

/dev/sdb:

Events : 17012

/dev/sdc:

Events : 17012

/dev/sdd:

Events : 159

If I run cat /proc/mdstat I get:



Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]

md0 : inactive sdb[1](S) sdc[2](S) sdd[3](S) sda[0](S)

1172054204Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]

md0 : inactive sdb[1](S) sdc[2](S) sdd[3](S) sda[0](S)

11720542048 blocks super 1.2


unused devices: <none>


8 blocks super 1.2


unused devices: <none>



Lastly running file -s /dev/md0


I get:


/dev/md0: empty

Basically I think I need to run --assemble on the RAID but I'm afraid of losing my data but also that 4th drive concerns me a little.


Could someone advise of the best next logical steps to get this up and running again?



How to grep netcat output


I'm trying to grep live text stream from netcat, but it doesn't work for me:



netcat localhost 9090 | grep sender


returns nothing, but I'm sure that it should.


If I redirect the netcat output to a file and add some delays (simulate real environment) - then it works:



$ (sleep 5; cat netcat_output; sleep 5) | grep sender

{"jsonrpc":"2.0","method":"GUI.OnScreensaverDeactivated","params":{"data": "shuttingdown":false},"sender":"xbmc"}}


I also tried to add --line-buffered but w/o success.


What I do wrong?


Edit:


I noticed the same issue with sed, the output is empty.


But, for instance, hexdump converts text to hex live:



$ netcat localhost 9090 | hexdump -C
00000000 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 |{"jsonrpc":"2.0"|
00000010 2c 22 6d 65 74 68 6f 64 22 3a 22 50 6c 61 79 65 |,"method":"Playe|
00000020 72 2e 4f 6e 50 6c 61 79 22 2c 22 70 61 72 61 6d |r.OnPlay","param|
00000030 73 22 3a 7b 22 64 61 74 61 22 3a 7b 22 69 74 65 |s":{"data":{"ite|
00000040 6d 22 3a 7b 22 69 64 22 3a 36 2c 22 74 79 70 65 |m":{"id":6,"type|
00000050 22 3a 22 6d 6f 76 69 65 22 7d 2c 22 70 6c 61 79 |":"movie"},"play|
00000060 65 72 22 3a 7b 22 70 6c 61 79 65 72 69 64 22 3a |er":{"playerid":|
00000070 31 2c 22 73 70 65 65 64 22 3a 31 7d 7d 2c 22 73 |1,"speed":1}},"s|


Can`t mount external hdd


I am using Debian and I`m using Windows as well (much longer).


I loaded a external disk on Windows but when trying to mount on linux again I keep getting the same error:


Error mounting: mount exited with exit code 1: helper failed with: Unprivileged user can not mount NTFS block devices using the external FUSE library. Either mount the volume as root, or rebuild NTFS-3G with integrated FUSE support and make it setuid root. Please see more information at http://tuxera.com/community/ntfs-3g-faq/#unprivileged


Tried mounting with command line but got another error:


:~$ sudo mount -t ntfs /dev/sda1 /media Mount is denied because the NTFS volume is already exclusively opened. The volume may be already mounted, or another software may use it which could be identified for example by the help of the 'fuser' command.


A little help would be much appreciated since all my files are on that hdd?



Is app-crypt/gnupg on Portage or overlays?


I want to use multiple pgp key servers with the sks key server group witch imply gnupg-curl installation for the hkps protocol.


But I didn’t find gnupg-curl as an ebuild in Portage or, at least, as a USE flag of app-crypt/gnupg.


So what is the best solution? Using an overlay or compile it by myself?



linux/shell command to control screen brightness in android


I am working on a kiosk project using an android tablet.If there is no input power to the kiosk for a long time then, the tablet will eventually shutdown.In order to auto-reboot the tab when the power comes back I modified the code in my tabs battery animation file(ipod) using:



#!/system/bin/sh
sleep 300
/system/bin/reboot


However,during the sleep period(shown above),the tabs screen remains in the ON state (and hence takes longer retries for the tab to charge and bootup).I need to turn the screen OFF. What is the command I should use prior to the sleep command to turn my tabs screen OFF during the charging/bootup stage. Thanks !



Echoing stdin when running an ed(1) script


Given the following ed script,



$ cat helloworld
a
hello
world
.
,n
,s,o,O,g
,n
Q


I would like to obtain somehow the interactive output



$ ed
a
hello
world
.
,n
1 hello
2 world
,s,o,O,g
,n
1 hellO
2 wOrld
Q
$


instead of the expected



$ cat helloworld | ed
1 hello
2 world
1 hellO
2 wOrld
$


Is that possible, maybe using a third-party utility? Thanks in advance!


Edit: I guess I should add some motivation. I would like to produce some sample ed sessions, and probably save them with script(1). If this process is performed "live", any modifications would basically imply typing the whole tutorial again (bad) or alternatively "figuring out" the output, potentially based on a long editing session (worse).



Concatenate and pass as parameter, bash


Need some help with removing default gateway. For example, there is an IP 192.168.4.15 with default gateway 192.168.4.14. I connect to WLAN with gw 10.0.0.1 and after that I would like do remove previous gw.



IFS='.' read -ra IPARR <<< "$IP"
Gateway="${IPARR[0]}.${IPARR[1]}.${IPARR[2]}.14"
ssh blah@$IP '/sbin/route -v del default gw $Gateway;'
#ssh blah@$IP '/sbin/ip route delete $Gateway dev rndis0;'
#ssh blah@$IP '/sbin/route -n'


Both ways don't work. However, it is possible to remove it if I ssh into machine. My guess is that something wrong with passing $Gateway variable. Any suggestions?



how to find files based on filename range?


I have some files with numeric names: 2341a.po, 4567211someword.po, 0012.po, etc. I would like to find a set of files based on the numeric range. such as [126 - 363].


Normally I use regular expression with find. Any numeric range [N, M] can be composed with two regular expressions larger than N and less than M.


The larger than N:


If N = vxyz, then I first do a match for all value > V000, (V=v+1) with [V-9]\d{3,}


Then match vX00, X=x+1, with v[X-9]\d\d


Then match vxY0, Y=y+1, with vx[Y-9]\d


And last vxy[z-9]


Example:


To match number>=234, I use:



`^(0*([3-9]\d{2,}|2[4-9]\d|23[4-9]))`


The smaller than M:


Based on similar logic we will have:



^(0*(vxy[0-z]|vx[0-Y]\d|v[0-X]\d\d|[1-V]\d\d|\d{1,3}))[^0-9]


With Y=y-1,X=x-1,V=v-1


For example, the follow command will find any file between [253, 326]:



find . -maxdepth 1 -type f -regextype posix-extended -iregex '^\./0*([3-9][0-9]{2,}|2[6-9][0-9]{2,}|25[3-9]).*' -iregex '^\./0*(32[0-6]|3[0-1][0-9]|[0-2][0-9][0-9]|[0-9]{1,2})[^0-9].*'


However, this method is too annoying to handle long numbers. Is there any better and easier way to do this?



Where to download or install cent os 32 bit


i m unable to find 32 bit iso for CentOs. I tried on google it is giving me 64 bit only and in my virtual box 64 option is missing.



VNC into login screen (instead of user's desktop)


I'm using RasPi B+ with Raspian from Noobs, lightdm, lxde




There are various descriptions out there on how to set up TightVNC on a RasPi, most of them VNC into root's desktop or another pre-specified user's desktop. I would like to see the lightdm login screen instead when connecting via VNC. Reasons:



  • flexibility: not being limited to a specific user (especially not root)

  • functionality: those recipes force a user, then use startx or the like, which gives you a slightly crippled lxde session (no permission to mount USB devices, no reboot/shutdown).


I was able to set something like this up using x11vnc, using recipes like:



This starts x11vnc together with lightdm and mirrors the main desktop over to VNC. Drawbacks:



  • performance: x11vnc is considerably slower than tightvnc. I've played with the x11vnc flags for a day, but have to reduce quality a lot to get somewhere near the performance of tightvnc.

  • boot performance: having to boot into lightdm instead of command line adds about 10secs on boot time.

  • CPU load: x11vnc constantly uses about 15-30% CPU


Is there a way to get TightVNC to load the lightdm login screen? I reckon I need to modify the line /usr/bin/lxsession -s LXDE & in ~/.vnc/xstartup, but unsure how. Any help appreciated!



how to transfer 1G big file via TCP in C lanuage


I am a Chinese student, it's my first time to ask question in this site,my English is pool.Now,I need to transfer a big file, for example:1G or larger. how to write C code(Linux-based), or any good idea to transfer a big file which can be successfully received without mistake.Thanks very much!