manywaypark's Blog
개발, 검색, 함수

grub은 일단 한번 부팅에 실패하면,  다음 부트시에는 무조건 부트 메뉴에서 대기하면서 사용자의 입력을 받는데, 여러가지 이유로 좀 귀찮다. 타임아웃을 주고 그냥 부팅 시도하게 하자.

/etc/default/grub 파일에 아래 내용 추가 후, sudo update-grub해주면 된다.

GRUB_RECORDFAIL_TIMEOUT=120      # wait for 120 sec.


ref: http://askubuntu.com/questions/178091/how-to-disable-grubs-menu-from-showing-up-after-failed-boot


happy hackin'


ubuntu 64bit에서 32bit package 설치하기 (예시):

$ sudo dpkg --add-architecture i386

$ sudo apt-get update

$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

ref: http://selendroid.io/setup.html


happy hackin'

ubuntu unity indicators

tips & tricks/Linux/Unix 2015. 2. 25. 11:17 by manywaypark

unity top panel에 추가 가능한 다양한 indicator들이 있다. 보통 top panel은 상단에 위치하고 indicator들은 우측에 배치된다.

대충 아래와 같이 하면 현재 설치가능한 indicator들을 볼 수 있는데,

apt-cache search indicator | grep ^indicator

실제로는 PPA로 제공되는 경우가 많다.

여기에서 다양한 indicator들을 찾을 수 있다.

http://askubuntu.com/questions/30334/what-application-indicators-are-available

나는 indicator-multiload, indicator-sensors 등을 설치했다.


ref: http://askubuntu.com/questions/29757/what-can-replace-system-monitoring-in-the-top-gnome-panel-in-unity


happy hackin'


2015-03-09 http://www.webupd8.org/2013/10/8-things-to-do-after-installing-ubuntu.html (여기에도 app indicator 들 소개하는 부분이 있다).

문제

좀 기괴한 방법으로 Ubuntu Server 14.04를 설치후 ubuntu-desktop등의 패키지 설치로 X Window 환경을 구축했더니, 시스템 메뉴바(용어가 맞나? 여튼 우측 상단, ubuntu unity에서는 top panel이라고 칭하는 듯)의 network관련 indicator에

이더넷 네트워크

장치가 관리되지 않음

으로 표시되고 인터페이스를 새로 추가해도 동작하지 않았다.


해결

/etc/NetworkManager/NetworkManager.conf 파일을 편집해서 managed=falsemanaged=true로 변경한다.

/etc/network/interfaces 파일에서 문제가된 device (내경우 eth0)를 삭제한다. 

그리고 sudo reboot


첨언

GUI에서의 설정과 /etc/network/interfaces 파일에서의 설정을 enable/disable하는 방법이 이거였구나.


refs:

https://help.ubuntu.com/community/NetworkManager

http://www.ubuntu-kr.org/viewtopic.php?p=103625

http://forum.falinux.com/zbxe/index.php?document_srl=532721&mid=lecture_tip -> 이건 mac address 변경되었을 때 eth0 device 찾는법.

소스를 받고, 압축 푼 후에 ./configure한다.

최초 configure하면 뭔가 안되는 것이 있다고 하면서 link를 알려주는데 따라가서 의존성 있는 라이브러리들을 다 받는다.

gmp, mpc, mpfr 등을 받아서 한쪽에 압축을 풀어놓으면 된다.

다시 gcc 압축을 푼 곳에서 다음과 같이 라이브러리에 대한 sym link를 생성해준다. 

cd path/to/gcc-src

ln -s ../gmp-x.y.z ./gmp

ln -s ../mpc-x.y.z ./mpc

ln -s ../mpfr-x.y.x ./mpfr


이제 ./configure, make 잘 될것이다.

간혹 잘 안되는 경우가 있는데.

apt-get install gcc-multilib (또는 더 확실히) apt-get build-dep gcc 등이 필요할 수도 있다.


refs:

http://askubuntu.com/questions/251978/cannot-find-crti-o-no-such-file-or-directory

https://gcc.gnu.org/ml/gcc-help/2009-05/msg00238.html


happy hackin'


일단 레드마인 박스에 루트 권한으로 적당한 곳에 소스를 저장할 디렉토리를 만든다.

(현재 내가 알기로 git은 간단히 remote url 입력해서 해결 되지는 않는다)

$ sudo -i

# mkdir /var/src-repos

# mkdir /var/src-repos/[redmine-prj-name]     # 여러 개의 project가 아니라면 이 단계는 생략

# cd $_

# git clone --mirror [url-of-git-repo] [local-dir-name]


이제는 redmine의 프로젝트 설정에서 (Settings > Repositories) +New repository를 선택해서 local directory를 repositiory로 추가한다.

SCM: Git

Identifier: what-ever-you-want

URL: /var/src-repos/[redmine-prj-name]/[local-dir-name]

프로젝트의 repository 에 가보면 추가된 것을 확인 할 수 있다.

여기서 끝이면 좋겠지만, 자동 업데이트 따위가 지원되지 않는다. Orz.


루트로 아래와 같은 파일을 하나 만들어서 crontab에 등록해 적당한 주기로 sync 시키면 해결된다.

#!/bin/bash


REPOS=`ls -d /var/src-repos/*/*`        # 다중 프로젝트 아니면 */* -> *


for repo in $REPOS

do

    cd $repo

    git remote update

done


내 경우 ~/bin/sync-src-repos.sh로 저장했고 crontab -e 하면 다음과 같이 나온다.
......
*/30 * * * * /root/bin/sync-src-repos.sh

......


happy hackin'


일단 npm을 설치하고 나서 bower를 설치한다.

$ sudo apt-get npm

$ sudo npm install -g bower

대충 아래와 같이 하면 다운로드 받아서 설정해주는 건데...

bower install angular#1.2.17

or

bower install angular#1.3.0-beta.11

현재 내 ubuntu box(Linux my-lin 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux)에서는 npm만 설치해서는 안됐고 nodejs-legacy package도 같이 설치해야 동작했다.

그냥 node라고 치면 아무것도 실행 안되고 node 또는 nodejs-legacy에 있다고 나오는데,

The program 'node' can be found in the following packages:

 * node

 * nodejs-legacy

Try: sudo apt-get install <selected package>

생각 없이 node를 설치했더니 완전히 꼬임. Orz
여튼 nodejs-legacy를 설치하고 하면 잘 됨.

refs:
http://bower.io/
https://github.com/bower/bower/issues/201
 

happy hackin'

mail notification 문제

tips & tricks/Linux/Unix 2014. 5. 19. 17:26 by manywaypark

Jenkins, ReviewBoard 등 개발 지원 도구를 최초 설치하고나서 알림 메일 설정한 후에 메일이 발송되지 않는 경우가 있다.

로그를 보면 대충 다음과 같다.

ReviewBoard의 경우:

root@cr:/var/log/review-board# tail -f reviewboard.log

2014-04-02 05:29:21,272 - ERROR -  - Error sending e-mail notification with subject 'Review Request 25: test' on behalf of '"mr foo" <foo@bar.com>' to '"A team" <a@bar.com>,"mr foo" <foo@bar.com>': [Errno 111] Connection refused

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.11-py2.7.egg/reviewboard/notifications/email.py", line 244, in send_review_mail

    message.send()

  File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/mail/message.py", line 248, in send

    return self.get_connection(fail_silently).send_messages([self])

  File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/mail/backends/smtp.py", line 85, in send_messages

    new_conn_created = self.open()

  File "/usr/local/lib/python2.7/dist-packages/Django-1.4.5-py2.7.egg/django/core/mail/backends/smtp.py", line 48, in open

    local_hostname=DNS_NAME.get_fqdn())

  File "/usr/lib/python2.7/smtplib.py", line 249, in __init__

    (code, msg) = self.connect(host, port)

  File "/usr/lib/python2.7/smtplib.py", line 309, in connect

    self.sock = self._get_socket(host, port, self.timeout)

  File "/usr/lib/python2.7/smtplib.py", line 284, in _get_socket

    return socket.create_connection((port, host), timeout)

  File "/usr/lib/python2.7/socket.py", line 571, in create_connection

    raise err

error: [Errno 111] Connection refused


Jenkins의 경우:

......

Sending e-mails to: a@bar.com

ERROR: Could not connect to SMTP host: localhost, port: 25

javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;

  nested exception is:

    java.net.ConnectException: Connection refused

    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)

    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)

    at javax.mail.Service.connect(Service.java:295)

    at javax.mail.Service.connect(Service.java:176)

    at javax.mail.Service.connect(Service.java:125)

    at javax.mail.Transport.send0(Transport.java:194)

    at javax.mail.Transport.send(Transport.java:124)

    at hudson.tasks.MailSender.execute(MailSender.java:117)

    at hudson.tasks.Mailer.perform(Mailer.java:137)

    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)

    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)

    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)

    at hudson.model.Build$BuildExecution.post2(Build.java:183)

    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)

    at hudson.model.Run.execute(Run.java:1701)

    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)

    at hudson.model.ResourceController.execute(ResourceController.java:88)

    at hudson.model.Executor.run(Executor.java:231)

Caused by: java.net.ConnectException: Connection refused

    at java.net.PlainSocketImpl.socketConnect(Native Method)

    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)

    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)

    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:385)

    at java.net.Socket.connect(Socket.java:546)

    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286)

    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)

    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)

    ... 17 more

Finished: FAILURE


내 경우 fresh install한 ubuntu box에 mailutils package가 깔려있지 않아서 생긴 문제였다.

$ sudo apt-get install mailutils


happy hackin'

lists exported symbols

tips & tricks/Linux/Unix 2014. 5. 19. 16:05 by manywaypark

shared object 파일에서 어떤 symbol들이 export되는지 궁금해지는 경우가 있다.

(특히 unsolved external symbol 따위 linker error가 발생할 경우)

다음과 같이 하면 symbol들을 human-readable한 형태로 뽑아준다.

$ (find . -name '*.a'|xargs nm -f posix; find . -name '*.so' | xargs nm -f posix -D)|cut -f1 -d' '|LANG=C sort -u > all_symbols

$ grep '^_Z' all_symbols | c++filt|sort > demangled_c++_symbols


refs:

http://gcc.gnu.org/wiki/Cxx11AbiCompatibility

http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object


happy hackin'

분명히 현재 scope에 nUnit이라는 변수가 있음에도 불구하고 아래처럼 symbol을 제대로 찾지 못했다.


......

(gdb) p nUnit

No symbol "nUnit" in current context.

(gdb)


gcc4.8 + gdb7.5에서는 컴파일 옵션에 "-g -gdwarf-2"를 줘야 제대로 동작한다.

즉 debug build는 아래처럼 configure한다.

./configure --prefix=/path/to/prefix CPPFLAGS=-DDEBUG CXXFLAGS="-g -gdwarf-2 -O0"


refs:

http://stackoverflow.com/questions/12595631/debugging-with-gdb-on-a-program-with-no-optimization-but-still-there-is-no-symbo


happy hackin'

1 2 3 4 5 6 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
Linux/Unix (57)
Win (19)
Qt (11)
Xcode (1)
Mac (8)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

04-20 11:31