mardi 30 décembre 2014

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 !