gdb cannot attach to a running process

Март 17th, 2014 | Posted by elenst in Pensieve - (Комментарии отключены)

gdb complains on Ubuntu: “ptrace: Operation not permitted

For runtime:
echo 0 > /proc/sys/kernel/yama/ptrace_scope

Persistent:
set kernel.yama.ptrace_scope = 0 in /etc/sysctl.d/10-ptrace.conf

Creating a local deb repository with MariaDB packages

Май 22nd, 2013 | Posted by elenst in Pensieve | Testing - (Комментарии отключены)

Based on Daniel’s email and my own experience.

Variables to set:

DEBIAN=/path/to/mkrepo-debian.sh # /path/to/mariadb-tools/buildbot/mkrepo-debian.sh)
UBUNTU="/path/to/mkrepo-ubuntu.sh" # (/path/to/mariadb-tools/buildbot/mkrepo-ubuntu.sh)
version="mariadb-10.0.2" # change to whatever makes sense
tree="10.0" # change to whatever tree you are using
tarbuildnum="3544" # change to the correct tar build number
archive_dir="/media/backup/archive/pack" # this is on hasky, but it should be local, so I need to create some $(archive_dir)/$(tree) folder locally, and copy build-$(tarbuildnum) from hasky into it.

Modify mkrepo-debian.sh and mkrepo-ubuntu.sh scripts to use my GPG key.
If needed, modify the scripts to exclude distributions that aren’t needed, especially if they are not present on hasky.

Might need to install reprepro if it’s not there yet:
apt-get install reprepro

mkdir -v /path/to/where/i/want/${version}/repo
cd /path/to/where/i/want/${version}/repo
eval $(gpg-agent --daemon)
${DEBIAN} debian ${archive_dir}/${tree}/build-${tarbuildnum}
${UBUNTU} ubuntu ${archive_dir}/${tree}/build-${tarbuildnum}

I actually didn’t run eval $(gpg-agent —daemon) , don’t even have it installed, and it still worked all right, or so it seemed.

Then, add

deb file:///path/to/where/i/want/${version}/repo/ubuntu precise main
deb-src file:///path/to/where/i/want/${version}/repo/ubuntu precise main

(and comment the previous one if there was any).
Replace ubuntu and precise with whatever you’re on.

Run

sudo apt-get update

It might complain about GPG key, then make sure it’s installed as described in http://elenst.ru/pensieve/it-bits/creating-and-installing-a-local-gpg-key-for-testing-purposes/

Then install as usual.

Creating and installing a local GPG key for testing purposes

Май 22nd, 2013 | Posted by elenst in Pensieve | Testing - (Комментарии отключены)

No fancy GUI is necessary. The base gpg is installed on Ubuntu by default.

gpg --gen-key

Use default type, size and duration.
Enter the name and the email address (I suppose it doesn’t matter which as long as it’s for testing only).
Type O to create the key.
Enter a passphrase twice.
Move your mouse like crazy, but try to spare the effort, it might take long and you’ll get tired. When it’s enough, it will tell you it’s enough. Until it does, keep moving. Don’t stop for long, or you’ll have to repeat the exercise.

The file pubring.gpg will appear in $HOME/.gnupg/

Finally,

sudo apt-key add $HOME/.gnupg/pubring.gpg

Now I can run apt-get update with repos where something is signed with this key.

Setting static IP on Ubuntu 12.10

Январь 20th, 2013 | Posted by elenst in Pensieve - (Комментарии отключены)

Sound advice I found here http://www.techienote.com/2012/10/configure-static-ip-ubuntu-12-10-12-04.html after torturing myself and my newly installed VM for quite a while:

In /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.98
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
dns-nameservers 8.8.8.8 8.8.2.2

(dns-namesevers == gateway == router also works for me)

Installing Java on Ubuntu — meant to be easy, right?

Август 22nd, 2012 | Posted by elenst in Pensieve - (Комментарии отключены)

Actually, I was installing Cassandra. But this is another story, I’m afraid will be coming soon.

So, Cassandra wants Java, specifically
Depends: openjdk-6-jre-headless (>= 6b11) but it is not going to be installed

JDK wants tzdata-java, no specifics:
Depends: tzdata-java but it is not going to be installed

tzdata-java wants tzdata, but…
Depends: tzdata (= 2011k-1) but 2012b-0ubuntu0.11.10 is to be installed

Fun, isn’t it? It’s not like I’m trying to pull Java from some obscure repository.

Some digging revealed that 2011K-1 lives on Ubuntu Main repository, while 2012b (or even 2012e) on Ubuntu Proposed Main repository. There wasn’t the Proposed Main repository on my source list… I wonder where it was pulling it from. (Maybe it was from the Cassandra repo? I didn’t think about it back then.) Anyway, even although my source list is nearly pristine, I prefer to think that it was a problem with my configuration, rather than suspect that the Ubuntu main repository offers conflicting packages.

And ‘anyway’ again, since we’re already playing with 2012e, I’d rather they give me both of that.
So, I added the Proposed Main repository. No luck, still the same incompatibility. I tried to remove the Main repository. No luck again. Well, there are many default Ubuntu repositories in the sources.list, I didn’t feel like playing with them all, especially since apt-get update is annoyingly slow. So, I replaced /etc/apt/sources.list with a dummy one which contained only the Proposed Main repository:
deb http://archive.ubuntu.com/ubuntu/ oneiric-proposed main

And voila!

Stupid workaround, but fast if you know what you want, but don’t know exactly what you’re doing.

I even remembered to restore the initial sources.list afterwards, but of course I forgot to ‘apt-get update’ it, and spent a couple of fancy minutes trying to figure out why now Cassandra refuses to install, pretending it had never been there…

GPG error: BADSIG .. Ubuntu Archive Automatic Signing Key

Август 21st, 2012 | Posted by elenst in Pensieve - (Комментарии отключены)


GPG error: http://ru.archive.ubuntu.com oneiric Release: The following signatures were invalid:
BADSIG <..> Ubuntu Archive Automatic Signing Key
A error occurred during the signature verification. The repository is not updated and the previous index files will be used.
GPG error: http://extras.ubuntu.com oneiric Release: The following signatures were invalid:
BADSIG <..> Ubuntu Extras Archive Automatic Signing Key
Failed to fetch http://extras.ubuntu.com/ubuntu/dists/oneiric/Release
Some index files failed to download. They have been ignored, or old ones used instead.

Solution (well, workaround):
sudo rm /var/lib/apt/lists/* && sudo rm /var/lib/apt/lists/partial/* && sudo apt-get update

Discussion:
https://bugs.launchpad.net/ubuntu/+source/synaptic/+bug/863306

I took it from here

Deceiving xfs: if you want the real deal, go for xfsprogs

Август 17th, 2012 | Posted by elenst in Pensieve - (Комментарии отключены)

You think you are smart when you run sudo mkfs -j -t ext3 /dev/sdb1? But you’re not. Look what happens:
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
...

It’s still same old mke2fs, also known as “make me extN”. Quick look at man mkfs says that what I really want is mkfs.xfs. Only, I don’t have what I want.

How does one get what they want on Ubuntu? Ask apt-get. The question is what to ask. It’s not like I can say sudo apt-get install mkfs.xfs, can I? One can dream… How about sudo apt-get install xfs, it looks like an obvious choice? And it does install!

Spoiler: don’t trust obvious choices.

Still no mkfs.xfs. So, what did we get?
xfs(1): X font server
facepalm.

So, google it!

However opensource and free it is, every time I type in a search engine ‘Download <something>’, I feel like I’m cheating. anyway, the first link goes here

And now, sudo apt-get install xfsprogs… Finally.

sudo mkfs.xfs /dev/sdb1

mkfs.xfs: /dev/sdb1 appears to contain an existing filesystem (ext3).
mkfs.xfs: Use the -f option to force overwrite.

Yeah, tell me about it — I’ve already formatted to ext3, remember?

sudo mkfs.xfs -f /dev/sdb1

blah-blah-blah
sudo mount /dev/sdb1 /mnt
df -kT
/dev/sdb1 xfs 1039392 4256 1035136 1% /mnt

Profit!

Need to remove the wrong XFS. X font server, my goodness.

Turning ubuntu firewall off/on

Июль 19th, 2012 | Posted by self in Pensieve - (Комментарии отключены)

A quick note not to search next time:
sudo ufw disable / sudo ufw enable
(reboot if necessary)